From 12b620aeb79bdaffd43e1abb8d695193aebab1ba Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Tue, 17 Oct 2023 09:04:05 -0600 Subject: [PATCH] add utility method to `Context` to get the right fork version --- ethereum-consensus/src/state_transition/context.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ethereum-consensus/src/state_transition/context.rs b/ethereum-consensus/src/state_transition/context.rs index 16e88c82f..a0205267a 100644 --- a/ethereum-consensus/src/state_transition/context.rs +++ b/ethereum-consensus/src/state_transition/context.rs @@ -362,6 +362,16 @@ impl Context { } } + pub fn fork_version_for(&self, fork: Fork) -> Version { + match fork { + Fork::Phase0 => self.genesis_fork_version, + Fork::Altair => self.altair_fork_version, + Fork::Bellatrix => self.bellatrix_fork_version, + Fork::Capella => self.capella_fork_version, + Fork::Deneb => self.deneb_fork_version, + } + } + pub fn genesis_time(&self) -> Result { match &self.name { Network::Mainnet => Ok(crate::clock::MAINNET_GENESIS_TIME),