Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mixed contract code cache size #386

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions rpc-server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,20 @@ impl ServerContext {
crate::utils::gigabytes_to_bytes(rpc_server_config.general.contract_code_cache_size)
.await;

// For contract code cache we use 1/4 of total_contract_code_cache_size_in_bytes
let contract_code_cache_size_in_bytes = total_contract_code_cache_size_in_bytes / 4;
let contract_code_cache = std::sync::Arc::new(crate::cache::RwLockLruMemoryCache::new(
contract_code_cache_size_in_bytes,
));

// For compiled contract code cache we use 3/4 of total_contract_code_cache_size_in_bytes
// because the compiled contract code is bigger in 3 times than the contract code from the database
let compiled_contract_code_cache_size_in_bytes =
total_contract_code_cache_size_in_bytes / 4;
total_contract_code_cache_size_in_bytes - contract_code_cache_size_in_bytes;
let compiled_contract_code_cache = std::sync::Arc::new(CompiledCodeCache::new(
compiled_contract_code_cache_size_in_bytes,
));

// For contract code cache we use 1/4 of total_contract_code_cache_size_in_bytes
let contract_code_cache_size_in_bytes =
total_contract_code_cache_size_in_bytes - compiled_contract_code_cache_size_in_bytes;
let contract_code_cache = std::sync::Arc::new(crate::cache::RwLockLruMemoryCache::new(
contract_code_cache_size_in_bytes,
));

let total_block_cache_size_in_bytes =
crate::utils::gigabytes_to_bytes(rpc_server_config.general.block_cache_size).await;

Expand Down
Loading