Skip to content

Commit

Permalink
Update evm
Browse files Browse the repository at this point in the history
  • Loading branch information
bkolad committed Oct 9, 2023
1 parent 32a5cfb commit cf399a2
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 55 deletions.
56 changes: 56 additions & 0 deletions module-system/module-implementations/sov-evm/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,59 @@ impl<C: sov_modules_api::Context> Evm<C> {
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)
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
mod call_tests;
mod cfg_tests;
mod config_tests;
mod genesis_tests;
mod hooks_tests;
pub(crate) mod test_signer;
Expand Down

0 comments on commit cf399a2

Please sign in to comment.