-
Notifications
You must be signed in to change notification settings - Fork 157
Decentralize parachain relayer #1265
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
Changes from 12 commits
a6bc10f
2fe3c30
d9f601d
fb3c4e0
929e101
a6b2529
261fd89
e401cb8
fce791d
2d4387c
b933ae8
09a9d11
ebb257b
7620602
0deea62
a3a7f02
6dfa134
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,16 @@ | ||
| package parachain | ||
|
|
||
| import ( | ||
| "errors" | ||
| "fmt" | ||
|
|
||
| "github.com/snowfork/snowbridge/relayer/config" | ||
| ) | ||
|
|
||
| type Config struct { | ||
| Source SourceConfig `mapstructure:"source"` | ||
| Sink SinkConfig `mapstructure:"sink"` | ||
| Source SourceConfig `mapstructure:"source"` | ||
| Sink SinkConfig `mapstructure:"sink"` | ||
| Relay RelayerConfig `mapstructure:"relay"` | ||
| } | ||
|
|
||
| type SourceConfig struct { | ||
|
|
@@ -32,6 +35,18 @@ type SinkContractsConfig struct { | |
| Gateway string `mapstructure:"Gateway"` | ||
| } | ||
|
|
||
| type RelayerConfig struct { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The naming should be more specific. "Relayer" is vague. Ie something like
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ID uint64 `mapstructure:"id"` | ||
| Num uint64 `mapstructure:"num"` | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comments needs for these fields please
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| func (r RelayerConfig) Validate() error { | ||
| if r.Num < 1 { | ||
| return errors.New("Number of relayer is not set") | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| type ChannelID [32]byte | ||
|
|
||
| func (c Config) Validate() error { | ||
|
|
@@ -66,5 +81,12 @@ func (c Config) Validate() error { | |
| if c.Sink.Contracts.Gateway == "" { | ||
| return fmt.Errorf("sink contracts setting [Gateway] is not set") | ||
| } | ||
|
|
||
| // Relay | ||
| err = c.Relay.Validate() | ||
| if err != nil { | ||
| return fmt.Errorf("relay config: %w", err) | ||
| } | ||
|
|
||
| return nil | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,5 +24,9 @@ | |
| "contracts": { | ||
| "Gateway": null | ||
| } | ||
| }, | ||
| "relay": { | ||
| "id": null, | ||
| "num": 3 | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest more specific naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7620602