Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ mod benchmarks {
capella: Fork { version: hex!("03000000"), epoch: 0 },
deneb: Fork { version: hex!("04000000"), epoch: 0 },
electra: Fork { version: hex!("05000000"), epoch: 80000000000 },
fulu: Fork { version: hex!("06000000"), epoch: 80000000001 },
};
let finalized_root_gindex = EthereumBeaconClient::<T>::finalized_root_gindex_at_slot(
update.attested_header.slot,
Expand Down
3 changes: 3 additions & 0 deletions bridges/snowbridge/pallets/ethereum-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,9 @@ pub mod pallet {

/// Returns the fork version based on the current epoch.
pub(super) fn select_fork_version(fork_versions: &ForkVersions, epoch: u64) -> ForkVersion {
if epoch >= fork_versions.fulu.epoch {
return fork_versions.fulu.version
}
if epoch >= fork_versions.electra.epoch {
return fork_versions.electra.version
}
Expand Down
4 changes: 4 additions & 0 deletions bridges/snowbridge/pallets/ethereum-client/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ parameter_types! {
electra: Fork {
version: hex!("05000000"),
epoch: 0,
},
fulu: Fork {
version: hex!("06000000"),
epoch: 100000000,
}
};
}
Expand Down
1 change: 1 addition & 0 deletions bridges/snowbridge/pallets/ethereum-client/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ fn compute_fork_version() {
capella: Fork { version: [0, 0, 0, 3], epoch: 30 },
deneb: Fork { version: [0, 0, 0, 4], epoch: 40 },
electra: Fork { version: [0, 0, 0, 5], epoch: 50 },
fulu: Fork { version: [0, 0, 0, 6], epoch: 60 },
};
new_tester().execute_with(|| {
assert_eq!(EthereumBeaconClient::select_fork_version(&mock_fork_versions, 0), [0, 0, 0, 0]);
Expand Down
16 changes: 10 additions & 6 deletions bridges/snowbridge/pallets/inbound-queue/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,32 @@ impl pallet_balances::Config for Test {
parameter_types! {
pub const ChainForkVersions: ForkVersions = ForkVersions {
genesis: Fork {
version: [0, 0, 0, 1], // 0x00000001
version: hex!("00000001"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remind me why you are changing the encoding for these. I know you spoke about it in the meet but I forgot.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vgeddes is just for better readability, it doesn't have any practical effect. This config is used for tests. I updated the fork version format to match the runtime config, e.g. https://github.com/paritytech/polkadot-sdk/blob/master/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_ethereum_config.rs#L238-L240

epoch: 0,
},
altair: Fork {
version: [1, 0, 0, 1], // 0x01000001
version: hex!("01000001"),
epoch: 0,
},
bellatrix: Fork {
version: [2, 0, 0, 1], // 0x02000001
version: hex!("02000001"),
epoch: 0,
},
capella: Fork {
version: [3, 0, 0, 1], // 0x03000001
version: hex!("03000001"),
epoch: 0,
},
deneb: Fork {
version: [4, 0, 0, 1], // 0x04000001
version: hex!("04000001"),
epoch: 0,
},
electra: Fork {
version: [5, 0, 0, 0], // 0x05000000
version: hex!("05000000"),
epoch: 80000000000,
},
fulu: Fork {
version: hex!("06000000"),
epoch: 80000000001,
}
};
}
Expand Down
1 change: 1 addition & 0 deletions bridges/snowbridge/primitives/beacon/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub struct ForkVersions {
pub capella: Fork,
pub deneb: Fork,
pub electra: Fork,
pub fulu: Fork,
}

#[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug, TypeInfo)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ parameter_types! {
electra: Fork {
version: hex!("05000000"),
epoch: 0,
},
fulu: Fork {
version: hex!("06000000"),
epoch: 5000000,
}
};
}
Expand Down Expand Up @@ -173,7 +177,11 @@ parameter_types! {
},
electra: Fork {
version: hex!("90000074"),
epoch: 222464, // https://github.com/ethereum/EIPs/pull/9322/files
epoch: 222464,
},
fulu: Fork {
version: hex!("90000075"),
epoch: 272640, // https://notes.ethereum.org/@bbusa/fusaka-bpo-timeline
},
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ parameter_types! {
},
electra: Fork {
version: hex!("90000074"),
epoch: 222464, // https://github.com/ethereum/EIPs/pull/9322/files
epoch: 222464,
},
fulu: Fork {
version: hex!("90000075"),
epoch: 272640, // https://notes.ethereum.org/@bbusa/fusaka-bpo-timeline
},
};
}
Expand Down Expand Up @@ -255,6 +259,10 @@ parameter_types! {
version: hex!("05000000"),
epoch: 0,
},
fulu: Fork {
version: hex!("06000000"),
epoch: 5000000,
}
};
}

Expand Down
15 changes: 15 additions & 0 deletions prdoc/pr_9938.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
title: 'Snowbridge - Adds Fulu hardfork'
doc:
- audience: Runtime Dev
description: Set fork version for Fulu hardfork on Sepolia.
crates:
- name: snowbridge-pallet-ethereum-client
bump: patch
- name: snowbridge-pallet-inbound-queue
bump: patch
- name: snowbridge-beacon-primitives
bump: patch
- name: bridge-hub-westend-runtime
bump: patch
- name: bridge-hub-rococo-runtime
bump: patch
Loading