@ -59,23 +59,24 @@ type payloadAttributesMarshaling struct {
// ExecutableData is the data necessary to execute an EL payload.
// ExecutableData is the data necessary to execute an EL payload.
type ExecutableData struct {
type ExecutableData struct {
ParentHash common . Hash ` json:"parentHash" gencodec:"required" `
ParentHash common . Hash ` json:"parentHash" gencodec:"required" `
FeeRecipient common . Address ` json:"feeRecipient" gencodec:"required" `
FeeRecipient common . Address ` json:"feeRecipient" gencodec:"required" `
StateRoot common . Hash ` json:"stateRoot" gencodec:"required" `
StateRoot common . Hash ` json:"stateRoot" gencodec:"required" `
ReceiptsRoot common . Hash ` json:"receiptsRoot" gencodec:"required" `
ReceiptsRoot common . Hash ` json:"receiptsRoot" gencodec:"required" `
LogsBloom [ ] byte ` json:"logsBloom" gencodec:"required" `
LogsBloom [ ] byte ` json:"logsBloom" gencodec:"required" `
Random common . Hash ` json:"prevRandao" gencodec:"required" `
Random common . Hash ` json:"prevRandao" gencodec:"required" `
Number uint64 ` json:"blockNumber" gencodec:"required" `
Number uint64 ` json:"blockNumber" gencodec:"required" `
GasLimit uint64 ` json:"gasLimit" gencodec:"required" `
GasLimit uint64 ` json:"gasLimit" gencodec:"required" `
GasUsed uint64 ` json:"gasUsed" gencodec:"required" `
GasUsed uint64 ` json:"gasUsed" gencodec:"required" `
Timestamp uint64 ` json:"timestamp" gencodec:"required" `
Timestamp uint64 ` json:"timestamp" gencodec:"required" `
ExtraData [ ] byte ` json:"extraData" gencodec:"required" `
ExtraData [ ] byte ` json:"extraData" gencodec:"required" `
BaseFeePerGas * big . Int ` json:"baseFeePerGas" gencodec:"required" `
BaseFeePerGas * big . Int ` json:"baseFeePerGas" gencodec:"required" `
BlockHash common . Hash ` json:"blockHash" gencodec:"required" `
BlockHash common . Hash ` json:"blockHash" gencodec:"required" `
Transactions [ ] [ ] byte ` json:"transactions" gencodec:"required" `
Transactions [ ] [ ] byte ` json:"transactions" gencodec:"required" `
Withdrawals [ ] * types . Withdrawal ` json:"withdrawals" `
Withdrawals [ ] * types . Withdrawal ` json:"withdrawals" `
BlobGasUsed * uint64 ` json:"blobGasUsed" `
BlobGasUsed * uint64 ` json:"blobGasUsed" `
ExcessBlobGas * uint64 ` json:"excessBlobGas" `
ExcessBlobGas * uint64 ` json:"excessBlobGas" `
ExecutionWitness * types . ExecutionWitness ` json:"executionWitness,omitempty" `
}
}
// JSON type overrides for executableData.
// JSON type overrides for executableData.
@ -251,7 +252,9 @@ func ExecutableDataToBlock(data ExecutableData, versionedHashes []common.Hash, b
BlobGasUsed : data . BlobGasUsed ,
BlobGasUsed : data . BlobGasUsed ,
ParentBeaconRoot : beaconRoot ,
ParentBeaconRoot : beaconRoot ,
}
}
block := types . NewBlockWithHeader ( header ) . WithBody ( types . Body { Transactions : txs , Uncles : nil , Withdrawals : data . Withdrawals } )
block := types . NewBlockWithHeader ( header )
block = block . WithBody ( types . Body { Transactions : txs , Uncles : nil , Withdrawals : data . Withdrawals } )
block = block . WithWitness ( data . ExecutionWitness )
if block . Hash ( ) != data . BlockHash {
if block . Hash ( ) != data . BlockHash {
return nil , fmt . Errorf ( "blockhash mismatch, want %x, got %x" , data . BlockHash , block . Hash ( ) )
return nil , fmt . Errorf ( "blockhash mismatch, want %x, got %x" , data . BlockHash , block . Hash ( ) )
}
}
@ -262,23 +265,24 @@ func ExecutableDataToBlock(data ExecutableData, versionedHashes []common.Hash, b
// fields from the given block. It assumes the given block is post-merge block.
// fields from the given block. It assumes the given block is post-merge block.
func BlockToExecutableData ( block * types . Block , fees * big . Int , sidecars [ ] * types . BlobTxSidecar ) * ExecutionPayloadEnvelope {
func BlockToExecutableData ( block * types . Block , fees * big . Int , sidecars [ ] * types . BlobTxSidecar ) * ExecutionPayloadEnvelope {
data := & ExecutableData {
data := & ExecutableData {
BlockHash : block . Hash ( ) ,
BlockHash : block . Hash ( ) ,
ParentHash : block . ParentHash ( ) ,
ParentHash : block . ParentHash ( ) ,
FeeRecipient : block . Coinbase ( ) ,
FeeRecipient : block . Coinbase ( ) ,
StateRoot : block . Root ( ) ,
StateRoot : block . Root ( ) ,
Number : block . NumberU64 ( ) ,
Number : block . NumberU64 ( ) ,
GasLimit : block . GasLimit ( ) ,
GasLimit : block . GasLimit ( ) ,
GasUsed : block . GasUsed ( ) ,
GasUsed : block . GasUsed ( ) ,
BaseFeePerGas : block . BaseFee ( ) ,
BaseFeePerGas : block . BaseFee ( ) ,
Timestamp : block . Time ( ) ,
Timestamp : block . Time ( ) ,
ReceiptsRoot : block . ReceiptHash ( ) ,
ReceiptsRoot : block . ReceiptHash ( ) ,
LogsBloom : block . Bloom ( ) . Bytes ( ) ,
LogsBloom : block . Bloom ( ) . Bytes ( ) ,
Transactions : encodeTransactions ( block . Transactions ( ) ) ,
Transactions : encodeTransactions ( block . Transactions ( ) ) ,
Random : block . MixDigest ( ) ,
Random : block . MixDigest ( ) ,
ExtraData : block . Extra ( ) ,
ExtraData : block . Extra ( ) ,
Withdrawals : block . Withdrawals ( ) ,
Withdrawals : block . Withdrawals ( ) ,
BlobGasUsed : block . BlobGasUsed ( ) ,
BlobGasUsed : block . BlobGasUsed ( ) ,
ExcessBlobGas : block . ExcessBlobGas ( ) ,
ExcessBlobGas : block . ExcessBlobGas ( ) ,
ExecutionWitness : block . ExecutionWitness ( ) ,
}
}
bundle := BlobsBundleV1 {
bundle := BlobsBundleV1 {
Commitments : make ( [ ] hexutil . Bytes , 0 ) ,
Commitments : make ( [ ] hexutil . Bytes , 0 ) ,