Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions crates/interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ dev = [
"optional_gas_refund",
"optional_no_base_fee",
"optional_beneficiary_reward",
"optional_nonce_check",
]
memory_limit = ["revm-primitives/memory_limit"]
optional_balance_check = ["revm-primitives/optional_balance_check"]
Expand All @@ -57,4 +56,3 @@ optional_eip3607 = ["revm-primitives/optional_eip3607"]
optional_gas_refund = ["revm-primitives/optional_gas_refund"]
optional_no_base_fee = ["revm-primitives/optional_no_base_fee"]
optional_beneficiary_reward = ["revm-primitives/optional_beneficiary_reward"]
optional_nonce_check = ["revm-primitives/optional_nonce_check"]
4 changes: 2 additions & 2 deletions crates/precompile/src/modexp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ mod tests {
let expected = hex::decode(test.expected).unwrap();
assert_eq!(
res.0, test_gas,
"used gas not maching for test: {}",
"used gas not matching for test: {}",
test.name
);
assert_eq!(res.1, expected, "test:{}", test.name);
Expand All @@ -361,7 +361,7 @@ mod tests {
let expected = hex::decode(test.expected).unwrap();
assert_eq!(
res.0, test_gas,
"used gas not maching for test: {}",
"used gas not matching for test: {}",
test.name
);
assert_eq!(res.1, expected, "test:{}", test.name);
Expand Down
2 changes: 0 additions & 2 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ dev = [
"optional_gas_refund",
"optional_no_base_fee",
"optional_beneficiary_reward",
"optional_nonce_check",
]
memory_limit = []
optional_balance_check = []
Expand All @@ -88,7 +87,6 @@ optional_eip3607 = []
optional_gas_refund = []
optional_no_base_fee = []
optional_beneficiary_reward = []
optional_nonce_check = []

# See comments in `revm-precompile`
c-kzg = ["dep:c-kzg", "dep:once_cell", "dep:derive_more"]
35 changes: 9 additions & 26 deletions crates/primitives/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,16 @@ impl Env {
}

// Check that the transaction's nonce is correct
if !self.cfg.is_nonce_check_disabled() {
if let Some(tx) = self.tx.nonce {
let state = account.info.nonce;
match tx.cmp(&state) {
Ordering::Greater => {
return Err(InvalidTransaction::NonceTooHigh { tx, state });
}
Ordering::Less => {
return Err(InvalidTransaction::NonceTooLow { tx, state });
}
_ => {}
if let Some(tx) = self.tx.nonce {
let state = account.info.nonce;
match tx.cmp(&state) {
Ordering::Greater => {
return Err(InvalidTransaction::NonceTooHigh { tx, state });
}
Ordering::Less => {
return Err(InvalidTransaction::NonceTooLow { tx, state });
}
_ => {}
}
}

Expand Down Expand Up @@ -301,9 +299,6 @@ pub struct CfgEnv {
/// By default, it is set to `false`.
#[cfg(feature = "optional_beneficiary_reward")]
pub disable_beneficiary_reward: bool,
/// Skip nonce checks if true.
#[cfg(feature = "optional_nonce_check")]
pub disable_nonce_check: bool,
}

impl CfgEnv {
Expand Down Expand Up @@ -366,16 +361,6 @@ impl CfgEnv {
pub fn is_beneficiary_reward_disabled(&self) -> bool {
false
}

#[cfg(feature = "optional_nonce_check")]
pub fn is_nonce_check_disabled(&self) -> bool {
self.disable_nonce_check
}

#[cfg(not(feature = "optional_nonce_check"))]
pub fn is_nonce_check_disabled(&self) -> bool {
false
}
}

impl Default for CfgEnv {
Expand All @@ -400,8 +385,6 @@ impl Default for CfgEnv {
disable_base_fee: false,
#[cfg(feature = "optional_beneficiary_reward")]
disable_beneficiary_reward: false,
#[cfg(feature = "optional_nonce_check")]
disable_nonce_check: false,
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions crates/revm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ dev = [
"optional_gas_refund",
"optional_no_base_fee",
"optional_beneficiary_reward",
"optional_nonce_check",
]
memory_limit = ["revm-interpreter/memory_limit"]
optional_balance_check = ["revm-interpreter/optional_balance_check"]
Expand All @@ -99,7 +98,6 @@ optional_eip3607 = ["revm-interpreter/optional_eip3607"]
optional_gas_refund = ["revm-interpreter/optional_gas_refund"]
optional_no_base_fee = ["revm-interpreter/optional_no_base_fee"]
optional_beneficiary_reward = ["revm-interpreter/optional_beneficiary_reward"]
optional_nonce_check = ["revm-interpreter/optional_nonce_check"]

# See comments in `revm-precompile`
secp256k1 = ["revm-precompile/secp256k1"]
Expand Down