Skip to content

Commit

Permalink
feat(beacon): Pass through headers to beacon package (#183)
Browse files Browse the repository at this point in the history
* fix(cannon): Check sync status before deriving events

* feat(beacon): Pass through headers to beacon package

* feat(beacon): Pass through headers to beacon package
  • Loading branch information
samcm committed Sep 6, 2023
1 parent 2ceac41 commit 7ab9fb6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions pkg/cannon/ethereum/beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ func NewBeaconNode(ctx context.Context, name string, config *Config, log logrus.
opts.BeaconSubscription.Enabled = false

node := beacon.NewNode(log, &beacon.Config{
Name: name,
Addr: config.BeaconNodeAddress,
Name: name,
Addr: config.BeaconNodeAddress,
Headers: config.BeaconNodeHeaders,
}, "xatu_cannon", opts)

metadata := services.NewMetadataService(log, node)
Expand Down
2 changes: 2 additions & 0 deletions pkg/cannon/ethereum/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ type Config struct {
BlockCacheSize uint64 `yaml:"blockCacheSize" default:"1000"`
// BlockCacheTTL is the time to live for blocks in the cache.
BlockCacheTTL human.Duration `yaml:"blockCacheTtl" default:"1h"`
// BeaconNodeHeaders is a map of headers to send to the beacon node.
BeaconNodeHeaders map[string]string `yaml:"beaconNodeHeaders"`
}

func (c *Config) Validate() error {
Expand Down
5 changes: 3 additions & 2 deletions pkg/sentry/ethereum/beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ func NewBeaconNode(ctx context.Context, name string, config *Config, log logrus.
opts.HealthCheck.SuccessfulResponses = 1

node := beacon.NewNode(log, &beacon.Config{
Name: name,
Addr: config.BeaconNodeAddress,
Name: name,
Addr: config.BeaconNodeAddress,
Headers: config.BeaconNodeHeaders,
}, "xatu_sentry", opts)

metadata := services.NewMetadataService(log, node)
Expand Down
2 changes: 2 additions & 0 deletions pkg/sentry/ethereum/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ type Config struct {
// OverrideNetworkName is the name of the network to use for the sentry.
// If not set, the network name will be retrieved from the beacon node.
OverrideNetworkName string `yaml:"overrideNetworkName" default:""`
// BeaconNodeHeaders is a map of headers to send to the beacon node.
BeaconNodeHeaders map[string]string `yaml:"beaconNodeHeaders"`
}

func (c *Config) Validate() error {
Expand Down

0 comments on commit 7ab9fb6

Please sign in to comment.