Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(l1, levm): solve hive regression #1868

Merged
merged 34 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f619f2c
first approach gixing regression
tomip01 Jan 27, 2025
49e730e
first approach to the cache/db retrieve info
tomip01 Jan 28, 2025
bdd4024
add feature flag block to not affect other vms
tomip01 Jan 29, 2025
8e0203a
first approach fix beacon call
tomip01 Jan 29, 2025
0cdd157
make the test pass, missing storage update
tomip01 Jan 30, 2025
d804a85
refactor code
tomip01 Jan 30, 2025
1e3c6e0
remove comments
tomip01 Jan 30, 2025
13f2415
remove comment
tomip01 Jan 30, 2025
8afd72f
refactor imports
tomip01 Jan 30, 2025
58f5edd
remove unused function
tomip01 Jan 30, 2025
ec30dfc
Merge branch 'main' into fix/l1/hive-regression
tomip01 Jan 30, 2025
435508a
change spec_id to fork
tomip01 Jan 30, 2025
6ad6a0b
add import fot not levm
tomip01 Jan 30, 2025
b3da929
check for forks greater or equal than cancun
tomip01 Jan 30, 2025
dbbbce9
remove warning
tomip01 Jan 30, 2025
f93caaf
Merge branch 'main' into fix/l1/hive-regression
tomip01 Jan 30, 2025
a9f2552
merge with main changes
tomip01 Jan 30, 2025
fcfe3fb
Update crates/blockchain/payload.rs
tomip01 Jan 30, 2025
f841ce2
Update crates/blockchain/payload.rs
tomip01 Jan 30, 2025
f34f41e
Revert "Update crates/blockchain/payload.rs"
tomip01 Jan 30, 2025
e9e2fc0
join imports
tomip01 Jan 30, 2025
7cef0db
remove comment
tomip01 Jan 30, 2025
0029844
add block cache to context
tomip01 Jan 30, 2025
306fc1e
fix not levm returns
tomip01 Jan 30, 2025
81028a9
remove issue comment
tomip01 Jan 31, 2025
09f8403
clarify empty hashmap with comment
tomip01 Jan 31, 2025
cd2b2fd
first approach
tomip01 Feb 3, 2025
b184101
remove comments
tomip01 Feb 3, 2025
46f40ca
move assertion to vm
tomip01 Feb 3, 2025
5c8dd0b
refactor
tomip01 Feb 3, 2025
82ade80
remove comments
tomip01 Feb 3, 2025
b582dcd
Merge branch 'main' into fix/l1/revm-levm-hive-diff
tomip01 Feb 3, 2025
60a1962
change to u64
tomip01 Feb 3, 2025
a1b41d5
remove let
tomip01 Feb 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/ef_tests/levm/runner/levm_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ pub fn prepare_vm_for_tx(vector: &TestVector, test: &EFTest) -> Result<VM, EFTes
tx_max_priority_fee_per_gas: tx.max_priority_fee_per_gas,
tx_max_fee_per_gas: tx.max_fee_per_gas,
tx_max_fee_per_blob_gas: tx.max_fee_per_blob_gas,
tx_nonce: tx.nonce.try_into().map_err(|_| {
EFTestRunnerError::VMInitializationFailed("Nonce to large".to_string())
})?,
block_gas_limit: test.env.current_gas_limit,
transient_storage: HashMap::new(),
},
Expand Down
1 change: 1 addition & 0 deletions crates/vm/levm/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub struct Environment {
pub tx_max_priority_fee_per_gas: Option<U256>,
pub tx_max_fee_per_gas: Option<U256>,
pub tx_max_fee_per_blob_gas: Option<U256>,
pub tx_nonce: u64,
pub block_gas_limit: u64,
pub transient_storage: TransientStorage,
}
Expand Down
2 changes: 2 additions & 0 deletions crates/vm/levm/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ pub enum TxValidationError {
InsufficientAccountFunds,
#[error("Nonce is max (overflow)")]
NonceIsMax,
#[error("Nonce mismatch")]
NonceMismatch,
#[error("Initcode size exceeded")]
InitcodeSizeExceeded,
#[error("Priority fee greater than max fee per gas")]
Expand Down
5 changes: 5 additions & 0 deletions crates/vm/levm/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,11 @@ impl VM {
increment_account_nonce(&mut self.cache, &self.db, sender_address)
.map_err(|_| VMError::TxValidation(TxValidationError::NonceIsMax))?;

// check for nonce mismatch
if sender_account.info.nonce != self.env.tx_nonce {
return Err(VMError::TxValidation(TxValidationError::NonceMismatch));
}

// (8) PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS
if let (Some(tx_max_priority_fee), Some(tx_max_fee_per_gas)) = (
self.env.tx_max_priority_fee_per_gas,
Expand Down
6 changes: 4 additions & 2 deletions crates/vm/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ cfg_if::cfg_if! {
tx_max_priority_fee_per_gas: tx.max_priority_fee().map(U256::from),
tx_max_fee_per_gas: tx.max_fee_per_gas().map(U256::from),
tx_max_fee_per_blob_gas: tx.max_fee_per_blob_gas().map(U256::from),
tx_nonce: tx.nonce(),
block_gas_limit: block_header.gas_limit,
transient_storage: HashMap::new(),
};
Expand Down Expand Up @@ -446,7 +447,7 @@ fn run_evm(
}
}

match state {
let exec_result = match state {
EvmState::Store(db) => {
let mut evm = evm_builder.with_db(db).build();
evm.transact_commit().map_err(EvmError::from)?
Expand All @@ -455,7 +456,8 @@ fn run_evm(
let mut evm = evm_builder.with_db(db).build();
evm.transact_commit().map_err(EvmError::from)?
}
}
};
exec_result
};
Ok(tx_result.into())
}
Expand Down
Loading