mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-23 00:09:26 +00:00
Adds a fast path for ExecutionPayloadEnvelope and BlobAndProofListV* that bypasses encoding/json's reflection and re-validation, which are expensive for large payloads with many blobs. Also hand-rolls the jsonrpcMessage wire encoding in the RPC codec to avoid a second re-validation pass when writing responses to the connection. Resolves #33814 --------- Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Felix Lange <fjl@twurst.com>
53 lines
1.5 KiB
Go
53 lines
1.5 KiB
Go
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
|
|
|
package engine
|
|
|
|
import (
|
|
"encoding/json"
|
|
"errors"
|
|
"math/big"
|
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
)
|
|
|
|
var _ = (*executionPayloadEnvelopeMarshaling)(nil)
|
|
|
|
// UnmarshalJSON unmarshals from JSON.
|
|
func (e *ExecutionPayloadEnvelope) UnmarshalJSON(input []byte) error {
|
|
type ExecutionPayloadEnvelope struct {
|
|
ExecutionPayload *ExecutableData `json:"executionPayload" gencodec:"required"`
|
|
BlockValue *hexutil.Big `json:"blockValue" gencodec:"required"`
|
|
BlobsBundle *BlobsBundle `json:"blobsBundle"`
|
|
Requests []hexutil.Bytes `json:"executionRequests"`
|
|
Override *bool `json:"shouldOverrideBuilder"`
|
|
Witness *hexutil.Bytes `json:"witness,omitempty"`
|
|
}
|
|
var dec ExecutionPayloadEnvelope
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
return err
|
|
}
|
|
if dec.ExecutionPayload == nil {
|
|
return errors.New("missing required field 'executionPayload' for ExecutionPayloadEnvelope")
|
|
}
|
|
e.ExecutionPayload = dec.ExecutionPayload
|
|
if dec.BlockValue == nil {
|
|
return errors.New("missing required field 'blockValue' for ExecutionPayloadEnvelope")
|
|
}
|
|
e.BlockValue = (*big.Int)(dec.BlockValue)
|
|
if dec.BlobsBundle != nil {
|
|
e.BlobsBundle = dec.BlobsBundle
|
|
}
|
|
if dec.Requests != nil {
|
|
e.Requests = make([][]byte, len(dec.Requests))
|
|
for k, v := range dec.Requests {
|
|
e.Requests[k] = v
|
|
}
|
|
}
|
|
if dec.Override != nil {
|
|
e.Override = *dec.Override
|
|
}
|
|
if dec.Witness != nil {
|
|
e.Witness = dec.Witness
|
|
}
|
|
return nil
|
|
}
|