diff --git a/bins/revme/src/statetest/models/spec.rs b/bins/revme/src/statetest/models/spec.rs index 55df2eedc6..5a5561c27f 100644 --- a/bins/revme/src/statetest/models/spec.rs +++ b/bins/revme/src/statetest/models/spec.rs @@ -45,7 +45,7 @@ impl SpecName { Self::Shanghai => SpecId::SHANGHAI, Self::Cancun => SpecId::CANCUN, Self::ByzantiumToConstantinopleAt5 | Self::Constantinople => { - panic!("Overriden with PETERSBURG") + panic!("Overridden with PETERSBURG") } Self::Unknown => panic!("Unknown spec"), } diff --git a/bins/revme/src/statetest/runner.rs b/bins/revme/src/statetest/runner.rs index f93bd41906..670ad6e0c1 100644 --- a/bins/revme/src/statetest/runner.rs +++ b/bins/revme/src/statetest/runner.rs @@ -71,7 +71,7 @@ pub fn execute_test_suite( return Ok(()); } - // Test checks if nonce overflows. We are handling this correctly but we are not parsing exception in testsuite + // Test checks if nonce overflows. We are handling this correctly but we are not parsing exception in test suite // There are more nonce overflow tests that are in internal call/create, and those tests are passing and are enabled. if name == "CreateTransactionHighNonce.json" { return Ok(()); @@ -90,7 +90,7 @@ pub fn execute_test_suite( return Ok(()); } - // Skip test where basefee/accesslist/diffuculty is present but it shouldn't be supported in London/Berlin/TheMerge. + // Skip test where basefee/accesslist/difficulty is present but it shouldn't be supported in London/Berlin/TheMerge. // https://github.com/ethereum/tests/blob/5b7e1ab3ffaf026d99d20b17bb30f533a2c80c8b/GeneralStateTests/stExample/eip1559.json#L130 // It is expected to not execute these tests. if name == "accessListExample.json" diff --git a/crates/interpreter/src/instructions/stack.rs b/crates/interpreter/src/instructions/stack.rs index 34b4c3f03d..5fbe237f3e 100644 --- a/crates/interpreter/src/instructions/stack.rs +++ b/crates/interpreter/src/instructions/stack.rs @@ -26,7 +26,7 @@ pub fn push(interpreter: &mut Interpreter, _host: &mut dyn Host) gas!(interpreter, gas::VERYLOW); let start = interpreter.instruction_pointer; // Safety: In Analysis we appended needed bytes for bytecode so that we are safe to just add without - // checking if it is out of bound. This makes both of our unsafes block safe to do. + // checking if it is out of bound. This makes both of our unsafe blocks safe to do. if let Some(ret) = interpreter .stack .push_slice::(unsafe { core::slice::from_raw_parts(start, N) }) diff --git a/crates/interpreter/src/interpreter/analysis.rs b/crates/interpreter/src/interpreter/analysis.rs index 077edbd701..7f6e735b39 100644 --- a/crates/interpreter/src/interpreter/analysis.rs +++ b/crates/interpreter/src/interpreter/analysis.rs @@ -32,7 +32,7 @@ pub fn to_analysed(bytecode: Bytecode) -> Bytecode { } } -/// Analyzs bytecode to build a jump map. +/// Analyze bytecode to build a jump map. fn analyze(code: &[u8]) -> JumpMap { let mut jumps: BitVec = bitvec![u8, Lsb0; 0; code.len()]; diff --git a/crates/interpreter/src/interpreter/memory.rs b/crates/interpreter/src/interpreter/memory.rs index 2a442b959f..baedbc7143 100644 --- a/crates/interpreter/src/interpreter/memory.rs +++ b/crates/interpreter/src/interpreter/memory.rs @@ -5,7 +5,7 @@ use core::{ ops::{BitAnd, Not}, }; -/// A sequencial memory. It uses Rust's `Vec` for internal +/// A sequential memory. It uses Rust's `Vec` for internal /// representation. #[derive(Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] @@ -58,13 +58,13 @@ impl Memory { self.data.shrink_to_fit() } - /// Resize the memory. asume that we already checked if + /// Resize the memory. Assume that we already checked if /// we have enought gas to resize this vector and that we made new_size as multiply of 32 pub fn resize(&mut self, new_size: usize) { self.data.resize(new_size, 0); } - /// Get memory region at given offset. Dont check offset and size + /// Get memory region at given offset. Don't check offset and size #[inline(always)] pub fn get_slice(&self, offset: usize, size: usize) -> &[u8] { &self.data[offset..offset + size] @@ -93,11 +93,11 @@ impl Memory { } /// Set memory from data. Our memory offset+len is expected to be correct but we - /// are doing bound checks on data/data_offeset/len and zeroing parts that is not copied. + /// are doing bound checks on data/data_offset/len and zeroing parts that is not copied. #[inline(always)] pub fn set_data(&mut self, memory_offset: usize, data_offset: usize, len: usize, data: &[u8]) { if data_offset >= data.len() { - // nulify all memory slots + // nullify all memory slots for i in &mut self.data[memory_offset..memory_offset + len] { *i = 0; } @@ -107,7 +107,7 @@ impl Memory { let memory_data_end = memory_offset + (data_end - data_offset); self.data[memory_offset..memory_data_end].copy_from_slice(&data[data_offset..data_end]); - // nulify rest of memory slots + // nullify rest of memory slots // Safety: Memory is assumed to be valid. And it is commented where that assumption is made for i in &mut self.data[memory_data_end..memory_offset + len] { *i = 0; diff --git a/crates/interpreter/src/interpreter/stack.rs b/crates/interpreter/src/interpreter/stack.rs index 17584024e6..e18db34a38 100644 --- a/crates/interpreter/src/interpreter/stack.rs +++ b/crates/interpreter/src/interpreter/stack.rs @@ -257,7 +257,7 @@ impl Stack { } let slot; - // Safety: check above ensures us that we are okey in increment len. + // Safety: check above ensures us that we are okay in increment len. unsafe { self.data.set_len(new_len); slot = self.data.get_unchecked_mut(new_len - 1); diff --git a/crates/precompile/src/bn128.rs b/crates/precompile/src/bn128.rs index 6247e01b33..d51d7b1f7d 100644 --- a/crates/precompile/src/bn128.rs +++ b/crates/precompile/src/bn128.rs @@ -147,7 +147,7 @@ fn run_mul(input: &[u8]) -> Result, Error> { let mut fr_buf = [0u8; 32]; fr_buf.copy_from_slice(&input[64..96]); - // Fr::from_slice can only fail on incorect length, and this is not a case. + // Fr::from_slice can only fail on incorrect length, and this is not a case. let fr = bn::Fr::from_slice(&fr_buf[..]).unwrap(); let mut out = [0u8; 64]; diff --git a/crates/primitives/src/env.rs b/crates/primitives/src/env.rs index 83ce09cd9b..20165ae112 100644 --- a/crates/primitives/src/env.rs +++ b/crates/primitives/src/env.rs @@ -81,11 +81,11 @@ pub struct CfgEnv { pub chain_id: U256, pub spec_id: SpecId, /// Bytecode that is created with CREATE/CREATE2 is by default analysed and jumptable is created. - /// This is very benefitial for testing and speeds up execution of that bytecode if called multiple times. + /// This is very beneficial for testing and speeds up execution of that bytecode if called multiple times. /// /// Default: Analyse pub perf_analyse_created_bytecodes: AnalysisKind, - /// If some it will effects EIP-170: Contract code size limit. Usefull to increase this because of tests. + /// If some it will effects EIP-170: Contract code size limit. Useful to increase this because of tests. /// By default it is 0x6000 (~25kb). pub limit_contract_code_size: Option, /// A hard memory limit in bytes beyond which [Memory] cannot be resized. @@ -260,7 +260,7 @@ impl Env { /// Validate transaction data that is set inside ENV and return error if something is wrong. /// - /// Return inital spend gas (Gas needed to execute transaction). + /// Return initial spend gas (Gas needed to execute transaction). #[inline] pub fn validate_tx(&self) -> Result<(), InvalidTransaction> { let gas_limit = self.tx.gas_limit; @@ -315,9 +315,9 @@ impl Env { Ok(()) } - /// Validate transaction agains state. + /// Validate transaction against state. #[inline] - pub fn validate_tx_agains_state(&self, account: &Account) -> Result<(), InvalidTransaction> { + pub fn validate_tx_against_state(&self, account: &Account) -> Result<(), InvalidTransaction> { // EIP-3607: Reject transactions from senders with deployed code // This EIP is introduced after london but there was no collision in past // so we can leave it enabled always diff --git a/crates/primitives/src/precompile.rs b/crates/primitives/src/precompile.rs index 009680c6ff..8456225e0c 100644 --- a/crates/primitives/src/precompile.rs +++ b/crates/primitives/src/precompile.rs @@ -8,7 +8,7 @@ pub type CustomPrecompileFn = fn(&[u8], u64) -> PrecompileResult; #[derive(Clone, Debug, Eq, PartialEq)] pub enum PrecompileError { - /// out of gas is the main error. Other are just here for completness + /// out of gas is the main error. Other are just here for completeness OutOfGas, // Blake2 erorr Blake2WrongLength, diff --git a/crates/primitives/src/specification.rs b/crates/primitives/src/specification.rs index 1544dc42df..80d3cecd74 100644 --- a/crates/primitives/src/specification.rs +++ b/crates/primitives/src/specification.rs @@ -91,7 +91,7 @@ spec!(HOMESTEAD, HomesteadSpec); spec!(TANGERINE, TangerineSpec); spec!(SPURIOUS_DRAGON, SpuriousDragonSpec); spec!(BYZANTIUM, ByzantiumSpec); -// CONSTANTINOPLE was overriden with PETERSBURG +// CONSTANTINOPLE was overridden with PETERSBURG spec!(PETERSBURG, PetersburgSpec); spec!(ISTANBUL, IstanbulSpec); // MUIR_GLACIER no EVM spec change diff --git a/crates/revm/src/db/in_memory_db.rs b/crates/revm/src/db/in_memory_db.rs index 53f4e19d98..4630cb8a44 100644 --- a/crates/revm/src/db/in_memory_db.rs +++ b/crates/revm/src/db/in_memory_db.rs @@ -339,7 +339,7 @@ impl From for DbAccount { #[derive(Debug, Clone, Default, Eq, PartialEq)] pub enum AccountState { /// Before Spurious Dragon hardfork there was a difference between empty and not existing. - /// And we are flaging it here. + /// And we are flagging it here. NotExisting, /// EVM touched this account. For newer hardfork this means it can be cleared/removed from state. Touched, diff --git a/crates/revm/src/db/states/account_status.rs b/crates/revm/src/db/states/account_status.rs index c8b73f6040..e05ad0199d 100644 --- a/crates/revm/src/db/states/account_status.rs +++ b/crates/revm/src/db/states/account_status.rs @@ -15,7 +15,7 @@ pub enum AccountStatus { } impl AccountStatus { - /// Account is not midified and just loaded from database. + /// Account is not modified and just loaded from database. pub fn not_modified(&self) -> bool { matches!( self, diff --git a/crates/revm/src/db/states/bundle_account.rs b/crates/revm/src/db/states/bundle_account.rs index e7d65ea883..a94472b7c2 100644 --- a/crates/revm/src/db/states/bundle_account.rs +++ b/crates/revm/src/db/states/bundle_account.rs @@ -18,11 +18,11 @@ use revm_precompile::HashMap; pub struct BundleAccount { pub info: Option, pub original_info: Option, - /// Contain both original and present state. + /// Contains both original and present state. /// When extracting changeset we compare if original value is different from present value. /// If it is different we add it to changeset. /// - /// If Account was destroyed we ignore original value and comprate present state with U256::ZERO. + /// If Account was destroyed we ignore original value and compare present state with U256::ZERO. pub storage: StorageWithOriginalValues, /// Account status. pub status: AccountStatus, @@ -95,8 +95,8 @@ impl BundleAccount { for (key, slot) in revert.storage { match slot { RevertToSlot::Some(value) => { - // Dont overwrite original values if present - // if storage is not present set original values as currect value. + // Don't overwrite original values if present + // if storage is not present set original values as current value. self.storage .entry(key) .or_insert(StorageSlot::new_changed(value, U256::ZERO)) diff --git a/crates/revm/src/db/states/bundle_state.rs b/crates/revm/src/db/states/bundle_state.rs index 27076821c9..c1a67e205f 100644 --- a/crates/revm/src/db/states/bundle_state.rs +++ b/crates/revm/src/db/states/bundle_state.rs @@ -135,8 +135,8 @@ impl BundleState { } /// Get account from state - pub fn account(&self, addres: &Address) -> Option<&BundleAccount> { - self.state.get(addres) + pub fn account(&self, address: &Address) -> Option<&BundleAccount> { + self.state.get(address) } /// Get bytecode from state @@ -202,11 +202,11 @@ impl BundleState { // append storage changes - // NOTE: Assumption is that revert is going to remova whole plain storage from + // NOTE: Assumption is that revert is going to remove whole plain storage from // database so we can check if plain state was wiped or not. let mut account_storage_changed = Vec::with_capacity(account.storage.len()); if was_destroyed { - // If storage was destroyed that means that storage was wipped. + // If storage was destroyed that means that storage was wiped. // In that case we need to check if present storage value is different then ZERO. for (key, slot) in account.storage { if omit_changed_check || slot.present_value != U256::ZERO { @@ -294,7 +294,7 @@ impl BundleState { self.reverts.extend(other.reverts); } - /// This will returnd detached lower part of reverts + /// This will return detached lower part of reverts /// /// Note that plain state will stay the same and returned BundleState /// will contain only reverts and will be considered broken. diff --git a/crates/revm/src/db/states/cache_account.rs b/crates/revm/src/db/states/cache_account.rs index 35d74a6bb5..ffd6e8fb87 100644 --- a/crates/revm/src/db/states/cache_account.rs +++ b/crates/revm/src/db/states/cache_account.rs @@ -87,7 +87,7 @@ impl CacheAccount { self.account.as_ref().map(|a| a.info.clone()) } - /// Desolve account into components. + /// Dissolve account into components. pub fn into_components(self) -> (Option<(AccountInfo, PlainStorage)>, AccountStatus) { (self.account.map(|a| a.into_components()), self.status) } @@ -253,8 +253,8 @@ impl CacheAccount { | AccountStatus::Loaded | AccountStatus::Changed | AccountStatus::InMemoryChange => { - // if account is loaded and not empty this means that account has some balance - // this does not mean that accoun't can be created. + // If account is loaded and not empty this means that account has some balance. + // This means that account cannot be created. // We are assuming that EVM did necessary checks before allowing account to be created. AccountStatus::InMemoryChange } @@ -277,7 +277,7 @@ impl CacheAccount { /// Increment balance by `balance` amount. Assume that balance will not /// overflow or be zero. /// - /// Note: to skip some edgecases we assume that additional balance is never zero. + /// Note: to skip some edge cases we assume that additional balance is never zero. /// And as increment is always related to block fee/reward and withdrawals this is correct. pub fn increment_balance(&mut self, balance: u128) -> TransitionAccount { self.account_info_change(|info| { @@ -384,7 +384,7 @@ impl CacheAccount { } AccountStatus::LoadedEmptyEIP161 => { // Change on empty account, should transfer storage if there is any. - // There is posibility that there are storage inside db. + // There is possibility that there are storage inside db. // That storage is used in merkle tree calculation before state clear EIP. AccountStatus::InMemoryChange } @@ -395,7 +395,7 @@ impl CacheAccount { } AccountStatus::Destroyed | AccountStatus::DestroyedAgain => { // If account is destroyed and then changed this means this is - // balance tranfer. + // balance transfer. AccountStatus::DestroyedChanged } }; diff --git a/crates/revm/src/db/states/changes.rs b/crates/revm/src/db/states/changes.rs index ed9bc71b8e..361228cb0b 100644 --- a/crates/revm/src/db/states/changes.rs +++ b/crates/revm/src/db/states/changes.rs @@ -1,14 +1,14 @@ use revm_interpreter::primitives::{AccountInfo, Address, Bytecode, B256, U256}; /// Sorted accounts/storages/contracts for inclusion into database. -/// Structure is made so it is easier to apply dirrectly to database -/// that mostly have saparate tables to store account/storage/contract data. +/// Structure is made so it is easier to apply directly to database +/// that mostly have separate tables to store account/storage/contract data. #[derive(Clone, Debug, Default)] pub struct StateChangeset { /// Vector of account presorted by address, with removed contracts bytecode pub accounts: Vec<(Address, Option)>, /// Vector of storage presorted by address - /// First bool is indicatior if storage needs to be dropped. + /// First bool is indicator if storage needs to be dropped. pub storage: StorageChangeset, /// Vector of contracts presorted by bytecode hash pub contracts: Vec<(B256, Bytecode)>, @@ -19,7 +19,7 @@ pub type StorageChangeset = Vec<(Address, (bool, Vec<(U256, U256)>))>; #[derive(Clone, Debug, Default)] pub struct StateReverts { - /// Vector of account presorted by anddress, with removed cotracts bytecode + /// Vector of account presorted by address, with removed contracts bytecode /// /// Note: AccountInfo None means that account needs to be removed. pub accounts: Vec)>>, diff --git a/crates/revm/src/db/states/state.rs b/crates/revm/src/db/states/state.rs index b6607eede1..5c5c2e443b 100644 --- a/crates/revm/src/db/states/state.rs +++ b/crates/revm/src/db/states/state.rs @@ -12,9 +12,9 @@ use revm_interpreter::primitives::{ /// State clear flag is set inside CacheState and by default it is enabled. /// If you want to disable it use `set_state_clear_flag` function. pub struct State<'a, DBError> { - /// Cached state contains both changed from evm executiong and cached/loaded account/storages + /// Cached state contains both changed from evm execution and cached/loaded account/storages /// from database. This allows us to have only one layer of cache where we can fetch data. - /// Additionaly we can introuduce some preloading of data from database. + /// Additionaly we can introduce some preloading of data from database. pub cache: CacheState, /// Optional database that we use to fetch data from. If database is not present, we will /// return not existing account and storage. @@ -194,8 +194,8 @@ impl<'a, DBError> Database for State<'a, DBError> { .map(|account| match account.storage.entry(index) { hash_map::Entry::Occupied(entry) => Ok(*entry.get()), hash_map::Entry::Vacant(entry) => { - // if account was destroyed or account is newely build - // we return zero and dont ask detabase. + // if account was destroyed or account is newly built + // we return zero and don't ask database. let value = if is_storage_known { U256::ZERO } else { diff --git a/crates/revm/src/db/states/state_builder.rs b/crates/revm/src/db/states/state_builder.rs index f562bea1b0..6977a34db4 100644 --- a/crates/revm/src/db/states/state_builder.rs +++ b/crates/revm/src/db/states/state_builder.rs @@ -81,9 +81,9 @@ impl<'a, DBError> StateBuilder<'a, DBError> { } } - /// Dont make transitions and dont update bundle state. + /// Don't make transitions and don't update bundle state. /// - /// This is good option if we dont care about creating reverts + /// This is good option if we don't care about creating reverts /// or getting output of changed states. pub fn without_bundle_update(self) -> Self { Self { diff --git a/crates/revm/src/db/states/transition_account.rs b/crates/revm/src/db/states/transition_account.rs index 19c02ac86e..7c4232552f 100644 --- a/crates/revm/src/db/states/transition_account.rs +++ b/crates/revm/src/db/states/transition_account.rs @@ -11,19 +11,19 @@ use revm_interpreter::primitives::{hash_map, AccountInfo, Bytecode, B256}; pub struct TransitionAccount { pub info: Option, pub status: AccountStatus, - /// Previous account info is needed for account that got initialy loaded. - /// Initialy loaded account are not present inside bundle and are needed + /// Previous account info is needed for account that got initially loaded. + /// Initially loaded account are not present inside bundle and are needed /// to generate Reverts. pub previous_info: Option, /// Mostly needed when previous status Loaded/LoadedEmpty. pub previous_status: AccountStatus, /// Storage contains both old and new account pub storage: StorageWithOriginalValues, - /// If there is transition that clears the storage we shold mark it here and + /// If there is transition that clears the storage we should mark it here and /// delete all storages in BundleState. This flag is needed if we have transition /// between Destroyed states from DestroyedChanged-> DestroyedAgain-> DestroyedChanged /// in the end transition that we would have would be `DestroyedChanged->DestroyedChanged` - /// and with only that info we coudn't decide what to do. + /// and with only that info we couldn't decide what to do. pub storage_was_destroyed: bool, } @@ -53,7 +53,7 @@ impl TransitionAccount { None } - /// Update new values of transition. Dont override old values + /// Update new values of transition. Don't override old values /// both account info and old storages need to be left intact. pub fn update(&mut self, other: Self) { self.info = other.info.clone(); diff --git a/crates/revm/src/evm.rs b/crates/revm/src/evm.rs index c8be62c91f..e79be33476 100644 --- a/crates/revm/src/evm.rs +++ b/crates/revm/src/evm.rs @@ -21,7 +21,7 @@ use revm_precompile::Precompiles; /// handling of struct you want. /// * Database trait has mutable self in its functions. It is usefully if on get calls you want to modify /// your cache or update some statistics. They enable `transact` and `inspect` functions -/// * DatabaseRef takes reference on object, this is useful if you only have reference on state and dont +/// * DatabaseRef takes reference on object, this is useful if you only have reference on state and don't /// want to update anything on it. It enabled `transact_ref` and `inspect_ref` functions /// * Database+DatabaseCommit allow directly committing changes of transaction. it enabled `transact_commit` /// and `inspect_commit` diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index d9989fadaa..7d1b9106b0 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -100,7 +100,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> Transact let initial_gas_spend = initial_tx_gas::(&tx_data, tx_is_create, &env.tx.access_list); - // Additonal check to see if limit is big enought to cover initial gas. + // Additional check to see if limit is big enough to cover initial gas. if env.tx.gas_limit < initial_gas_spend { return Err(InvalidTransaction::CallGasCostMoreThanGasLimit.into()); } @@ -121,7 +121,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> Transact .load_account(tx_caller, self.data.db) .map_err(EVMError::Database)?; - self.data.env.validate_tx_agains_state(caller_account)?; + self.data.env.validate_tx_against_state(caller_account)?; // Reduce gas_limit*gas_price amount of caller account. // unwrap_or can only occur if disable_balance_check is enabled diff --git a/crates/revm/src/inspector/noop.rs b/crates/revm/src/inspector/noop.rs index 41b3062b01..63a6014eb1 100644 --- a/crates/revm/src/inspector/noop.rs +++ b/crates/revm/src/inspector/noop.rs @@ -1,4 +1,4 @@ -//! Dummy NoOp Inspector, helpful as standalone replacemnt. +//! Dummy NoOp Inspector, helpful as standalone replacement. use crate::{Database, Inspector}; diff --git a/crates/revm/src/journaled_state.rs b/crates/revm/src/journaled_state.rs index b556e97b99..71e96645c6 100644 --- a/crates/revm/src/journaled_state.rs +++ b/crates/revm/src/journaled_state.rs @@ -23,7 +23,7 @@ pub struct JournaledState { /// so we need to take care of that difference. Set this to false if you are handling /// legacy transactions pub is_before_spurious_dragon: bool, - /// It is assumed that precompiles start from 0x1 address and spand next N addresses. + /// It is assumed that precompiles start from 0x1 address and span next N addresses. /// we are using that assumption here pub num_of_precompiles: usize, } @@ -100,7 +100,7 @@ impl JournaledState { /// Create new JournaledState. /// /// num_of_precompiles is used to determine how many precompiles are there. - /// Assumption is that number of N first addresses are precompiles (exclusing 0x00..00) + /// Assumption is that number of N first addresses are precompiles (excluding 0x00..00) /// /// Note: This function will journal state after Spurious Dragon fork. /// And will not take into account if account is not existing or empty. @@ -131,7 +131,7 @@ impl JournaledState { } /// Mark account as touched as only touched accounts will be added to state. - /// This is expecially important for state clear where touched empty accounts needs to + /// This is especially important for state clear where touched empty accounts needs to /// be removed from state. pub fn touch(&mut self, address: &Address) { if let Some(account) = self.state.get_mut(address) { @@ -226,7 +226,7 @@ impl JournaledState { *to_balance = to_balance .checked_add(balance) .ok_or(InstructionResult::OverflowPayment)?; - // Overflow of U256 balance is not possible to happen on mainnet. We dont bother to return funds from from_acc. + // Overflow of U256 balance is not possible to happen on mainnet. We don't bother to return funds from from_acc. self.journal .last_mut() @@ -244,8 +244,8 @@ impl JournaledState { /// /// There are few steps done: /// 1. Make created account hot loaded (AccessList) and this should - /// be done before subrouting checkpoint is created. - /// 2. Check if there is colission of newly created account with existing one. + /// be done before subroutine checkpoint is created. + /// 2. Check if there is collision of newly created account with existing one. /// 3. Mark created account as created. /// 4. Add fund to created account /// 5. Increment nonce of created account if SpuriousDragon is active @@ -307,10 +307,10 @@ impl JournaledState { // Sub balance from caller let caller_account = self.state.get_mut(&caller).unwrap(); - // Balance is already checked in `create_inner`, so it is safe to just substract. + // Balance is already checked in `create_inner`, so it is safe to just subtract. caller_account.info.balance -= balance; - // add journal entry of transfered balance + // add journal entry of transferred balance last_journal.push(JournalEntry::BalanceTransfer { from: caller, to: address, @@ -385,7 +385,7 @@ impl JournaledState { } } JournalEntry::BalanceTransfer { from, to, balance } => { - // we dont need to check overflow and underflow when adding sub subtracting the balance. + // we don't need to check overflow and underflow when adding sub subtracting the balance. let from = state.get_mut(&from).unwrap(); from.info.balance += balance; let to = state.get_mut(&to).unwrap(); @@ -631,13 +631,13 @@ impl JournaledState { key: U256, db: &mut DB, ) -> Result<(U256, bool), DB::Error> { - let account = self.state.get_mut(&address).unwrap(); // asume acc is hot + let account = self.state.get_mut(&address).unwrap(); // assume acc is hot // only if account is created in this tx we can assume that storage is empty. let is_newly_created = account.is_created(); let load = match account.storage.entry(key) { Entry::Occupied(occ) => (occ.get().present_value, false), Entry::Vacant(vac) => { - // if storage was cleared, we dont need to ping db. + // if storage was cleared, we don't need to ping db. let value = if is_newly_created { U256::ZERO } else { @@ -677,7 +677,7 @@ impl JournaledState { // if there is no original value in dirty return present value, that is our original. let slot = acc.storage.get_mut(&key).unwrap(); - // new value is same as present, we dont need to do anything + // new value is same as present, we don't need to do anything if present == new { return Ok((slot.previous_or_original_value, present, new, is_cold)); } diff --git a/examples/fork_ref_transact.rs b/examples/fork_ref_transact.rs index 7ef4174897..8575932bf6 100644 --- a/examples/fork_ref_transact.rs +++ b/examples/fork_ref_transact.rs @@ -70,7 +70,7 @@ async fn main() -> anyhow::Result<()> { // insert pre-built database from above evm.database(cache_db); - // fill in missing bits of env struc + // fill in missing bits of env struct // change that to whatever caller you want to be evm.env.tx.caller = address!("0000000000000000000000000000000000000000"); // account you want to transact with