From 4a66053983ff1c5d68252e3c025a352a6d804b75 Mon Sep 17 00:00:00 2001 From: mandreyel Date: Mon, 15 May 2023 09:57:07 +0400 Subject: [PATCH] fix: missing EIP-2681 for nonce upper bound --- jsontests/src/state.rs | 4 +--- jsontests/src/utils.rs | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/jsontests/src/state.rs b/jsontests/src/state.rs index 621b93b..9c9ed59 100644 --- a/jsontests/src/state.rs +++ b/jsontests/src/state.rs @@ -79,9 +79,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 diff --git a/jsontests/src/utils.rs b/jsontests/src/utils.rs index 60bbd39..828eaec 100644 --- a/jsontests/src/utils.rs +++ b/jsontests/src/utils.rs @@ -12,7 +12,7 @@ pub fn u256_to_h256(u: U256) -> H256 { pub fn unwrap_to_account(s: ðjson::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 @@ -48,7 +48,7 @@ pub fn unwrap_to_state(a: ðjson::spec::State) -> BTreeMap