Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Commit

Permalink
fix: missing EIP-2681 for nonce upper bound
Browse files Browse the repository at this point in the history
  • Loading branch information
vimpunk committed May 15, 2023
1 parent 85a84c2 commit fd5c445
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions jsontests/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
use crate::utils::*;
use ethjson::spec::ForkSpec;
use evm::backend::{ApplyBackend, MemoryAccount, MemoryBackend, MemoryVicinity};
use evm::executor::stack::{
MemoryStackState, PrecompileFailure, PrecompileFn, PrecompileOutput, StackExecutor,
StackSubstateMetadata,
};
use evm::{
backend::{ApplyBackend, MemoryAccount, MemoryBackend, MemoryVicinity},
executor::stack::StackState,
};
use evm::{Config, Context, ExitError, ExitSucceed};
use lazy_static::lazy_static;
use libsecp256k1::SecretKey;
Expand Down Expand Up @@ -79,9 +82,7 @@ impl Test {
// (0x44), and so for older forks of Ethereum, the threshold value of 2^64 is used to
// distinguish between the two: if it's below, the value corresponds to the DIFFICULTY
// opcode, otherwise to the PREVRANDAO opcode.
let mut buf = [0u8; 32];
r.0.to_big_endian(&mut buf);
H256(buf)
u256_to_h256(r.0)
})
} else {
None
Expand Down
4 changes: 2 additions & 2 deletions jsontests/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn u256_to_h256(u: U256) -> H256 {
pub fn unwrap_to_account(s: &ethjson::spec::Account) -> MemoryAccount {
MemoryAccount {
balance: s.balance.clone().unwrap().into(),
nonce: s.nonce.clone().unwrap().into(),
nonce: s.nonce.unwrap().0.as_u64(),
code: s.code.clone().unwrap().into(),
storage: s
.storage
Expand Down Expand Up @@ -48,7 +48,7 @@ pub fn unwrap_to_state(a: &ethjson::spec::State) -> BTreeMap<H160, MemoryAccount
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TrieAccount {
/// Nonce of the account.
pub nonce: U256,
pub nonce: u64,
/// Balance of the account.
pub balance: U256,
/// Storage root of the account.
Expand Down

0 comments on commit fd5c445

Please sign in to comment.