-
Notifications
You must be signed in to change notification settings - Fork 20.9k
beacon/engine: strip type byte in requests #30576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,26 +69,28 @@ func (args *BuildPayloadArgs) Id() engine.PayloadID { | |
// the revenue. Therefore, the empty-block here is always available and full-block | ||
// will be set/updated afterwards. | ||
type Payload struct { | ||
id engine.PayloadID | ||
empty *types.Block | ||
emptyWitness *stateless.Witness | ||
full *types.Block | ||
fullWitness *stateless.Witness | ||
sidecars []*types.BlobTxSidecar | ||
requests [][]byte | ||
fullFees *big.Int | ||
stop chan struct{} | ||
lock sync.Mutex | ||
cond *sync.Cond | ||
id engine.PayloadID | ||
empty *types.Block | ||
emptyWitness *stateless.Witness | ||
full *types.Block | ||
fullWitness *stateless.Witness | ||
sidecars []*types.BlobTxSidecar | ||
emptyRequests [][]byte | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This " There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We keep two blocks here, the 'empty' one without transactions, and one with. The emptyRequests are needed because there has to be an item for each request type even when there are no requests. |
||
requests [][]byte | ||
fullFees *big.Int | ||
stop chan struct{} | ||
lock sync.Mutex | ||
cond *sync.Cond | ||
} | ||
|
||
// newPayload initializes the payload object. | ||
func newPayload(empty *types.Block, witness *stateless.Witness, id engine.PayloadID) *Payload { | ||
func newPayload(empty *types.Block, emptyRequests [][]byte, witness *stateless.Witness, id engine.PayloadID) *Payload { | ||
payload := &Payload{ | ||
id: id, | ||
empty: empty, | ||
emptyWitness: witness, | ||
stop: make(chan struct{}), | ||
id: id, | ||
empty: empty, | ||
emptyRequests: emptyRequests, | ||
emptyWitness: witness, | ||
stop: make(chan struct{}), | ||
} | ||
log.Info("Starting work on payload", "id", payload.id) | ||
payload.cond = sync.NewCond(&payload.lock) | ||
|
@@ -143,16 +145,14 @@ func (payload *Payload) Resolve() *engine.ExecutionPayloadEnvelope { | |
close(payload.stop) | ||
} | ||
if payload.full != nil { | ||
envelope := engine.BlockToExecutableData(payload.full, payload.fullFees, payload.sidecars) | ||
envelope.Requests = payload.requests | ||
envelope := engine.BlockToExecutableData(payload.full, payload.fullFees, payload.sidecars, payload.emptyRequests) | ||
if payload.fullWitness != nil { | ||
envelope.Witness = new(hexutil.Bytes) | ||
*envelope.Witness, _ = rlp.EncodeToBytes(payload.fullWitness) // cannot fail | ||
} | ||
return envelope | ||
} | ||
envelope := engine.BlockToExecutableData(payload.empty, big.NewInt(0), nil) | ||
envelope.Requests = payload.requests | ||
envelope := engine.BlockToExecutableData(payload.empty, big.NewInt(0), nil, payload.emptyRequests) | ||
if payload.emptyWitness != nil { | ||
envelope.Witness = new(hexutil.Bytes) | ||
*envelope.Witness, _ = rlp.EncodeToBytes(payload.emptyWitness) // cannot fail | ||
|
@@ -166,8 +166,7 @@ func (payload *Payload) ResolveEmpty() *engine.ExecutionPayloadEnvelope { | |
payload.lock.Lock() | ||
defer payload.lock.Unlock() | ||
|
||
envelope := engine.BlockToExecutableData(payload.empty, big.NewInt(0), nil) | ||
envelope.Requests = payload.requests | ||
envelope := engine.BlockToExecutableData(payload.empty, big.NewInt(0), nil, payload.emptyRequests) | ||
if payload.emptyWitness != nil { | ||
envelope.Witness = new(hexutil.Bytes) | ||
*envelope.Witness, _ = rlp.EncodeToBytes(payload.emptyWitness) // cannot fail | ||
|
@@ -198,8 +197,7 @@ func (payload *Payload) ResolveFull() *engine.ExecutionPayloadEnvelope { | |
default: | ||
close(payload.stop) | ||
} | ||
envelope := engine.BlockToExecutableData(payload.full, payload.fullFees, payload.sidecars) | ||
envelope.Requests = payload.requests | ||
envelope := engine.BlockToExecutableData(payload.full, payload.fullFees, payload.sidecars, payload.requests) | ||
if payload.fullWitness != nil { | ||
envelope.Witness = new(hexutil.Bytes) | ||
*envelope.Witness, _ = rlp.EncodeToBytes(payload.fullWitness) // cannot fail | ||
|
@@ -227,7 +225,7 @@ func (miner *Miner) buildPayload(args *BuildPayloadArgs, witness bool) (*Payload | |
return nil, empty.err | ||
} | ||
// Construct a payload object for return. | ||
payload := newPayload(empty.block, empty.witness, args.Id()) | ||
payload := newPayload(empty.block, empty.requests, empty.witness, args.Id()) | ||
|
||
// Spin up a routine for updating the payload in background. This strategy | ||
// can maximum the revenue for including transactions with highest fee. | ||
|
Uh oh!
There was an error while loading. Please reload this page.