Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add envs for local testing #3

Merged
merged 1 commit into from
Dec 3, 2024
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
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