Skip to content

Commit

Permalink
Merge branch 'express-lane-timeboost' into add-timeboosted-broadcastf…
Browse files Browse the repository at this point in the history
…eedmessage
  • Loading branch information
Tristan-Wilson committed Oct 11, 2024
2 parents b8890a1 + 7a2eb14 commit 572d4b2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 8 deletions.
4 changes: 4 additions & 0 deletions execution/gethexec/express_lane_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ func (es *expressLaneService) Start(ctxIn context.Context) {
})
}

func (es *expressLaneService) StopAndWait() {
es.StopWaiter.StopAndWait()
}

func (es *expressLaneService) currentRoundHasController() bool {
es.Lock()
defer es.Unlock()
Expand Down
41 changes: 35 additions & 6 deletions execution/gethexec/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,19 @@ type SequencerConfig struct {
}

type TimeboostConfig struct {
Enable bool `koanf:"enable"`
ExpressLaneAdvantage time.Duration `koanf:"express-lane-advantage"`
SequencerHTTPEndpoint string `koanf:"sequencer-http-endpoint"`
Enable bool `koanf:"enable"`
AuctionContractAddress string `koanf:"auction-contract-address"`
AuctioneerAddress string `koanf:"auctioneer-address"`
ExpressLaneAdvantage time.Duration `koanf:"express-lane-advantage"`
SequencerHTTPEndpoint string `koanf:"sequencer-http-endpoint"`
}

var DefaultTimeboostConfig = TimeboostConfig{
Enable: false,
ExpressLaneAdvantage: time.Millisecond * 200,
SequencerHTTPEndpoint: "http://localhost:9567",
Enable: false,
AuctionContractAddress: "",
AuctioneerAddress: "",
ExpressLaneAdvantage: time.Millisecond * 200,
SequencerHTTPEndpoint: "http://localhost:8547",
}

func (c *SequencerConfig) Validate() error {
Expand Down Expand Up @@ -122,6 +126,19 @@ func (c *SequencerConfig) Validate() error {
if c.MaxTxDataSize > arbostypes.MaxL2MessageSize-50000 {
return errors.New("max-tx-data-size too large for MaxL2MessageSize")
}
return c.Timeboost.Validate()
}

func (c *TimeboostConfig) Validate() error {
if !c.Enable {
return nil
}
if len(c.AuctionContractAddress) > 0 && !common.IsHexAddress(c.AuctionContractAddress) {
return fmt.Errorf("invalid timeboost.auction-contract-address \"%v\"", c.AuctionContractAddress)
}
if len(c.AuctioneerAddress) > 0 && !common.IsHexAddress(c.AuctioneerAddress) {
return fmt.Errorf("invalid timeboost.auctioneer-address \"%v\"", c.AuctioneerAddress)
}
return nil
}

Expand Down Expand Up @@ -170,6 +187,8 @@ func SequencerConfigAddOptions(prefix string, f *flag.FlagSet) {

func TimeboostAddOptions(prefix string, f *flag.FlagSet) {
f.Bool(prefix+".enable", DefaultTimeboostConfig.Enable, "enable timeboost based on express lane auctions")
f.String(prefix+".auction-contract-address", DefaultTimeboostConfig.AuctionContractAddress, "Address of the proxy pointing to the ExpressLaneAuction contract")
f.String(prefix+".auctioneer-address", DefaultTimeboostConfig.AuctioneerAddress, "Address of the Timeboost Autonomous Auctioneer")
f.Duration(prefix+".express-lane-advantage", DefaultTimeboostConfig.ExpressLaneAdvantage, "specify the express lane advantage")
f.String(prefix+".sequencer-http-endpoint", DefaultTimeboostConfig.SequencerHTTPEndpoint, "this sequencer's http endpoint")
}
Expand Down Expand Up @@ -1222,6 +1241,13 @@ func (s *Sequencer) Start(ctxIn context.Context) error {
return 0
})

if config.Timeboost.Enable {
s.StartExpressLane(
ctxIn,
common.HexToAddress(config.Timeboost.AuctionContractAddress),
common.HexToAddress(config.Timeboost.AuctioneerAddress))
}

return nil
}

Expand Down Expand Up @@ -1249,6 +1275,9 @@ func (s *Sequencer) StartExpressLane(ctx context.Context, auctionContractAddr co

func (s *Sequencer) StopAndWait() {
s.StopWaiter.StopAndWait()
if s.config().Timeboost.Enable {
s.expressLaneService.StopWaiter.StopAndWait()
}
if s.txRetryQueue.Len() == 0 && len(s.txQueue) == 0 && s.nonceFailures.Len() == 0 {
return
}
Expand Down
4 changes: 2 additions & 2 deletions timeboost/bidder_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ type BidderClientConfig struct {
}

var DefaultBidderClientConfig = BidderClientConfig{
ArbitrumNodeEndpoint: "http://localhost:9567",
ArbitrumNodeEndpoint: "http://localhost:8547",
BidValidatorEndpoint: "http://localhost:9372",
}

var TestBidderClientConfig = BidderClientConfig{
ArbitrumNodeEndpoint: "http://localhost:9567",
ArbitrumNodeEndpoint: "http://localhost:8547",
BidValidatorEndpoint: "http://localhost:9372",
}

Expand Down

0 comments on commit 572d4b2

Please sign in to comment.