mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 05:47:59 -05:00
Add request hash to header for builder: executable data to block (#14955)
* Add request hash to header for builder: executable data to block * go fmt
This commit is contained in:
3
changelog/tt_add_block_hash.md
Normal file
3
changelog/tt_add_block_hash.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Added
|
||||
|
||||
- Add request hash to header for builder: executable data to block
|
||||
@@ -955,7 +955,7 @@ func unmarshalRPCObject(b []byte) (*jsonRPCObject, error) {
|
||||
}
|
||||
|
||||
func modifyExecutionPayload(execPayload engine.ExecutableData, fees *big.Int, prevBeaconRoot []byte, requests [][]byte) (*engine.ExecutionPayloadEnvelope, error) {
|
||||
modifiedBlock, err := executableDataToBlock(execPayload, prevBeaconRoot)
|
||||
modifiedBlock, err := executableDataToBlock(execPayload, prevBeaconRoot, requests)
|
||||
if err != nil {
|
||||
return &engine.ExecutionPayloadEnvelope{}, err
|
||||
}
|
||||
@@ -963,7 +963,7 @@ func modifyExecutionPayload(execPayload engine.ExecutableData, fees *big.Int, pr
|
||||
}
|
||||
|
||||
// This modifies the provided payload to imprint the builder's extra data
|
||||
func executableDataToBlock(params engine.ExecutableData, prevBeaconRoot []byte) (*gethTypes.Block, error) {
|
||||
func executableDataToBlock(params engine.ExecutableData, prevBeaconRoot []byte, requests [][]byte) (*gethTypes.Block, error) {
|
||||
txs, err := decodeTransactions(params.Transactions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -977,6 +977,12 @@ func executableDataToBlock(params engine.ExecutableData, prevBeaconRoot []byte)
|
||||
withdrawalsRoot = &h
|
||||
}
|
||||
|
||||
var requestsHash *common.Hash
|
||||
if requests != nil {
|
||||
h := gethTypes.CalcRequestsHash(requests)
|
||||
requestsHash = &h
|
||||
}
|
||||
|
||||
header := &gethTypes.Header{
|
||||
ParentHash: params.ParentHash,
|
||||
UncleHash: gethTypes.EmptyUncleHash,
|
||||
@@ -996,7 +1002,9 @@ func executableDataToBlock(params engine.ExecutableData, prevBeaconRoot []byte)
|
||||
WithdrawalsHash: withdrawalsRoot,
|
||||
BlobGasUsed: params.BlobGasUsed,
|
||||
ExcessBlobGas: params.ExcessBlobGas,
|
||||
RequestsHash: requestsHash,
|
||||
}
|
||||
|
||||
if prevBeaconRoot != nil {
|
||||
pRoot := common.Hash(prevBeaconRoot)
|
||||
header.ParentBeaconRoot = &pRoot
|
||||
|
||||
Reference in New Issue
Block a user