Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: parse deposit contract in chain config #750

Merged
merged 1 commit into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions crates/genesis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ pub struct Genesis {
/// The genesis block number
#[serde(default, skip_serializing_if = "Option::is_none", with = "u64_opt_via_ruint")]
pub number: Option<u64>,
/// The deposit contract address
#[serde(default, skip_serializing_if = "Option::is_none")]
pub deposit_contract_address: Option<Address>,
}

impl Genesis {
Expand Down Expand Up @@ -436,6 +433,10 @@ pub struct ChainConfig {
/// Additional fields specific to each chain.
#[serde(flatten, default)]
pub extra_fields: BTreeMap<String, serde_json::Value>,

/// The deposit contract address
#[serde(default, skip_serializing_if = "Option::is_none")]
pub deposit_contract_address: Option<Address>,
}

impl ChainConfig {
Expand Down Expand Up @@ -961,6 +962,7 @@ mod tests {
"cancunTime": 0,
"pragueTime": 1,
"terminalTotalDifficulty": 0,
"depositContractAddress": "0x0000000000000000000000000000000000000000",
"terminalTotalDifficultyPassed": true
},
"nonce": "0x0",
Expand All @@ -969,8 +971,7 @@ mod tests {
"gasLimit": "0x4c4b40",
"difficulty": "0x1",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"depositContractAddress": "0x0000000000000000000000000000000000000000"
"coinbase": "0x0000000000000000000000000000000000000000"
}
"#;

Expand Down Expand Up @@ -1001,14 +1002,14 @@ mod tests {
prague_time: Some(1),
terminal_total_difficulty: Some(U256::ZERO),
terminal_total_difficulty_passed: true,
deposit_contract_address: Some(Address::ZERO),
..Default::default()
},
nonce: 0,
timestamp: 0,
extra_data: Bytes::new(),
gas_limit: 0x4c4b40,
difficulty: U256::from(1),
deposit_contract_address: Some(Address::ZERO),
..Default::default()
};

Expand Down Expand Up @@ -1333,7 +1334,6 @@ mod tests {
excess_blob_gas: None,
blob_gas_used: None,
number: None,
deposit_contract_address: None,
alloc: BTreeMap::from_iter(vec![
(
Address::from_str("0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6").unwrap(),
Expand Down Expand Up @@ -1435,6 +1435,7 @@ mod tests {
constantinople_block: Some(0),
petersburg_block: Some(0),
istanbul_block: Some(0),
deposit_contract_address: None,
..Default::default()
},
};
Expand Down
Loading