From 03618d9c33f841d853ced014e8bab10b824dd544 Mon Sep 17 00:00:00 2001 From: Grezle <4310551+grezle@users.noreply.github.com> Date: Thu, 16 Oct 2025 16:22:18 +0100 Subject: [PATCH 1/3] fix: add mainnet fallback addresses for middleware --- pkg/common/constants.go | 25 +++++++++++++++---------- pkg/common/getters.go | 11 +++++++++++ 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/pkg/common/constants.go b/pkg/common/constants.go index 207ad0af..9975a1bf 100644 --- a/pkg/common/constants.go +++ b/pkg/common/constants.go @@ -39,14 +39,19 @@ const ( CURVE_TYPE_KEY_REGISTRAR_BN254 = 2 // These are fallback EigenLayer deployment addresses when not specified in context (assumes seploia) - ALLOCATION_MANAGER_ADDRESS = "0x42583067658071247ec8CE0A516A58f682002d07" - DELEGATION_MANAGER_ADDRESS = "0xD4A7E1Bd8015057293f0D0A557088c286942e84b" - STRATEGY_MANAGER_ADDRESS = "0x2E3D6c0744b10eb0A4e6F679F71554a39Ec47a5D" - KEY_REGISTRAR_ADDRESS = "0xA4dB30D08d8bbcA00D40600bee9F029984dB162a" - CROSS_CHAIN_REGISTRY_ADDRESS = "0x287381B1570d9048c4B4C7EC94d21dDb8Aa1352a" - BN254_TABLE_CALCULATOR_ADDRESS = "0xa19E3B00cf4aC46B5e6dc0Bbb0Fb0c86D0D65603" - ECDSA_TABLE_CALCULATOR_ADDRESS = "0xaCB5DE6aa94a1908E6FA577C2ade65065333B450" - MULTICHAIN_PROXY_ADMIN = "0xC5dc0d145a21FDAD791Df8eDC7EbCB5330A3FdB5" - EIGEN_CONTRACT_ADDRESS = "0x3B78576F7D6837500bA3De27A60c7f594934027E" - RELEASE_MANAGER_ADDRESS = "0xd9Cb89F1993292dEC2F973934bC63B0f2A702776" + ALLOCATION_MANAGER_ADDRESS = "0x42583067658071247ec8CE0A516A58f682002d07" + DELEGATION_MANAGER_ADDRESS = "0xD4A7E1Bd8015057293f0D0A557088c286942e84b" + STRATEGY_MANAGER_ADDRESS = "0x2E3D6c0744b10eb0A4e6F679F71554a39Ec47a5D" + KEY_REGISTRAR_ADDRESS = "0xA4dB30D08d8bbcA00D40600bee9F029984dB162a" + CROSS_CHAIN_REGISTRY_ADDRESS = "0x287381B1570d9048c4B4C7EC94d21dDb8Aa1352a" + MULTICHAIN_PROXY_ADMIN = "0xC5dc0d145a21FDAD791Df8eDC7EbCB5330A3FdB5" + EIGEN_CONTRACT_ADDRESS = "0x3B78576F7D6837500bA3De27A60c7f594934027E" + RELEASE_MANAGER_ADDRESS = "0xd9Cb89F1993292dEC2F973934bC63B0f2A702776" + + // These are fallback EigenLayer Middleware deployment addresses when not specified in context + SEPOLIA_BN254_TABLE_CALCULATOR_ADDRESS = "0xa19E3B00cf4aC46B5e6dc0Bbb0Fb0c86D0D65603" + SEPOLIA_ECDSA_TABLE_CALCULATOR_ADDRESS = "0xaCB5DE6aa94a1908E6FA577C2ade65065333B450" + + MAINNET_BN254_TABLE_CALCULATOR_ADDRESS = "0x55F4b21681977F412B318eCB204cB933bD1dF57c" + MAINNET_ECDSA_TABLE_CALCULATOR_ADDRESS = "0xA933CB4cbD0C4C208305917f56e0C3f51ad713Fa" ) diff --git a/pkg/common/getters.go b/pkg/common/getters.go index 571d6ce3..69539d77 100644 --- a/pkg/common/getters.go +++ b/pkg/common/getters.go @@ -32,15 +32,26 @@ func GetForkUrlDefault(contextName string, cfg *ConfigWithContextConfig, chainNa // GetEigenLayerAddresses returns EigenLayer L1 addresses from the context config // Falls back to constants if not found in context func GetEigenLayerAddresses(contextName string, cfg *ConfigWithContextConfig) (allocationManager, delegationManager, strategyManager, keyRegistrar, crossChainRegistry, bn254TableCalculator, ecdsaTableCalculator, releaseManager string) { + // Default middleware addresses according to context + var BN254_TABLE_CALCULATOR_ADDRESS = SEPOLIA_BN254_TABLE_CALCULATOR_ADDRESS + var ECDSA_TABLE_CALCULATOR_ADDRESS = SEPOLIA_ECDSA_TABLE_CALCULATOR_ADDRESS + if contextName == "mainnet" { + BN254_TABLE_CALCULATOR_ADDRESS = MAINNET_BN254_TABLE_CALCULATOR_ADDRESS + ECDSA_TABLE_CALCULATOR_ADDRESS = MAINNET_ECDSA_TABLE_CALCULATOR_ADDRESS + } + + // Return constants for undefined context if cfg == nil || cfg.Context == nil { return ALLOCATION_MANAGER_ADDRESS, DELEGATION_MANAGER_ADDRESS, STRATEGY_MANAGER_ADDRESS, KEY_REGISTRAR_ADDRESS, CROSS_CHAIN_REGISTRY_ADDRESS, BN254_TABLE_CALCULATOR_ADDRESS, ECDSA_TABLE_CALCULATOR_ADDRESS, RELEASE_MANAGER_ADDRESS } + // Return constants for missing context ctx, found := cfg.Context[contextName] if !found || ctx.EigenLayer == nil { return ALLOCATION_MANAGER_ADDRESS, DELEGATION_MANAGER_ADDRESS, STRATEGY_MANAGER_ADDRESS, KEY_REGISTRAR_ADDRESS, CROSS_CHAIN_REGISTRY_ADDRESS, BN254_TABLE_CALCULATOR_ADDRESS, ECDSA_TABLE_CALCULATOR_ADDRESS, RELEASE_MANAGER_ADDRESS } + // Default each address to constant if missing from discovered context allocationManager = ctx.EigenLayer.L1.AllocationManager if allocationManager == "" { allocationManager = ALLOCATION_MANAGER_ADDRESS From 219a105f7861fe7ec58f3f0f1184405b5dadaa9c Mon Sep 17 00:00:00 2001 From: Grezle <4310551+grezle@users.noreply.github.com> Date: Thu, 16 Oct 2025 16:48:58 +0100 Subject: [PATCH 2/3] fix: ensure context is created with middleware addresses --- pkg/commands/context/context_create.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pkg/commands/context/context_create.go b/pkg/commands/context/context_create.go index 90213344..8d8f6629 100644 --- a/pkg/commands/context/context_create.go +++ b/pkg/commands/context/context_create.go @@ -196,12 +196,24 @@ func contextCreateAction(cCtx *cli.Context) error { logger.Info("Continuing with addresses from config...") } else { logger.Info("Successfully updated context with addresses from Zeus") - if err := common.WriteYAML(yamlPath, rootNode); err != nil { - return fmt.Errorf("failed to save updated context: %v", err) - } } } + // Place middleware addresses into context + bn254TableCalculator := common.SEPOLIA_BN254_TABLE_CALCULATOR_ADDRESS + ecdsaTableCalculator := common.SEPOLIA_ECDSA_TABLE_CALCULATOR_ADDRESS + if int(l1ChainID.Uint64()) == 1 { + bn254TableCalculator = common.MAINNET_BN254_TABLE_CALCULATOR_ADDRESS + ecdsaTableCalculator = common.MAINNET_ECDSA_TABLE_CALCULATOR_ADDRESS + } + common.WriteToPath(contextNode, strings.Split("eigenlayer.l1.bn254_table_calculator", "."), bn254TableCalculator) + common.WriteToPath(contextNode, strings.Split("eigenlayer.l1.ecdsa_table_calculator", "."), ecdsaTableCalculator) + + // Save all updates to the yaml file + if err := common.WriteYAML(yamlPath, rootNode); err != nil { + return fmt.Errorf("failed to save updated context: %v", err) + } + logContextCreated(logger, cntxDir, name, ctxDoc, cCtx.Bool("use")) return nil } From 975a5a309ea993937ea4cee1f2693eb28ba6a489 Mon Sep 17 00:00:00 2001 From: Grezle <4310551+grezle@users.noreply.github.com> Date: Thu, 16 Oct 2025 16:53:26 +0100 Subject: [PATCH 3/3] fix: handle errs setting values --- pkg/commands/context/context_create.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/commands/context/context_create.go b/pkg/commands/context/context_create.go index 8d8f6629..8496379d 100644 --- a/pkg/commands/context/context_create.go +++ b/pkg/commands/context/context_create.go @@ -206,8 +206,16 @@ func contextCreateAction(cCtx *cli.Context) error { bn254TableCalculator = common.MAINNET_BN254_TABLE_CALCULATOR_ADDRESS ecdsaTableCalculator = common.MAINNET_ECDSA_TABLE_CALCULATOR_ADDRESS } - common.WriteToPath(contextNode, strings.Split("eigenlayer.l1.bn254_table_calculator", "."), bn254TableCalculator) - common.WriteToPath(contextNode, strings.Split("eigenlayer.l1.ecdsa_table_calculator", "."), ecdsaTableCalculator) + bn254TableCalculatorPath := "eigenlayer.l1.bn254_table_calculator" + ecdsaTableCalculatorPath := "eigenlayer.l1.ecdsa_table_calculator" + _, err = common.WriteToPath(contextNode, strings.Split(bn254TableCalculatorPath, "."), bn254TableCalculator) + if err != nil { + return fmt.Errorf("setting value %s to %s failed: %w", bn254TableCalculatorPath, bn254TableCalculator, err) + } + _, err = common.WriteToPath(contextNode, strings.Split(ecdsaTableCalculatorPath, "."), ecdsaTableCalculator) + if err != nil { + return fmt.Errorf("setting value %s to %s failed: %w", ecdsaTableCalculatorPath, ecdsaTableCalculator, err) + } // Save all updates to the yaml file if err := common.WriteYAML(yamlPath, rootNode); err != nil {