Skip to content

Commit

Permalink
Add envs for local testing (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaslopezf authored Dec 3, 2024
1 parent 0c5fc56 commit 3fc1339
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 2 additions & 0 deletions evm-adapter-proxy/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ icp:
dexCanisterId: "7eo5f-eqaaa-aaaam-adqoq-cai"
nodeUrl: "https://ic0.app" # Default IC mainnet URL
timeout: "120s" # Timeout for ICP operations
disableSignedQueryVerification: true # Disable signed query verification for local testing
fetchRootKey: false # Set true for mainnet

12 changes: 8 additions & 4 deletions evm-adapter-proxy/internal/conf/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ type RouterConfig struct {
}

type ICPConfig struct {
LoggerCanisterID string `mapstructure:"loggerCanisterId"`
DexCanisterID string `mapstructure:"dexCanisterId"`
NodeURL string `mapstructure:"nodeUrl"`
Timeout string `mapstructure:"timeout"`
LoggerCanisterID string `mapstructure:"loggerCanisterId"`
DexCanisterID string `mapstructure:"dexCanisterId"`
NodeURL string `mapstructure:"nodeUrl"`
Timeout string `mapstructure:"timeout"`
DisableSignedQueryVerification bool `mapstructure:"disableSignedQueryVerification"`
FetchRootKey bool `mapstructure:"fetchRootKey"`
}

func (c Config) SetDefaults() {
Expand All @@ -42,6 +44,8 @@ func (c Config) SetDefaults() {
viper.SetDefault("logging.level", "info")
viper.SetDefault("metrics.path", "/metrics")
viper.SetDefault("metrics.port", "9090")
viper.SetDefault("icp.disableSignedQueryVerification", false)
viper.SetDefault("icp.fetchRootKey", false)
}

func (c Config) Validate() error {
Expand Down
7 changes: 4 additions & 3 deletions evm-adapter-proxy/internal/icp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ func NewICPClient(cfg *conf.ICPConfig) (*Clients, error) {
ClientConfig: &agent.ClientConfig{
Host: nodeURL,
},
FetchRootKey: true,
Identity: id,
PollTimeout: timeOut,
FetchRootKey: cfg.FetchRootKey,
Identity: id,
PollTimeout: timeOut,
DisableSignedQueryVerification: cfg.DisableSignedQueryVerification,
}

loggerAgent, err := icpLogger.NewAgent(loggerCanisterID, agentConfig)
Expand Down
2 changes: 1 addition & 1 deletion evm-adapter-proxy/internal/routers/evm/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func hexToDecimal(hex string) (string, error) {
hex = strings.TrimPrefix(hex, "0x")

switch hex {
case "latest", "pending", "earliest":
case "latest", "pending", "earliest", "finalized", "safe":
return hex, nil
}

Expand Down

0 comments on commit 3fc1339

Please sign in to comment.