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

relayer/pkg/chainlink/cmd/chainlink-starknet: validate config and set defaults #592

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
16 changes: 12 additions & 4 deletions relayer/pkg/chainlink/cmd/chainlink-starknet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,21 @@ func (c *pluginRelayer) NewRelayer(ctx context.Context, config string, loopKs lo
if err := d.Decode(&cfg); err != nil {
return nil, fmt.Errorf("failed to decode config toml: %w:\n\t%s", err, config)
}
cfg.SetDefaults()
if err := cfg.ValidateConfig(); err != nil {
return nil, fmt.Errorf("config is invalid: %w", err)
}

opts := starkchain.ChainOpts{
Logger: c.Logger,
KeyStore: loopKs,
cfgStr, err := cfg.TOMLString()
if err != nil {
return nil, fmt.Errorf("failed to serialize config: %w", err)
}
c.Logger.Infow("Creating relayer", "config", cfgStr)

chain, err := starkchain.NewChain(&cfg, opts)
chain, err := starkchain.NewChain(&cfg, starkchain.ChainOpts{
Logger: c.Logger,
KeyStore: loopKs,
})
if err != nil {
return nil, fmt.Errorf("failed to create chain: %w", err)
}
Expand Down
Loading