Skip to content

Commit

Permalink
use block time as timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
avalonche committed Aug 24, 2024
1 parent c9c483e commit ce28546
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion builder/beacon_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ type IBeaconClient interface {

type NilBeaconClient struct{}

func (b *NilBeaconClient) SubscribeToPayloadAttributesEvents(payloadAttrC chan BuilderPayloadAttributes) {}
func (b *NilBeaconClient) SubscribeToPayloadAttributesEvents(payloadAttrC chan BuilderPayloadAttributes) {
}

func (b *NilBeaconClient) Start() error { return nil }

Expand Down
2 changes: 1 addition & 1 deletion builder/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

builderApiV1 "github.com/attestantio/go-builder-client/api/v1"
"github.com/attestantio/go-eth2-client/spec/bellatrix"
"github.com/attestantio/go-eth2-client/spec/deneb"
"github.com/attestantio/go-eth2-client/spec/capella"
"github.com/attestantio/go-eth2-client/spec/deneb"
"github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/ethereum/go-ethereum/beacon/engine"
"github.com/ethereum/go-ethereum/common"
Expand Down
6 changes: 4 additions & 2 deletions builder/eth_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ type IEthereumService interface {

type EthereumService struct {
eth *eth.Ethereum
cfg *Config
}

func NewEthereumService(eth *eth.Ethereum) *EthereumService {
func NewEthereumService(eth *eth.Ethereum, config *Config) *EthereumService {
return &EthereumService{
eth: eth,
cfg: config,
}
}

Expand Down Expand Up @@ -56,7 +58,7 @@ func (s *EthereumService) BuildBlock(attrs *BuilderPayloadAttributes) (*engine.E
resCh <- payload.ResolveFull()
}()

timer := time.NewTimer(2 * time.Second)
timer := time.NewTimer(s.cfg.BlockTime)
defer timer.Stop()

select {
Expand Down
2 changes: 1 addition & 1 deletion builder/eth_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestBuildBlock(t *testing.T) {
Slot: uint64(25),
}

service := NewEthereumService(ethservice)
service := NewEthereumService(ethservice, &DefaultConfig)

executableData, err := service.BuildBlock(testPayloadAttributes)

Expand Down
2 changes: 1 addition & 1 deletion builder/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func Register(stack *node.Node, backend *eth.Ethereum, cfg *Config) error {
beaconClient = NewOpBeaconClient(cfg.BeaconEndpoints[0])
}

ethereumService := NewEthereumService(backend)
ethereumService := NewEthereumService(backend, cfg)

builderSk, err := bls.SecretKeyFromBytes(envBuilderSkBytes[:])
if err != nil {
Expand Down

0 comments on commit ce28546

Please sign in to comment.