From f3be3e0f7421fc83d1abf8ceef104e19aa857e2a Mon Sep 17 00:00:00 2001 From: forcodedancing Date: Fri, 18 Oct 2024 15:22:32 +0800 Subject: [PATCH] change insert/replace --- .github/workflows/docker.yml | 12 +++---- crates/chain-state/src/cache/plain_state.rs | 35 ++++++++++++++++----- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d1fed16857..6654087cda 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -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 \ No newline at end of file diff --git a/crates/chain-state/src/cache/plain_state.rs b/crates/chain-state/src/cache/plain_state.rs index 9dc37b6e8b..cb907181d3 100644 --- a/crates/chain-state/src/cache/plain_state.rs +++ b/crates/chain-state/src/cache/plain_state.rs @@ -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; @@ -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, ); } } @@ -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 { @@ -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); } } }