Proposer use highest value payload vs header (#11967)

This commit is contained in:
terencechain
2023-02-10 11:36:19 -08:00
committed by GitHub
parent 81b29ea2d8
commit e136e10ebb
27 changed files with 637 additions and 335 deletions

View File

@@ -3,6 +3,7 @@ package blocks
import (
"bytes"
"errors"
"math/big"
fastssz "github.com/prysmaticlabs/fastssz"
fieldparams "github.com/prysmaticlabs/prysm/v3/config/fieldparams"
@@ -165,6 +166,11 @@ func (executionPayload) PbCapella() (*enginev1.ExecutionPayloadCapella, error) {
return nil, ErrUnsupportedGetter
}
// Value --
func (executionPayload) Value() (*big.Int, error) {
return nil, ErrUnsupportedGetter
}
// executionPayloadHeader is a convenience wrapper around a blinded beacon block body's execution header data structure
// This wrapper allows us to conform to a common interface so that beacon
// blocks for future forks can also be applied across Prysm without issues.
@@ -316,6 +322,11 @@ func (executionPayloadHeader) PbBellatrix() (*enginev1.ExecutionPayload, error)
return nil, ErrUnsupportedGetter
}
// Value --
func (executionPayloadHeader) Value() (*big.Int, error) {
return nil, ErrUnsupportedGetter
}
// PayloadToHeader converts `payload` into execution payload header format.
func PayloadToHeader(payload interfaces.ExecutionData) (*enginev1.ExecutionPayloadHeader, error) {
txs, err := payload.Transactions()
@@ -348,12 +359,13 @@ func PayloadToHeader(payload interfaces.ExecutionData) (*enginev1.ExecutionPaylo
// This wrapper allows us to conform to a common interface so that beacon
// blocks for future forks can also be applied across Prysm without issues.
type executionPayloadCapella struct {
p *enginev1.ExecutionPayloadCapella
p *enginev1.ExecutionPayloadCapella
value *big.Int
}
// WrappedExecutionPayloadCapella is a constructor which wraps a protobuf execution payload into an interface.
func WrappedExecutionPayloadCapella(p *enginev1.ExecutionPayloadCapella) (interfaces.ExecutionData, error) {
w := executionPayloadCapella{p: p}
func WrappedExecutionPayloadCapella(p *enginev1.ExecutionPayloadCapella, value *big.Int) (interfaces.ExecutionData, error) {
w := executionPayloadCapella{p: p, value: value}
if w.IsNil() {
return nil, ErrNilObjectWrapped
}
@@ -495,16 +507,22 @@ func (executionPayloadCapella) PbBellatrix() (*enginev1.ExecutionPayload, error)
return nil, ErrUnsupportedGetter
}
// Value --
func (e executionPayloadCapella) Value() (*big.Int, error) {
return e.value, nil
}
// executionPayloadHeaderCapella is a convenience wrapper around a blinded beacon block body's execution header data structure
// This wrapper allows us to conform to a common interface so that beacon
// blocks for future forks can also be applied across Prysm without issues.
type executionPayloadHeaderCapella struct {
p *enginev1.ExecutionPayloadHeaderCapella
p *enginev1.ExecutionPayloadHeaderCapella
value *big.Int
}
// WrappedExecutionPayloadHeaderCapella is a constructor which wraps a protobuf execution header into an interface.
func WrappedExecutionPayloadHeaderCapella(p *enginev1.ExecutionPayloadHeaderCapella) (interfaces.ExecutionData, error) {
w := executionPayloadHeaderCapella{p: p}
func WrappedExecutionPayloadHeaderCapella(p *enginev1.ExecutionPayloadHeaderCapella, value *big.Int) (interfaces.ExecutionData, error) {
w := executionPayloadHeaderCapella{p: p, value: value}
if w.IsNil() {
return nil, ErrNilObjectWrapped
}
@@ -646,6 +664,11 @@ func (executionPayloadHeaderCapella) PbBellatrix() (*enginev1.ExecutionPayload,
return nil, ErrUnsupportedGetter
}
// Value --
func (e executionPayloadHeaderCapella) Value() (*big.Int, error) {
return e.value, nil
}
// PayloadToHeaderCapella converts `payload` into execution payload header format.
func PayloadToHeaderCapella(payload interfaces.ExecutionData) (*enginev1.ExecutionPayloadHeaderCapella, error) {
txs, err := payload.Transactions()