From 7b1bdccfe6bee6d2ca08001d44b8fd16483cb4ed Mon Sep 17 00:00:00 2001 From: Eunsoo Park Date: Wed, 7 Feb 2024 16:10:42 +0900 Subject: [PATCH] Add constants for sepolia cancun/deneb upgrade --- .../foundation/icon/btp/bmv/eth2/BlockUpdate.java | 2 ++ .../java/foundation/icon/btp/bmv/eth2/Constants.java | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bmv/eth2/src/main/java/foundation/icon/btp/bmv/eth2/BlockUpdate.java b/bmv/eth2/src/main/java/foundation/icon/btp/bmv/eth2/BlockUpdate.java index 49734ed0..e4dd80ab 100644 --- a/bmv/eth2/src/main/java/foundation/icon/btp/bmv/eth2/BlockUpdate.java +++ b/bmv/eth2/src/main/java/foundation/icon/btp/bmv/eth2/BlockUpdate.java @@ -167,6 +167,8 @@ private static byte[] computeForkVersion(BigInteger epoch, byte[] genesisValidat return Constants.MAINNET_ALTAIR_VERSION; return Constants.MAINNET_GENESIS_VERSION; } else if (Arrays.equals(genesisValidatorsRoot, Constants.SEPOLIA_GENESIS_VALIDATORS_ROOT)) { + if (epoch.compareTo(Constants.SEPOLIA_DENEB_EPOCH) >= 0) + return Constants.SEPOLIA_DENEB_VERSION; if (epoch.compareTo(Constants.SEPOLIA_CAPELLA_EPOCH) >= 0) return Constants.SEPOLIA_CAPELLA_VERSION; if (epoch.compareTo(Constants.SEPOLIA_BELLATRIX_EPOCH) >= 0) diff --git a/bmv/eth2/src/main/java/foundation/icon/btp/bmv/eth2/Constants.java b/bmv/eth2/src/main/java/foundation/icon/btp/bmv/eth2/Constants.java index d9e82924..788a9737 100644 --- a/bmv/eth2/src/main/java/foundation/icon/btp/bmv/eth2/Constants.java +++ b/bmv/eth2/src/main/java/foundation/icon/btp/bmv/eth2/Constants.java @@ -27,16 +27,21 @@ public class Constants { public static final byte[] MAINNET_GENESIS_VALIDATORS_ROOT = StringUtil.hexToBytes("4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95"); public static final byte[] SEPOLIA_GENESIS_VALIDATORS_ROOT = StringUtil.hexToBytes("d8ea171f3c94aea21ebc42a1ed61052acf3f9209c00e4efbaaddac09ed9b8078"); + // https://github.com/ethereum/execution-specs/tree/master/network-upgrades/mainnet-upgrades + // read via /eth/v1/config/fork_schedule public static final BigInteger MAINNET_ALTAIR_EPOCH = BigInteger.valueOf(74240); public static final BigInteger MAINNET_BELLATRIX_EPOCH = BigInteger.valueOf(144896); public static final BigInteger MAINNET_CAPELLA_EPOCH = BigInteger.valueOf(194048); - public static final BigInteger SEPOLIA_ALTAIR_EPOCH = BigInteger.valueOf(50); - public static final BigInteger SEPOLIA_BELLATRIX_EPOCH = BigInteger.valueOf(100); - public static final BigInteger SEPOLIA_CAPELLA_EPOCH = BigInteger.valueOf(56832); public static final byte[] MAINNET_CAPELLA_VERSION = StringUtil.hexToBytes("03000000"); public static final byte[] MAINNET_BELLATRIX_VERSION = StringUtil.hexToBytes("02000000"); public static final byte[] MAINNET_ALTAIR_VERSION = StringUtil.hexToBytes("01000000"); public static final byte[] MAINNET_GENESIS_VERSION = StringUtil.hexToBytes("00000000"); + + public static final BigInteger SEPOLIA_ALTAIR_EPOCH = BigInteger.valueOf(50); + public static final BigInteger SEPOLIA_BELLATRIX_EPOCH = BigInteger.valueOf(100); + public static final BigInteger SEPOLIA_CAPELLA_EPOCH = BigInteger.valueOf(56832); + public static final BigInteger SEPOLIA_DENEB_EPOCH = BigInteger.valueOf(132608); + public static final byte[] SEPOLIA_DENEB_VERSION = StringUtil.hexToBytes("90000073"); public static final byte[] SEPOLIA_CAPELLA_VERSION = StringUtil.hexToBytes("90000072"); public static final byte[] SEPOLIA_BELLATRIX_VERSION = StringUtil.hexToBytes("90000071"); public static final byte[] SEPOLIA_ALTAIR_VERSION = StringUtil.hexToBytes("90000070");