Skip to content

fix: use a same trie for the same chain#1370

Merged
KaoImin merged 1 commit intomainfrom
yangby/bugfix/same-trie-for-same-chain
Aug 28, 2023
Merged

fix: use a same trie for the same chain#1370
KaoImin merged 1 commit intomainfrom
yangby/bugfix/same-trie-for-same-chain

Conversation

@chaoticlonghair
Copy link
Copy Markdown
Contributor

What this PR does / why we need it?

Currently, during axon starting, there will be 4 RocksTrieDB instances are used.
This PR only reduce the number of instances from 4 to 1.

Description

Each time to create a new instance of RocksTrieDB, a new cache will be created:

pub fn new_evm(db: Arc<DB>, cache_size: usize) -> Self {
Self::new(db, StateStorageCategory::EvmState, cache_size)
}

pub struct RocksTrieDB {
db: Arc<DB>,
category: StateStorageCategory,
cache: RwLock<HashMap<Vec<u8>, Vec<u8>>>,
cache_size: usize,
}

Different cache for different instances, then the RwLock can do nothing for consistency.

⚠️ This PR doesn't resolve the issue completely, it just avoids the issue when starts.

What is the impact of this PR?

No Breaking Change

CI Settings

CI Usage

Tip: Check the CI you want to run below, and then comment /run-ci.

CI Switch

  • Coverage Test
  • E2E Tests
  • Code Format
  • Web3 Compatible Tests
  • OCT 1-5 And 12-15
  • OCT 6-10
  • OCT 11
  • OCT 16-19
  • v3 Core Tests

CI Description

CI Name Description
Chaos CI Test the liveness and robustness of Axon under terrible network condition
Cargo Clippy Run cargo clippy --all --all-targets --all-features
Coverage Test Get the unit test coverage report
E2E Test Run end-to-end test to check interfaces
Code Format Run cargo +nightly fmt --all -- --check and cargo sort -gwc
Web3 Compatible Test Test the Web3 compatibility of Axon
v3 Core Test Run the compatibility tests provided by Uniswap V3
OCT 1-5 | 6-10 | 11 | 12-15 | 16-19 Run the compatibility tests provided by OpenZeppelin

@chaoticlonghair chaoticlonghair requested a review from a team as a code owner August 27, 2023 10:59
@chaoticlonghair chaoticlonghair requested review from Flouse, KaoImin and driftluo and removed request for ashuralyk and jjyr August 27, 2023 11:00
@KaoImin KaoImin enabled auto-merge August 28, 2023 02:32
@KaoImin KaoImin added this pull request to the merge queue Aug 28, 2023
Merged via the queue into main with commit 8ad5577 Aug 28, 2023
@Flouse Flouse deleted the yangby/bugfix/same-trie-for-same-chain branch August 28, 2023 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants