Skip to content

Commit

Permalink
change insert/replace
Browse files Browse the repository at this point in the history
  • Loading branch information
forcodedancing committed Oct 18, 2024
1 parent 40ea60e commit f3be3e0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 14 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ jobs:
# run: make PROFILE=maxperf docker-build-push-latest
# - name: Build and push reth image
# run: make PROFILE=maxperf docker-build-push
- name: Build and push op-reth image, tag as "latest"
run: make IMAGE_NAME=$OP_IMAGE_NAME DOCKER_IMAGE_NAME=$OP_DOCKER_IMAGE_NAME PROFILE=maxperf op-docker-build-push-latest
- name: Build and push op-reth image
run: make IMAGE_NAME=$OP_IMAGE_NAME DOCKER_IMAGE_NAME=$OP_DOCKER_IMAGE_NAME PROFILE=maxperf op-docker-build-push
- name: Build and push bsc-reth image, tag as "latest"
run: make IMAGE_NAME=$BSC_IMAGE_NAME DOCKER_IMAGE_NAME=$BSC_DOCKER_IMAGE_NAME PROFILE=maxperf bsc-docker-build-push-latest
# - name: Build and push op-reth image, tag as "latest"
# run: make IMAGE_NAME=$OP_IMAGE_NAME DOCKER_IMAGE_NAME=$OP_DOCKER_IMAGE_NAME PROFILE=maxperf op-docker-build-push-latest
# - name: Build and push op-reth image
# run: make IMAGE_NAME=$OP_IMAGE_NAME DOCKER_IMAGE_NAME=$OP_DOCKER_IMAGE_NAME PROFILE=maxperf op-docker-build-push
# - name: Build and push bsc-reth image, tag as "latest"
# run: make IMAGE_NAME=$BSC_IMAGE_NAME DOCKER_IMAGE_NAME=$BSC_DOCKER_IMAGE_NAME PROFILE=maxperf bsc-docker-build-push-latest
- name: Build and push bsc-reth image
run: make IMAGE_NAME=$BSC_IMAGE_NAME DOCKER_IMAGE_NAME=$BSC_DOCKER_IMAGE_NAME PROFILE=maxperf bsc-docker-build-push
35 changes: 27 additions & 8 deletions crates/chain-state/src/cache/plain_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,16 @@ impl<'a, TX> PlainCacheWriter<'a, TX> {
Ok(mut cursor) => {
for block in blocks {
if block.block.number % 100 == 0 {
info!("CACHE_SZ {}", PLAIN_STORAGES.len());
info!(
"ACCOUNT_CACHE_SZ {}, block number {}",
PLAIN_ACCOUNTS.len(),
block.block.number
);
info!(
"STORAGE_CACHE_SZ {}, block number {}",
PLAIN_STORAGES.len(),
block.block.number
);
};
PLAIN_STORAGES.len();
let bundle_state = block.execution_outcome().clone().bundle;
Expand All @@ -89,14 +98,22 @@ impl<'a, TX> PlainCacheWriter<'a, TX> {
PLAIN_ACCOUNTS.remove(address);
}
Some(acc) => {
let _ = PLAIN_ACCOUNTS.replace(
// let _ = PLAIN_ACCOUNTS.replace(
// *address,
// Account {
// nonce: acc.nonce,
// balance: acc.balance,
// bytecode_hash: Some(acc.code_hash),
// },
// true,
// );
PLAIN_ACCOUNTS.insert(
*address,
Account {
nonce: acc.nonce,
balance: acc.balance,
bytecode_hash: Some(acc.code_hash),
},
true,
);
}
}
Expand All @@ -105,6 +122,7 @@ impl<'a, TX> PlainCacheWriter<'a, TX> {
// Update storage cache
for storage in &change_set.storage {
if storage.wipe_storage {
info!("WIPE_STORAGE, block number {}", block.block.number);
let walker = cursor.walk_dup(Some(storage.address), None).unwrap();
for kv in walker {
match kv {
Expand All @@ -120,11 +138,12 @@ impl<'a, TX> PlainCacheWriter<'a, TX> {
}

for (k, v) in storage.storage.clone() {
let _ = PLAIN_STORAGES.replace(
(storage.address, StorageKey::from(k)),
v,
true,
);
// let _ = PLAIN_STORAGES.replace(
// (storage.address, StorageKey::from(k)),
// v,
// true,
// );
PLAIN_STORAGES.insert((storage.address, StorageKey::from(k)), v);
}
}
}
Expand Down

0 comments on commit f3be3e0

Please sign in to comment.