mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
test: add hardfork parsing test (#10724)
This commit is contained in:
@ -52,6 +52,7 @@ impl ChainSpecParser for EthChainSpecParser {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
|
||||
#[test]
|
||||
fn parse_known_chain_spec() {
|
||||
@ -59,4 +60,57 @@ mod tests {
|
||||
assert!(<EthChainSpecParser as ChainSpecParser>::parse(chain).is_ok());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_raw_chainspec_hardforks() {
|
||||
let s = r#"{
|
||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"coinbase": "0x0000000000000000000000000000000000000000",
|
||||
"stateRoot": "0x76f118cb05a8bc558388df9e3b4ad66ae1f17ef656e5308cb8f600717251b509",
|
||||
"transactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"receiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"bloom": "0x000...000",
|
||||
"difficulty": "0x00",
|
||||
"number": "0x00",
|
||||
"gasLimit": "0x016345785d8a0000",
|
||||
"gasUsed": "0x00",
|
||||
"timestamp": "0x01",
|
||||
"extraData": "0x00",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"nonce": "0x0000000000000000",
|
||||
"baseFeePerGas": "0x07",
|
||||
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"blobGasUsed": "0x00",
|
||||
"excessBlobGas": "0x00",
|
||||
"parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"requestsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"hash": "0xc20e1a771553139cdc77e6c3d5f64a7165d972d327eee9632c9c7d0fe839ded4",
|
||||
"alloc": {},
|
||||
"config": {
|
||||
"ethash": {},
|
||||
"chainId": 1,
|
||||
"homesteadBlock": 0,
|
||||
"daoForkSupport": true,
|
||||
"eip150Block": 0,
|
||||
"eip155Block": 0,
|
||||
"eip158Block": 0,
|
||||
"byzantiumBlock": 0,
|
||||
"constantinopleBlock": 0,
|
||||
"petersburgBlock": 0,
|
||||
"istanbulBlock": 0,
|
||||
"berlinBlock": 0,
|
||||
"londonBlock": 0,
|
||||
"terminalTotalDifficulty": 0,
|
||||
"shanghaiTime": 0,
|
||||
"cancunTime": 0,
|
||||
"pragueTime": 0
|
||||
}
|
||||
}"#;
|
||||
|
||||
let spec = <EthChainSpecParser as ChainSpecParser>::parse(s).unwrap();
|
||||
assert!(spec.hardforks.is_shanghai_active_at_timestamp(0));
|
||||
assert!(spec.hardforks.is_cancun_active_at_timestamp(0));
|
||||
assert!(spec.hardforks.is_prague_active_at_timestamp(0));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user