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
28 changes: 14 additions & 14 deletions cmd/workflow/simulate/simulate.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,22 +146,22 @@ func (h *handler) ResolveInputs(v *viper.Viper, creSettings *settings.Settings)

for _, ec := range expChains {
// Validate required fields
if ec.ChainID == 0 {
return Inputs{}, fmt.Errorf("experimental chain missing chain-id")
if ec.ChainSelector == 0 {
return Inputs{}, fmt.Errorf("experimental chain missing chain-selector")
}
if strings.TrimSpace(ec.RPCURL) == "" {
return Inputs{}, fmt.Errorf("experimental chain %d missing rpc-url", ec.ChainID)
return Inputs{}, fmt.Errorf("experimental chain %d missing rpc-url", ec.ChainSelector)
}
if strings.TrimSpace(ec.Forwarder) == "" {
return Inputs{}, fmt.Errorf("experimental chain %d missing forwarder", ec.ChainID)
return Inputs{}, fmt.Errorf("experimental chain %d missing forwarder", ec.ChainSelector)
}

// Check if chain ID already exists (supported chain)
if _, exists := clients[ec.ChainID]; exists {
// Check if chain selector already exists (supported chain)
if _, exists := clients[ec.ChainSelector]; exists {
// Find the supported chain's forwarder
var supportedForwarder string
for _, supported := range SupportedEVM {
if supported.Selector == ec.ChainID {
if supported.Selector == ec.ChainSelector {
supportedForwarder = supported.Forwarder
break
}
Expand All @@ -170,27 +170,27 @@ func (h *handler) ResolveInputs(v *viper.Viper, creSettings *settings.Settings)
expFwd := common.HexToAddress(ec.Forwarder)
if supportedForwarder != "" && common.HexToAddress(supportedForwarder) == expFwd {
// Same forwarder, just debug log
h.log.Debug().Uint64("chain-id", ec.ChainID).Msg("Experimental chain matches supported chain config")
h.log.Debug().Uint64("chain-selector", ec.ChainSelector).Msg("Experimental chain matches supported chain config")
continue
}

// Different forwarder - respect user's config, warn about override
fmt.Printf("Warning: experimental chain %d overrides supported chain forwarder (supported: %s, experimental: %s)\n", ec.ChainID, supportedForwarder, ec.Forwarder)
fmt.Printf("Warning: experimental chain %d overrides supported chain forwarder (supported: %s, experimental: %s)\n", ec.ChainSelector, supportedForwarder, ec.Forwarder)

// Use existing client but override the forwarder
experimentalForwarders[ec.ChainID] = expFwd
experimentalForwarders[ec.ChainSelector] = expFwd
continue
}

// Dial the RPC
c, err := ethclient.Dial(ec.RPCURL)
if err != nil {
return Inputs{}, fmt.Errorf("failed to create eth client for experimental chain %d: %w", ec.ChainID, err)
return Inputs{}, fmt.Errorf("failed to create eth client for experimental chain %d: %w", ec.ChainSelector, err)
}

clients[ec.ChainID] = c
experimentalForwarders[ec.ChainID] = common.HexToAddress(ec.Forwarder)
fmt.Printf("Added experimental chain (chain-id: %d)\n", ec.ChainID)
clients[ec.ChainSelector] = c
experimentalForwarders[ec.ChainSelector] = common.HexToAddress(ec.Forwarder)
fmt.Printf("Added experimental chain (chain-selector: %d)\n", ec.ChainSelector)
}

if len(clients) == 0 {
Expand Down
8 changes: 4 additions & 4 deletions internal/settings/settings_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ type RpcEndpoint struct {

// ExperimentalChain represents an EVM chain not in official chain-selectors.
// Automatically used by the simulator when present in the target's experimental-chains config.
// The ChainID is used as the selector key for EVM clients and forwarders.
// The ChainSelector is used as the selector key for EVM clients and forwarders.
type ExperimentalChain struct {
ChainID uint64 `mapstructure:"chain-id" yaml:"chain-id"`
RPCURL string `mapstructure:"rpc-url" yaml:"rpc-url"`
Forwarder string `mapstructure:"forwarder" yaml:"forwarder"`
ChainSelector uint64 `mapstructure:"chain-selector" yaml:"chain-selector"`
RPCURL string `mapstructure:"rpc-url" yaml:"rpc-url"`
Forwarder string `mapstructure:"forwarder" yaml:"forwarder"`
}

func GetRpcUrlSettings(v *viper.Viper, chainName string) (string, error) {
Expand Down
4 changes: 2 additions & 2 deletions internal/settings/template/project.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
#
# Experimental chains (automatically used by the simulator when present):
# Use this for chains not yet in official chain-selectors (e.g., hackathons, new chain integrations).
# In your workflow, reference the chain as evm:ChainSelector:<chain-id>@1.0.0
# In your workflow, reference the chain as evm:ChainSelector:<chain-selector>@1.0.0
#
# experimental-chains:
# - chain-id: 12345 # The numeric chain ID
# - chain-selector: 12345 # The chain selector value
# rpc-url: "https://rpc.example.com" # RPC endpoint URL
# forwarder: "0x..." # Forwarder contract address on the chain

Expand Down
Loading