Skip to content

Commit

Permalink
remove extra data field from BuildPayloadArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
jinmel committed Sep 13, 2024
1 parent 9fd9c41 commit a5fecec
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 1 addition & 2 deletions builder/eth_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ func (s *EthereumService) BuildBlock(attrs *builderTypes.PayloadAttributes) (*en
BeaconRoot: attrs.ParentBeaconBlockRoot,
Transactions: attrs.Transactions,
NoTxPool: attrs.NoTxPool,
ExtraData: attrs.ExtraData,
}

payload, err := s.eth.Miner().BuildPayload(args)
payload, err := s.eth.Miner().BuildPayloadWithExtraData(args, attrs.ExtraData)
if err != nil {
log.Error("Failed to build payload", "err", err)
return nil, err
Expand Down
7 changes: 6 additions & 1 deletion miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ func (miner *Miner) SetGasTip(tip *big.Int) error {

// BuildPayload builds the payload according to the provided parameters.
func (miner *Miner) BuildPayload(args *BuildPayloadArgs) (*Payload, error) {
return miner.buildPayload(args)
return miner.buildPayload(args, nil)
}

// BuildPayloadWithExtraData builds the payload according to the provided parameters and extra data.
func (miner *Miner) BuildPayloadWithExtraData(args *BuildPayloadArgs, extra []byte) (*Payload, error) {
return miner.buildPayload(args, extra)
}

// getPending retrieves the pending block based on the current head block.
Expand Down
8 changes: 3 additions & 5 deletions miner/payload_building.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ type BuildPayloadArgs struct {
NoTxPool bool // Optimism addition: option to disable tx pool contents from being included
Transactions []*types.Transaction // Optimism addition: txs forced into the block via engine API
GasLimit *uint64 // Optimism addition: override gas limit of the block to build

ExtraData []byte // Flashbots addition: extra data to include in the block
}

// Id computes an 8-byte identifier by hashing the components of the payload arguments.
Expand Down Expand Up @@ -246,7 +244,7 @@ func (payload *Payload) stopBuilding() {
}

// buildPayload builds the payload according to the provided parameters.
func (miner *Miner) buildPayload(args *BuildPayloadArgs) (*Payload, error) {
func (miner *Miner) buildPayload(args *BuildPayloadArgs, extraData []byte) (*Payload, error) {
if args.NoTxPool { // don't start the background payload updating job if there is no tx pool to pull from
// Build the initial version with no transaction included. It should be fast
// enough to run. The empty payload can at least make sure there is something
Expand All @@ -263,7 +261,7 @@ func (miner *Miner) buildPayload(args *BuildPayloadArgs) (*Payload, error) {
noTxs: true,
txs: args.Transactions,
gasLimit: args.GasLimit,
extraData: args.ExtraData,
extraData: extraData,
}
empty := miner.generateWork(emptyParams)
if empty.err != nil {
Expand All @@ -288,7 +286,7 @@ func (miner *Miner) buildPayload(args *BuildPayloadArgs) (*Payload, error) {
noTxs: false,
txs: args.Transactions,
gasLimit: args.GasLimit,
extraData: args.ExtraData,
extraData: extraData,
}

// Since we skip building the empty block when using the tx pool, we need to explicitly
Expand Down

0 comments on commit a5fecec

Please sign in to comment.