diff --git a/evm-adapter-proxy/config.example.yaml b/evm-adapter-proxy/config.example.yaml index 1117b45..6baa4ee 100644 --- a/evm-adapter-proxy/config.example.yaml +++ b/evm-adapter-proxy/config.example.yaml @@ -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 diff --git a/evm-adapter-proxy/internal/conf/config.go b/evm-adapter-proxy/internal/conf/config.go index ec7e384..0b67a37 100644 --- a/evm-adapter-proxy/internal/conf/config.go +++ b/evm-adapter-proxy/internal/conf/config.go @@ -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() { @@ -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 { diff --git a/evm-adapter-proxy/internal/icp/client.go b/evm-adapter-proxy/internal/icp/client.go index 61c793b..d9fa574 100644 --- a/evm-adapter-proxy/internal/icp/client.go +++ b/evm-adapter-proxy/internal/icp/client.go @@ -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) diff --git a/evm-adapter-proxy/internal/routers/evm/types.go b/evm-adapter-proxy/internal/routers/evm/types.go index 1def2e2..bc9a09f 100644 --- a/evm-adapter-proxy/internal/routers/evm/types.go +++ b/evm-adapter-proxy/internal/routers/evm/types.go @@ -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 }