Skip to content

Commit

Permalink
Merge branch 'master' into batch-4844-hysteresis
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-Wilson authored Feb 28, 2024
2 parents a1adf6e + 5dab604 commit 3299982
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
6 changes: 0 additions & 6 deletions arbnode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -829,12 +829,6 @@ func (n *Node) Start(ctx context.Context) error {
if n.SeqCoordinator != nil {
n.SeqCoordinator.Start(ctx)
} else {
if n.DelayedSequencer != nil {
err := n.DelayedSequencer.ForceSequenceDelayed(ctx)
if err != nil {
return fmt.Errorf("error initially sequencing delayed instructions: %w", err)
}
}
n.Execution.Activate()
}
if n.MaintenanceRunner != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ type RedisCoordinator struct {

// UpdatePriorities updates the priority list of sequencers
func (rc *RedisCoordinator) UpdatePriorities(ctx context.Context, priorities []string) error {
if len(priorities) == 0 {
return rc.Client.Del(ctx, redisutil.PRIORITIES_KEY).Err()
}
prioritiesString := strings.Join(priorities, ",")
err := rc.Client.Set(ctx, redisutil.PRIORITIES_KEY, prioritiesString, 0).Err()
if err != nil {
Expand Down
15 changes: 12 additions & 3 deletions util/headerreader/blob_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ import (
)

type BlobClient struct {
ec arbutil.L1Interface
beaconUrl *url.URL
httpClient *http.Client
ec arbutil.L1Interface
beaconUrl *url.URL
httpClient *http.Client
authorization string

// Filled in in Initialize()
genesisTime uint64
Expand All @@ -41,16 +42,19 @@ type BlobClient struct {
type BlobClientConfig struct {
BeaconUrl string `koanf:"beacon-url"`
BlobDirectory string `koanf:"blob-directory"`
Authorization string `koanf:"authorization"`
}

var DefaultBlobClientConfig = BlobClientConfig{
BeaconUrl: "",
BlobDirectory: "",
Authorization: "",
}

func BlobClientAddOptions(prefix string, f *pflag.FlagSet) {
f.String(prefix+".beacon-url", DefaultBlobClientConfig.BeaconUrl, "Beacon Chain RPC URL to use for fetching blobs (normally on port 3500)")
f.String(prefix+".blob-directory", DefaultBlobClientConfig.BlobDirectory, "Full path of the directory to save fetched blobs")
f.String(prefix+".authorization", DefaultBlobClientConfig.Authorization, "Value to send with the HTTP Authorization: header for Beacon REST requests, must include both scheme and scheme parameters")
}

func NewBlobClient(config BlobClientConfig, ec arbutil.L1Interface) (*BlobClient, error) {
Expand All @@ -72,6 +76,7 @@ func NewBlobClient(config BlobClientConfig, ec arbutil.L1Interface) (*BlobClient
return &BlobClient{
ec: ec,
beaconUrl: beaconUrl,
authorization: config.Authorization,
httpClient: &http.Client{},
blobDirectory: config.BlobDirectory,
}, nil
Expand All @@ -95,6 +100,10 @@ func beaconRequest[T interface{}](b *BlobClient, ctx context.Context, beaconPath
return empty, err
}

if b.authorization != "" {
req.Header.Set("Authorization", b.authorization)
}

resp, err := b.httpClient.Do(req)
if err != nil {
return empty, err
Expand Down
6 changes: 3 additions & 3 deletions util/redisutil/redis_coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ func (c *RedisCoordinator) CurrentChosenSequencer(ctx context.Context) (string,
// GetPriorities returns the priority list of sequencers
func (rc *RedisCoordinator) GetPriorities(ctx context.Context) ([]string, error) {
prioritiesString, err := rc.Client.Get(ctx, PRIORITIES_KEY).Result()
if errors.Is(err, redis.Nil) {
return []string{}, nil
}
if err != nil {
if errors.Is(err, redis.Nil) {
err = errors.New("sequencer priorities unset")
}
return []string{}, err
}
prioritiesList := strings.Split(prioritiesString, ",")
Expand Down

0 comments on commit 3299982

Please sign in to comment.