Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

fix: Alloy Eips BlockNumHash #38

Closed
wants to merge 2 commits into from
Closed
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
61 changes: 30 additions & 31 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -21,7 +21,6 @@ anyhow.workspace = true
# `serde` feature dependencies
serde = { workspace = true, optional = true }
serde_repr = { workspace = true, optional = true }
alloy-serde = { workspace = true, optional = true }

# `arbitrary` feature dependencies
arbitrary = { workspace = true, optional = true }
@@ -36,4 +35,4 @@ alloy-primitives = { workspace = true, features = ["arbitrary"] }
default = ["std", "serde"]
std = []
arbitrary = ["std", "dep:arbitrary", "alloy-primitives/arbitrary"]
serde = ["dep:serde", "dep:alloy-serde", "dep:serde_repr", "alloy-eips/serde", "alloy-consensus/serde", "alloy-primitives/serde"]
serde = ["dep:serde", "dep:serde_repr", "alloy-eips/serde", "alloy-consensus/serde", "alloy-primitives/serde"]
71 changes: 0 additions & 71 deletions crates/primitives/src/block.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/primitives/src/chain_config.rs
Original file line number Diff line number Diff line change
@@ -41,7 +41,6 @@ pub struct HardForkConfiguration {
/// A chain configuration.
#[derive(Debug, Clone, Default, Hash, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
pub struct ChainConfig {
/// Chain name (e.g. "Base")
#[cfg_attr(feature = "serde", serde(rename = "Name"))]
11 changes: 5 additions & 6 deletions crates/primitives/src/genesis.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
//! Genesis types.

use crate::BlockID;
use crate::SystemConfig;
use alloy_eips::eip1898::BlockNumHash;

/// Chain genesis information.
#[derive(Debug, Clone, Default, Hash, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
pub struct ChainGenesis {
/// L1 genesis block
pub l1: BlockID,
pub l1: BlockNumHash,
/// L2 genesis block
pub l2: BlockID,
pub l2: BlockNumHash,
/// Timestamp of the L2 genesis block
pub l2_time: u64,
/// Optional System configuration
@@ -25,11 +24,11 @@ mod tests {

fn ref_genesis() -> ChainGenesis {
ChainGenesis {
l1: BlockID {
l1: BlockNumHash {
hash: b256!("438335a20d98863a4c0c97999eb2481921ccd28553eac6f913af7c12aec04108"),
number: 17422590,
},
l2: BlockID {
l2: BlockNumHash {
hash: b256!("dbf6a80fef073de06add9b0d14026d6e5a86c85f6d102c36d3d8e9cf89c2afd3"),
number: 105235063,
},
8 changes: 4 additions & 4 deletions crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
@@ -12,9 +12,12 @@

extern crate alloc;

/// Re-export the Genesis type from [alloy_genesis].
/// Re-export the [Genesis] type from [alloy_genesis].
pub use alloy_genesis::Genesis;

/// Re-export the [BlockNumHash] type from [alloy_eips].
pub use alloy_eips::eip1898::BlockNumHash;

pub mod superchain;
pub use superchain::{Superchain, SuperchainConfig, SuperchainL1Info, SuperchainLevel};

@@ -48,9 +51,6 @@ pub use chain_config::{AltDAConfig, ChainConfig, HardForkConfiguration};
pub mod genesis;
pub use genesis::ChainGenesis;

pub mod block;
pub use block::BlockID;

pub mod system_config;
pub use system_config::SystemConfig;

22 changes: 11 additions & 11 deletions crates/primitives/src/rollup_config.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! Rollup Config Types
use alloy_eips::eip1559::BaseFeeParams;
use alloy_eips::eip1898::BlockNumHash;
use alloy_primitives::{address, b256, uint, Address};
use anyhow::{anyhow, Result};

use crate::block::BlockID;
use crate::chain_config::ChainConfig;
use crate::fee_params::{
base_fee_params, canyon_base_fee_params, BASE_SEPOLIA_BASE_FEE_PARAMS,
@@ -334,11 +334,11 @@ impl RollupConfig {
/// The [RollupConfig] for OP Mainnet.
pub const OP_MAINNET_CONFIG: RollupConfig = RollupConfig {
genesis: ChainGenesis {
l1: BlockID {
l1: BlockNumHash {
hash: b256!("438335a20d98863a4c0c97999eb2481921ccd28553eac6f913af7c12aec04108"),
number: 17_422_590_u64,
},
l2: BlockID {
l2: BlockNumHash {
hash: b256!("dbf6a80fef073de06add9b0d14026d6e5a86c85f6d102c36d3d8e9cf89c2afd3"),
number: 105_235_063_u64,
},
@@ -380,11 +380,11 @@ pub const OP_MAINNET_CONFIG: RollupConfig = RollupConfig {
/// The [RollupConfig] for OP Sepolia.
pub const OP_SEPOLIA_CONFIG: RollupConfig = RollupConfig {
genesis: ChainGenesis {
l1: BlockID {
l1: BlockNumHash {
hash: b256!("48f520cf4ddaf34c8336e6e490632ea3cf1e5e93b0b2bc6e917557e31845371b"),
number: 4071408,
},
l2: BlockID {
l2: BlockNumHash {
hash: b256!("102de6ffb001480cc9b8b548fd05c34cd4f46ae4aa91759393db90ea0409887d"),
number: 0,
},
@@ -426,11 +426,11 @@ pub const OP_SEPOLIA_CONFIG: RollupConfig = RollupConfig {
/// The [RollupConfig] for Base Mainnet.
pub const BASE_MAINNET_CONFIG: RollupConfig = RollupConfig {
genesis: ChainGenesis {
l1: BlockID {
l1: BlockNumHash {
hash: b256!("5c13d307623a926cd31415036c8b7fa14572f9dac64528e857a470511fc30771"),
number: 17_481_768_u64,
},
l2: BlockID {
l2: BlockNumHash {
hash: b256!("f712aa9241cc24369b143cf6dce85f0902a9731e70d66818a3a5845b296c73dd"),
number: 0_u64,
},
@@ -472,11 +472,11 @@ pub const BASE_MAINNET_CONFIG: RollupConfig = RollupConfig {
/// The [RollupConfig] for Base Sepolia.
pub const BASE_SEPOLIA_CONFIG: RollupConfig = RollupConfig {
genesis: ChainGenesis {
l1: BlockID {
l1: BlockNumHash {
hash: b256!("cac9a83291d4dec146d6f7f69ab2304f23f5be87b1789119a0c5b1e4482444ed"),
number: 4370868,
},
l2: BlockID {
l2: BlockNumHash {
hash: b256!("0dcc9e089e30b90ddfc55be9a37dd15bc551aeee999d2e2b51414c54eaf934e4"),
number: 0,
},
@@ -664,11 +664,11 @@ mod tests {
assert_eq!(
config.genesis,
ChainGenesis {
l1: BlockID {
l1: BlockNumHash {
hash: b256!("481724ee99b1f4cb71d826e2ec5a37265f460e9b112315665c977f4050b0af54"),
number: 10
},
l2: BlockID {
l2: BlockNumHash {
hash: b256!("88aedfbf7dea6bfa2c4ff315784ad1a7f145d8f650969359c003bbed68c87631"),
number: 0
},
1 change: 0 additions & 1 deletion crates/primitives/src/superchain.rs
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ use crate::HardForkConfiguration;
/// A superchain configuration.
#[derive(Debug, Clone, Default, Hash, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
pub struct Superchain {
/// Superchain identifier, without capitalization or display changes.
pub name: String,
7 changes: 4 additions & 3 deletions crates/registry/src/superchain.rs
Original file line number Diff line number Diff line change
@@ -73,7 +73,8 @@ mod tests {
use super::*;
use alloy_primitives::{address, b256, uint};
use superchain_primitives::{
AddressList, BlockID, ChainGenesis, HardForkConfiguration, SuperchainLevel, SystemConfig,
AddressList, BlockNumHash, ChainGenesis, HardForkConfiguration, SuperchainLevel,
SystemConfig,
};

#[test]
@@ -91,11 +92,11 @@ mod tests {
superchain_level: SuperchainLevel::Frontier,
batch_inbox_addr: address!("ff00000000000000000000000000000000008453"),
genesis: ChainGenesis {
l1: BlockID {
l1: BlockNumHash {
number: 17481768,
hash: b256!("5c13d307623a926cd31415036c8b7fa14572f9dac64528e857a470511fc30771"),
},
l2: BlockID {
l2: BlockNumHash {
number: 0,
hash: b256!("f712aa9241cc24369b143cf6dce85f0902a9731e70d66818a3a5845b296c73dd"),
},