Hardforks
Hardforks are consensus layer types of the OP Stack.
kona-hardforks
most directly exports the Hardforks
type that provides
the network upgrade transactions for OP Stack hardforks including the following.
Each hardfork has its own type in kona-hardforks
that exposes the network
upgrade transactions for that hardfork.
For example, the Ecotone
type can be used to retrieve the Ecotone
network upgrade transactions through its txs() -> impl Iterator<Bytes>
method.
#![allow(unused)] fn main() { // Notice, the `Hardfork` trait must be imported in order to // provide the `txs()` method implemented for the hardfork type. use kona_hardforks::{Hardfork, Ecotone}; let ecotone_upgrade_txs = Ecotone.txs(); assert_eq!(ecotone_upgrade_txs.collect::<Vec<_>>().len(), 6); }
Conveniently, the Hardforks
type exposes each hardfork type as a field
that can be directly referenced without needing to import all the different hardforks.
#![allow(unused)] fn main() { use kona_hardforks::{Hardfork, Hardforks}; let ecotone_upgrade_txs = Hardforks::ECOTONE.txs(); assert_eq!(ecotone_upgrade_txs.collect::<Vec<_>>().len(), 6); }