diff --git a/beacon/engine/gen_ed.go b/beacon/engine/gen_ed.go index 0ae5a3b8f1..e90ad6af81 100644 --- a/beacon/engine/gen_ed.go +++ b/beacon/engine/gen_ed.go @@ -35,6 +35,7 @@ func (e ExecutableData) MarshalJSON() ([]byte, error) { BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed"` ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas"` ExecutionWitness *types.ExecutionWitness `json:"executionWitness,omitempty"` + ProofVersion *uint8 `json:"proofVersion"` } var enc ExecutableData enc.ParentHash = e.ParentHash @@ -60,6 +61,7 @@ func (e ExecutableData) MarshalJSON() ([]byte, error) { enc.BlobGasUsed = (*hexutil.Uint64)(e.BlobGasUsed) enc.ExcessBlobGas = (*hexutil.Uint64)(e.ExcessBlobGas) enc.ExecutionWitness = e.ExecutionWitness + enc.ProofVersion = e.ProofVersion return json.Marshal(&enc) } @@ -84,6 +86,7 @@ func (e *ExecutableData) UnmarshalJSON(input []byte) error { BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed"` ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas"` ExecutionWitness *types.ExecutionWitness `json:"executionWitness,omitempty"` + ProofVersion *uint8 `json:"proofVersion"` } var dec ExecutableData if err := json.Unmarshal(input, &dec); err != nil { @@ -160,5 +163,8 @@ func (e *ExecutableData) UnmarshalJSON(input []byte) error { if dec.ExecutionWitness != nil { e.ExecutionWitness = dec.ExecutionWitness } + if dec.ProofVersion != nil { + e.ProofVersion = dec.ProofVersion + } return nil } diff --git a/beacon/engine/types.go b/beacon/engine/types.go index f91e18c27b..3984645f3e 100644 --- a/beacon/engine/types.go +++ b/beacon/engine/types.go @@ -77,6 +77,7 @@ type ExecutableData struct { BlobGasUsed *uint64 `json:"blobGasUsed"` ExcessBlobGas *uint64 `json:"excessBlobGas"` ExecutionWitness *types.ExecutionWitness `json:"executionWitness,omitempty"` + ProofVersion *uint8 `json:"proofVersion"` } // JSON type overrides for executableData. @@ -306,6 +307,11 @@ func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.H // BlockToExecutableData constructs the ExecutableData structure by filling the // 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, requests [][]byte) *ExecutionPayloadEnvelope { + proofVersion := uint8(0) + // TODO: could be more strict + if len(sidecars) > 0 && len(sidecars[0].Proofs) != len(sidecars[0].Blobs) { + proofVersion = 1 + } data := &ExecutableData{ BlockHash: block.Hash(), ParentHash: block.ParentHash(), @@ -325,6 +331,7 @@ func BlockToExecutableData(block *types.Block, fees *big.Int, sidecars []*types. BlobGasUsed: block.BlobGasUsed(), ExcessBlobGas: block.ExcessBlobGas(), ExecutionWitness: block.ExecutionWitness(), + ProofVersion: &proofVersion, } // Add blobs.