diff --git a/module-system/module-implementations/sov-evm/src/genesis.rs b/module-system/module-implementations/sov-evm/src/genesis.rs index d64e116aa..f7c259370 100644 --- a/module-system/module-implementations/sov-evm/src/genesis.rs +++ b/module-system/module-implementations/sov-evm/src/genesis.rs @@ -176,3 +176,59 @@ impl Evm { Ok(()) } } + +#[cfg(test)] +mod tests { + use crate::{AccountData, EvmConfig}; + use reth_primitives::Bytes; + use revm::primitives::{Address, SpecId}; + use std::str::FromStr; + + #[test] + fn test_config_serialization() { + let address = Address::from_str("0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266").unwrap(); + let config = EvmConfig { + data: vec![AccountData { + address, + balance: AccountData::balance(u64::MAX), + code_hash: AccountData::empty_code(), + code: Bytes::default(), + nonce: 0, + }], + chain_id: 1, + limit_contract_code_size: None, + spec: vec![(0, SpecId::SHANGHAI)].into_iter().collect(), + block_timestamp_delta: 1u64, + ..Default::default() + }; + + let data = r#" + { + "data":[ + { + "address":"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + "balance":"0xffffffffffffffff", + "code_hash":"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "code":"0x", + "nonce":0 + }], + "chain_id":1, + "limit_contract_code_size":null, + "spec":{ + "0":"SHANGHAI" + }, + "coinbase":"0x0000000000000000000000000000000000000000", + "starting_base_fee":7, + "block_gas_limit":30000000, + "genesis_timestamp":0, + "block_timestamp_delta":1, + "base_fee_params":{ + "max_change_denominator":8, + "elasticity_multiplier":2 + } + }"#; + + let parsed_config: EvmConfig = serde_json::from_str(data).unwrap(); + assert_eq!(config, parsed_config) + } +} diff --git a/module-system/module-implementations/sov-evm/src/tests/config_tests.rs b/module-system/module-implementations/sov-evm/src/tests/config_tests.rs deleted file mode 100644 index 1d6fd9629..000000000 --- a/module-system/module-implementations/sov-evm/src/tests/config_tests.rs +++ /dev/null @@ -1,54 +0,0 @@ -use std::str::FromStr; - -use reth_primitives::{Address, Bytes}; -use revm::primitives::SpecId; - -use crate::{AccountData, EvmConfig}; - -#[test] -fn test_config_serialization() { - let address = Address::from_str("0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266").unwrap(); - let config = EvmConfig { - data: vec![AccountData { - address, - balance: AccountData::balance(u64::MAX), - code_hash: AccountData::empty_code(), - code: Bytes::default(), - nonce: 0, - }], - chain_id: 1, - limit_contract_code_size: None, - spec: vec![(0, SpecId::SHANGHAI)].into_iter().collect(), - block_timestamp_delta: 1u64, - ..Default::default() - }; - - let data = r#" - { - "data":[ - { - "address":"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", - "balance":"0xffffffffffffffff", - "code_hash":"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", - "code":"0x", - "nonce":0 - }], - "chain_id":1, - "limit_contract_code_size":null, - "spec":{ - "0":"SHANGHAI" - }, - "coinbase":"0x0000000000000000000000000000000000000000", - "starting_base_fee":7, - "block_gas_limit":30000000, - "genesis_timestamp":0, - "block_timestamp_delta":1, - "base_fee_params":{ - "max_change_denominator":8, - "elasticity_multiplier":2 - } - }"#; - - let parsed_config: EvmConfig = serde_json::from_str(data).unwrap(); - assert_eq!(config, parsed_config) -} diff --git a/module-system/module-implementations/sov-evm/src/tests/mod.rs b/module-system/module-implementations/sov-evm/src/tests/mod.rs index 155594fe3..4b4ef156d 100644 --- a/module-system/module-implementations/sov-evm/src/tests/mod.rs +++ b/module-system/module-implementations/sov-evm/src/tests/mod.rs @@ -1,6 +1,5 @@ mod call_tests; mod cfg_tests; -mod config_tests; mod genesis_tests; mod hooks_tests; pub(crate) mod test_signer;