Skip to content

Commit

Permalink
Merge pull request #12 from anton-rs/rf/feat/system-config-test
Browse files Browse the repository at this point in the history
feat(primitives): SystemConfig Tests
  • Loading branch information
refcell authored Sep 4, 2024
2 parents f3d8635 + 2e28877 commit d87e4e0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ arbitrary = { workspace = true, optional = true }
[dev-dependencies]
arbtest.workspace = true
arbitrary.workspace = true
serde_json.workspace = true
alloy-primitives = { workspace = true, features = ["arbitrary"] }

[features]
Expand Down
18 changes: 18 additions & 0 deletions crates/primitives/src/system_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,24 @@ mod test {
}
}

#[test]
fn test_system_config_serde() {
let sc_str = r#"{
"batcherAddr": "0x6887246668a3b87F54DeB3b94Ba47a6f63F32985",
"overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc",
"scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0",
"gasLimit": 30000000
}"#;
let system_config: SystemConfig = serde_json::from_str(sc_str).unwrap();
assert_eq!(
system_config.batcher_address,
address!("6887246668a3b87F54DeB3b94Ba47a6f63F32985")
);
assert_eq!(system_config.overhead, U256::from(0xbc));
assert_eq!(system_config.scalar, U256::from(0xa6fe0));
assert_eq!(system_config.gas_limit, 30000000);
}

#[test]
fn test_system_config_update_batcher_log() {
const UPDATE_TYPE: B256 =
Expand Down

0 comments on commit d87e4e0

Please sign in to comment.