mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 21:38:05 -05:00
Remove Unused Block Setter (#11889)
* remove methods * remove mock Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -16,25 +16,6 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v3/testing/require"
|
||||
)
|
||||
|
||||
func Test_SignedBeaconBlock_SetBlock(t *testing.T) {
|
||||
b := ð.BeaconBlockCapella{Slot: 1, Body: ð.BeaconBlockBodyCapella{ExecutionPayload: &pb.ExecutionPayloadCapella{}}}
|
||||
wb, err := NewBeaconBlock(b)
|
||||
require.NoError(t, err)
|
||||
wsb, err := NewSignedBeaconBlock(ð.SignedBeaconBlockCapella{
|
||||
Block: ð.BeaconBlockCapella{StateRoot: bytesutil.PadTo([]byte("stateroot"), 32),
|
||||
ParentRoot: bytesutil.PadTo([]byte("parent"), 32),
|
||||
Body: ð.BeaconBlockBodyCapella{
|
||||
RandaoReveal: make([]byte, fieldparams.BLSSignatureLength),
|
||||
Graffiti: make([]byte, fieldparams.RootLength),
|
||||
ExecutionPayload: &pb.ExecutionPayloadCapella{},
|
||||
}},
|
||||
Signature: make([]byte, fieldparams.BLSSignatureLength),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, wsb.SetBlock(wb))
|
||||
require.DeepEqual(t, wsb.Block(), wb)
|
||||
}
|
||||
|
||||
func Test_BeaconBlockIsNil(t *testing.T) {
|
||||
t.Run("not nil", func(t *testing.T) {
|
||||
assert.NoError(t, BeaconBlockIsNil(&SignedBeaconBlock{block: &BeaconBlock{body: &BeaconBlockBody{}}}))
|
||||
|
||||
@@ -13,53 +13,6 @@ func (b *SignedBeaconBlock) SetSignature(sig []byte) {
|
||||
copy(b.signature[:], sig)
|
||||
}
|
||||
|
||||
// SetBlock sets the underlying beacon block object.
|
||||
// This function is not thread safe, it is only used during block creation.
|
||||
func (b *SignedBeaconBlock) SetBlock(blk interfaces.BeaconBlock) error {
|
||||
copied, err := blk.Copy()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.block.slot = copied.Slot()
|
||||
b.block.parentRoot = copied.ParentRoot()
|
||||
b.block.stateRoot = copied.StateRoot()
|
||||
b.block.proposerIndex = copied.ProposerIndex()
|
||||
b.block.body.randaoReveal = copied.Body().RandaoReveal()
|
||||
b.block.body.eth1Data = copied.Body().Eth1Data()
|
||||
b.block.body.graffiti = copied.Body().Graffiti()
|
||||
b.block.body.proposerSlashings = copied.Body().ProposerSlashings()
|
||||
b.block.body.attesterSlashings = copied.Body().AttesterSlashings()
|
||||
b.block.body.attestations = copied.Body().Attestations()
|
||||
b.block.body.deposits = copied.Body().Deposits()
|
||||
b.block.body.voluntaryExits = copied.Body().VoluntaryExits()
|
||||
if b.version >= version.Altair {
|
||||
syncAggregate, err := copied.Body().SyncAggregate()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.block.body.syncAggregate = syncAggregate
|
||||
}
|
||||
if b.version >= version.Bellatrix {
|
||||
executionData, err := copied.Body().Execution()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if b.block.body.isBlinded {
|
||||
b.block.body.executionPayloadHeader = executionData
|
||||
} else {
|
||||
b.block.body.executionPayload = executionData
|
||||
}
|
||||
}
|
||||
if b.version >= version.Capella {
|
||||
changes, err := copied.Body().BLSToExecutionChanges()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.block.body.blsToExecutionChanges = changes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetSlot sets the respective slot of the block.
|
||||
// This function is not thread safe, it is only used during block creation.
|
||||
func (b *BeaconBlock) SetSlot(slot types.Slot) {
|
||||
|
||||
@@ -14,7 +14,6 @@ import (
|
||||
// a signed beacon block.
|
||||
type SignedBeaconBlock interface {
|
||||
Block() BeaconBlock
|
||||
SetBlock(BeaconBlock) error
|
||||
Signature() [field_params.BLSSignatureLength]byte
|
||||
SetSignature(sig []byte)
|
||||
IsNil() bool
|
||||
|
||||
@@ -22,10 +22,6 @@ func (m SignedBeaconBlock) Block() interfaces.BeaconBlock {
|
||||
return m.BeaconBlock
|
||||
}
|
||||
|
||||
func (SignedBeaconBlock) SetBlock(interfaces.BeaconBlock) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (SignedBeaconBlock) Signature() [field_params.BLSSignatureLength]byte {
|
||||
panic("implement me")
|
||||
}
|
||||
@@ -113,22 +109,6 @@ func (BeaconBlock) AsSignRequestObject() (validatorpb.SignRequestObject, error)
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlock) Copy() (interfaces.BeaconBlock, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlock) SetSlot(types.Slot) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlock) SetProposerIndex(types.ValidatorIndex) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlock) SetParentRoot([]byte) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (m BeaconBlock) HashTreeRoot() ([field_params.RootLength]byte, error) {
|
||||
return m.Htr, m.HtrErr
|
||||
}
|
||||
@@ -161,10 +141,6 @@ func (BeaconBlock) IsBlinded() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (BeaconBlock) SetBlinded(bool) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlock) Proto() (proto.Message, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
@@ -193,13 +169,33 @@ func (BeaconBlock) Version() int {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
type BeaconBlockBody struct{}
|
||||
|
||||
func (BeaconBlockBody) RandaoReveal() [field_params.BLSSignatureLength]byte {
|
||||
func (BeaconBlock) ToBlinded() (interfaces.BeaconBlock, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) SetRandaoReveal([]byte) {
|
||||
func (BeaconBlock) SetSlot(_ types.Slot) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlock) SetProposerIndex(_ types.ValidatorIndex) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlock) SetParentRoot(_ []byte) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlock) SetBlinded(_ bool) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlock) Copy() (interfaces.BeaconBlock, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
type BeaconBlockBody struct{}
|
||||
|
||||
func (BeaconBlockBody) RandaoReveal() [field_params.BLSSignatureLength]byte {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
@@ -207,66 +203,34 @@ func (BeaconBlockBody) Eth1Data() *eth.Eth1Data {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) SetEth1Data(*eth.Eth1Data) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) Graffiti() [field_params.RootLength]byte {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) SetGraffiti([]byte) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) ProposerSlashings() []*eth.ProposerSlashing {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) SetProposerSlashings([]*eth.ProposerSlashing) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) AttesterSlashings() []*eth.AttesterSlashing {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) SetAttesterSlashings([]*eth.AttesterSlashing) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) Attestations() []*eth.Attestation {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) SetAttestations([]*eth.Attestation) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) Deposits() []*eth.Deposit {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) SetDeposits([]*eth.Deposit) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) VoluntaryExits() []*eth.SignedVoluntaryExit {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) SetVoluntaryExits([]*eth.SignedVoluntaryExit) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) SyncAggregate() (*eth.SyncAggregate, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) SetSyncAggregate(*eth.SyncAggregate) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) IsNil() bool {
|
||||
return false
|
||||
}
|
||||
@@ -283,22 +247,58 @@ func (BeaconBlockBody) Execution() (interfaces.ExecutionData, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) SetExecution(interfaces.ExecutionData) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) BLSToExecutionChanges() ([]*eth.SignedBLSToExecutionChange, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) SetBLSToExecutionChanges([]*eth.SignedBLSToExecutionChange) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (b *BeaconBlock) SetStateRoot(root []byte) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (b *BeaconBlockBody) SetRandaoReveal([]byte) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (b *BeaconBlockBody) SetEth1Data(*eth.Eth1Data) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (b *BeaconBlockBody) SetGraffiti([]byte) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (b *BeaconBlockBody) SetProposerSlashings([]*eth.ProposerSlashing) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (b *BeaconBlockBody) SetAttesterSlashings([]*eth.AttesterSlashing) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (b *BeaconBlockBody) SetAttestations([]*eth.Attestation) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (b *BeaconBlockBody) SetDeposits([]*eth.Deposit) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (b *BeaconBlockBody) SetVoluntaryExits([]*eth.SignedVoluntaryExit) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (b *BeaconBlockBody) SetSyncAggregate(*eth.SyncAggregate) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (b *BeaconBlockBody) SetExecution(interfaces.ExecutionData) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (b *BeaconBlockBody) SetBLSToExecutionChanges([]*eth.SignedBLSToExecutionChange) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
var _ interfaces.SignedBeaconBlock = &SignedBeaconBlock{}
|
||||
var _ interfaces.BeaconBlock = &BeaconBlock{}
|
||||
var _ interfaces.BeaconBlockBody = &BeaconBlockBody{}
|
||||
|
||||
Reference in New Issue
Block a user