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
26 changes: 23 additions & 3 deletions pkg/commands/context/context_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,32 @@ 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
}
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 {
return fmt.Errorf("failed to save updated context: %v", err)
}

logContextCreated(logger, cntxDir, name, ctxDoc, cCtx.Bool("use"))
return nil
}
Expand Down
25 changes: 15 additions & 10 deletions pkg/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
11 changes: 11 additions & 0 deletions pkg/common/getters.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading