Skip to content

Commit e023016

Browse files
authored
Support custom chain ids (#429)
1 parent 23098c4 commit e023016

6 files changed

Lines changed: 213 additions & 202 deletions

File tree

config.example.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# Some fields are optional and can be omitted, in which case the default value, if present, will be used.
33

44
# Chain spec ID. Supported values:
5-
# A network ID. Supported values: Mainnet, Holesky, Sepolia, Helder, Hoodi. Lower case values e.g. "mainnet" are also accepted
5+
# A network ID. Supported values: Mainnet, Holesky, Sepolia, Hoodi. Lower case values e.g. "mainnet" are also accepted
66
# A custom object, e.g., chain = { genesis_time_secs = 1695902400, path = "/path/to/spec.json" }, with a path to a chain spec file, either in .json format (e.g., as returned by the beacon endpoint /eth/v1/config/spec), or in .yml format (see examples in tests/data).
7-
# A custom object, e.g., chain = { genesis_time_secs = 1695902400, slot_time_secs = 12, genesis_fork_version = "0x01017000" }.
7+
# A custom object, e.g., chain = { genesis_time_secs = 1695902400, slot_time_secs = 12, genesis_fork_version = "0x01017000", chain_id = 17000 }.
88
chain = "Holesky"
99

1010
# Configuration for the PBS module

crates/common/src/config/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl CommitBoostConfig {
6868
let chain = match helper_config.chain {
6969
ChainLoader::Path { path, genesis_time_secs } => {
7070
// check if the file path is overridden by env var
71-
let (slot_time_secs, genesis_fork_version, fulu_fork_slot) =
71+
let (slot_time_secs, genesis_fork_version, fulu_fork_slot, chain_id) =
7272
if let Some(path) = load_optional_env_var(CHAIN_SPEC_ENV) {
7373
load_chain_from_file(path.parse()?)?
7474
} else {
@@ -79,6 +79,7 @@ impl CommitBoostConfig {
7979
slot_time_secs,
8080
genesis_fork_version,
8181
fulu_fork_slot,
82+
chain_id,
8283
}
8384
}
8485
ChainLoader::Known(known) => Chain::from(known),
@@ -87,13 +88,15 @@ impl CommitBoostConfig {
8788
slot_time_secs,
8889
genesis_fork_version,
8990
fulu_fork_slot,
91+
chain_id,
9092
} => {
9193
let genesis_fork_version: ForkVersion = genesis_fork_version.as_ref().try_into()?;
9294
Chain::Custom {
9395
genesis_time_secs,
9496
slot_time_secs,
9597
genesis_fork_version,
9698
fulu_fork_slot,
99+
chain_id,
97100
}
98101
}
99102
};

crates/common/src/signature.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ mod tests {
106106
compute_domain(Chain::Sepolia, APPLICATION_BUILDER_DOMAIN),
107107
Chain::Sepolia.builder_domain()
108108
);
109-
assert_eq!(
110-
compute_domain(Chain::Helder, APPLICATION_BUILDER_DOMAIN),
111-
Chain::Helder.builder_domain()
112-
);
113109
assert_eq!(
114110
compute_domain(Chain::Hoodi, APPLICATION_BUILDER_DOMAIN),
115111
Chain::Hoodi.builder_domain()

0 commit comments

Comments
 (0)