You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In save_block, the latest cache is populated before persisting the block to permanent storage. If perm.save_block fails, the cache may reflect uncommitted state, leading to inconsistency between the in‐memory cache and the durable store.
In prepare_batch_with_execution_changes, every account in State<Final> is now inserted into the batch even if no fields changed. The previous change.is_modified() check was removed, resulting in unnecessary writes and bloated block_changes entries.
The storage_ref function is defined to return a Result<U256, Self::Error> but is currently returning a Uint, causing a type mismatch. Replace Uint::default() with U256::default() (or U256::zero()) to return the correct type and remove the unused Uint import if it's no longer needed.
if address.is_ignored() {
- return Ok(Uint::default());+ return Ok(U256::default());
}
Suggestion importance[1-10]: 9
__
Why: The function signature returns Result<U256, _> but the code returns a Uint, causing a type mismatch; using U256::default() resolves the compilation error and aligns with the expected return type.
High
General
Clear cache after finishing block
To avoid serving stale cache entries after finalizing the pending block, clear the in-memory caches when a block finishes. This ensures new reads reflect the updated chain state.
let result = timed(|| self.temp.finish_pending_block()).with(|m| {
metrics::inc_storage_finish_pending_block(m.elapsed);
});
Span::with(|s| s.rec_str("block_number", &result.0.header.number));
+self.cache.clear();
result
Suggestion importance[1-10]: 7
__
Why: Inserting self.cache.clear() after finish_pending_block prevents stale cache entries and ensures subsequent reads reflect the new chain state.
Medium
Filter only changed slots
Only include storage slots that were actually mutated by the transaction to avoid bloating the state. Filter storage entries by value.is_changed() before inserting.
Why: Filtering for value.is_changed() before inserting slots avoids bloating the State with unchanged storage entries, improving memory use without breaking behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Enhancement
Description
Introduce generic
State<S>replacingChangesSimplify cache: remove pending cache, use
TinyUfofor latestRefactor storage APIs to accept
State<Complete>/State<Final>Update EVM and miner to pass
statewith transactionsDiagram Walkthrough
File Walkthrough
16 files
Remove pending cache & adapt read/cache logicDefine `Change` trait & remove old `Changes`Replace quick_cache with `TinyUfo` and versioningAdd `state: State` to execution outputPropagate state through executor and miner callsStore `State` in temp transaction storageAccept `State` & update batch insertionIntroduce generic `State` and `Stage` markersChange `save_execution` signature with stateUnify call and transaction storage, use `State`Persist `TransactionExecutionResult` & stateUse `input` instead of `evm_input` fieldsUpdate transaction input references in blockMap `AccountChanges` into RocksDB changesAdd `update` method for `AccountChanges`Use `tx.input` instead of `tx.evm_input` in events25 files