Skip to content

Commit

Permalink
refactor: method rename
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhani-cw committed Feb 23, 2024
1 parent 9bc10b2 commit a3e2a7d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/eth/primitives/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ impl Block {
&self.header.hash
}

/// Compact block execution changes removing all intermediate changes, keeping only the last value for each modified nonce, balance, bytecode and slot.
pub fn compact_execution_changes(&self) -> Vec<ExecutionAccountChanges> {
/// Compact accounts changes removing intermediate values, keeping only the last modified nonce, balance, bytecode and slots.
pub fn compact_account_changes(&self) -> Vec<ExecutionAccountChanges> {
let mut block_compacted_changes: HashMap<Address, ExecutionAccountChanges> = HashMap::new();
for transaction in &self.transactions {
for transaction_changes in transaction.execution.changes.clone().into_iter() {
Expand Down
4 changes: 2 additions & 2 deletions src/eth/storage/inmemory/inmemory_permanent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl PermanentStorage for InMemoryPermanentStorage {
let mut state = self.lock_write().await;

// check conflicts before persisting any state changes
let account_changes = block.compact_execution_changes();
let account_changes = block.compact_account_changes();
if let Some(conflicts) = Self::check_conflicts(&state, &account_changes).await {
return Err(StorageError::Conflict(conflicts));
}
Expand All @@ -308,7 +308,7 @@ impl PermanentStorage for InMemoryPermanentStorage {
}

// save block execution changes
Self::save_account_changes(&mut state, *block.number(), block.compact_execution_changes()).await;
Self::save_account_changes(&mut state, *block.number(), block.compact_account_changes()).await;

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/eth/storage/postgres/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ impl PermanentStorage for Postgres {
.await
.context("failed to insert block")?;

let account_changes = block.compact_execution_changes();
let account_changes = block.compact_account_changes();

for transaction in block.transactions {
let is_success = transaction.is_success();
Expand Down

0 comments on commit a3e2a7d

Please sign in to comment.