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
Currently a single slot read in a transaction results in at least 3 cache reads, and at most 4 cache reads, 1 temp read, 1 perm read and 2 cache writes. These changes make it so at least it results in 1 temp-read, and at most 1 temp, 1 cache and 1 perm read and 0 cache writes. (with temp + latest cache covering 100% of the reads the pending cache potentially covered)
The temp now acts as the "pending cache" effectively, and the latest cache is updated with slots that were touched alongside slots that were modified when we commit the block. The latest cache is also still updated by eth_call.
Local benchmarking showed a 7% increase in throughput after these changes.
We're likely to see some more gains by optimizing the temp storage's State merge operation and reads.
PR Type
Enhancement, Tests
Description
Rename evm_input/result to input/output fields
Introduce Full stage for richer Changes API
Remove pending cache and simplify storage flows
Update miner, importer, and stratus_storage accordingly
File Walkthrough
Relevant files
Enhancement
19 files
mod.rs
Rename transaction execution fields in EVM executor
The new read_temp method returns Option<Self> and drops any StorageError from temporary storage reads, conflating errors with a missing value. This hides underlying storage failures and can lead to silent data inconsistencies. Errors should be propagated or at least logged with a reason field.
fnread_temp(s:&StratusStorage,key:Self::Key,kind:ExecutionKind) -> Option<Self>;/// Reads from permanent storage at the resolved mined point.fnread_perm(s:&StratusStorage,key:Self::Key,point:MinedPointInTime<'_>) -> Result<Self,StorageError>;/// Caches the value as a latest (mined tip) entry, if not already cached.fncache_latest_if_missing(s:&StratusStorage,key:Self::Key,value:Self);}implEntityReadforAccount{typeKey = Address;fnread_temp(s:&StratusStorage,address:Address,kind:ExecutionKind) -> Option<Self>{
tracing::debug!(storage = %label::TEMP, %address,"reading account");timed(|| s.temp.read_account(address, kind)).with(|m| {if m.result.is_some(){
metrics::inc_storage_read_account(m.elapsed, label::TEMP,PointInTime::Pending,true);}})}
In finish_pending_block, errors from self.temp.finish_pending_block() are no longer logged or surfaced. Without logging the reason, failures in finishing the pending block will go unnoticed. Add a structured error log (e.g., tracing::error!(reason = ?e)) inside the timed callback.
The tracing::warn! call in save_execution uses a formatted string "Failed transaction contains {} slot change(s)" with a positional placeholder. For structured tracing, emit slot_changes = total_slot_changes as a field rather than using {} formatting.
for ((address, index), value) in changes.slots.iter() {
- slot_cache.insert((*address, *index), *value.value());+ let slot_val = value.clone().take_value();+ slot_cache.insert((*address, *index), slot_val);
}
Suggestion importance[1-10]: 7
__
Why: The code calls a non-existent .value() on CompleteValue; using .clone().take_value() properly retrieves the inner SlotValue for insertion and fixes the compilation and runtime 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.
Currently a single slot read in a transaction results in at least 3 cache reads, and at most 4 cache reads, 1 temp read, 1 perm read and 2 cache writes. These changes make it so at least it results in 1 temp-read, and at most 1 temp, 1 cache and 1 perm read and 0 cache writes. (with temp + latest cache covering 100% of the reads the pending cache potentially covered)
The temp now acts as the "pending cache" effectively, and the latest cache is updated with slots that were touched alongside slots that were modified when we commit the block. The latest cache is also still updated by eth_call.
Local benchmarking showed a 7% increase in throughput after these changes.
We're likely to see some more gains by optimizing the temp storage's State merge operation and reads.
PR Type
Enhancement, Tests
Description
Rename
evm_input/resulttoinput/outputfieldsIntroduce
Fullstage for richerChangesAPIRemove pending cache and simplify storage flows
Update miner, importer, and stratus_storage accordingly
File Walkthrough
19 files
Rename transaction execution fields in EVM executorParameterize `Changes` with `Full` stageUse `input`/`output` in default_trace tracerSwitch to `output` field in metrics and revert loggingAdd `Full` stage and extend `Changes` methodsRename `evm_input`/`result` to `input`/`output`Remove pending cache, simplify fake leader importUpdate block mining API with `Full` changesRemove old caches and fix insert_if_missingUse `Changes` in genesis and block savesUpdate batch execution with `Changes`Drop pending cache, adjust resolve and cache logicApply `output` changes in in-memory call storageSwitch to `input`/`output` in in-memory temp storageRename transaction timestamp and input usageMap `input`/`output` in rocksdb conversionUse `output` in transaction stage to_resultRemove unused metric labels in finish_pending_blockUse `input`/`output` fields in event parsing5 files