Skip to content

Commit

Permalink
Merge branch 'main' into configurable-max-gas
Browse files Browse the repository at this point in the history
  • Loading branch information
geoff-vball authored Jan 10, 2025
2 parents 50cb709 + 303b307 commit 5cc0762
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
7 changes: 6 additions & 1 deletion peers/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@

package peers

import "github.com/ava-labs/icm-services/config"
import (
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/utils/set"
"github.com/ava-labs/icm-services/config"
)

// Config defines a common interface necessary for standing up an AppRequestNetwork.
type Config interface {
GetInfoAPI() *config.APIConfig
GetPChainAPI() *config.APIConfig
GetAllowPrivateIPs() bool
GetTrackedSubnets() set.Set[ids.ID]
}
9 changes: 9 additions & 0 deletions relayer/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ type Config struct {
// convenience field to fetch a blockchain's subnet ID
blockchainIDToSubnetID map[ids.ID]ids.ID
overwrittenOptions []string
trackedSubnets set.Set[ids.ID]
}

func DisplayUsageText() {
Expand Down Expand Up @@ -148,6 +149,10 @@ func (c *Config) Validate() error {
}
}

for _, l1ID := range c.blockchainIDToSubnetID {
c.trackedSubnets.Add(l1ID)
}

return nil
}

Expand Down Expand Up @@ -256,3 +261,7 @@ func (c *Config) GetInfoAPI() *basecfg.APIConfig {
func (c *Config) GetAllowPrivateIPs() bool {
return c.AllowPrivateIPs
}

func (c *Config) GetTrackedSubnets() set.Set[ids.ID] {
return c.trackedSubnets
}
18 changes: 18 additions & 0 deletions signature-aggregator/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ package config
import (
"fmt"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/set"
basecfg "github.com/ava-labs/icm-services/config"
"github.com/ava-labs/icm-services/peers"
)
Expand Down Expand Up @@ -35,6 +37,10 @@ type Config struct {
MetricsPort uint16 `mapstructure:"metrics-port" json:"metrics-port"`
SignatureCacheSize uint64 `mapstructure:"signature-cache-size" json:"signature-cache-size"`
AllowPrivateIPs bool `mapstructure:"allow-private-ips" json:"allow-private-ips"`
TrackedSubnetIDs []string `mapstructure:"tracked-subnet-ids" json:"tracked-subnet-ids"`

// convenience fields
trackedSubnets set.Set[ids.ID]
}

func DisplayUsageText() {
Expand All @@ -51,6 +57,14 @@ func (c *Config) Validate() error {
if err := c.InfoAPI.Validate(); err != nil {
return err
}
c.trackedSubnets = set.NewSet[ids.ID](len(c.TrackedSubnetIDs))
for _, trackedL1 := range c.TrackedSubnetIDs {
trackedL1ID, err := ids.FromString(trackedL1)
if err != nil {
return err
}
c.trackedSubnets.Add(trackedL1ID)
}

return nil
}
Expand All @@ -68,3 +82,7 @@ func (c *Config) GetInfoAPI() *basecfg.APIConfig {
func (c *Config) GetAllowPrivateIPs() bool {
return c.AllowPrivateIPs
}

func (c *Config) GetTrackedSubnets() set.Set[ids.ID] {
return c.trackedSubnets
}
2 changes: 1 addition & 1 deletion signature-aggregator/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func main() {
network, err := peers.NewNetwork(
networkLogger,
prometheus.DefaultRegisterer,
nil,
cfg.GetTrackedSubnets(),
nil,
&cfg,
)
Expand Down

0 comments on commit 5cc0762

Please sign in to comment.