mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 23:48:06 -05:00
moving cloner functions to beacon_block.go (#14265)
* moving cloner functions for beacon block and adding fuzzing tests * fixing test
This commit is contained in:
@@ -684,9 +684,9 @@ func TestService_AddPendingBlockToQueueOverMax(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
b := util.NewBeaconBlock()
|
b := util.NewBeaconBlock()
|
||||||
b1 := ethpb.CopySignedBeaconBlock(b)
|
b1 := b.Copy()
|
||||||
b1.Block.StateRoot = []byte{'a'}
|
b1.Block.StateRoot = []byte{'a'}
|
||||||
b2 := ethpb.CopySignedBeaconBlock(b)
|
b2 := b.Copy()
|
||||||
b2.Block.StateRoot = []byte{'b'}
|
b2.Block.StateRoot = []byte{'b'}
|
||||||
wsb, err := blocks.NewSignedBeaconBlock(b)
|
wsb, err := blocks.NewSignedBeaconBlock(b)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@@ -698,7 +698,7 @@ func TestService_AddPendingBlockToQueueOverMax(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NoError(t, r.insertBlockToPendingQueue(0, wsb, [32]byte{2}))
|
require.NoError(t, r.insertBlockToPendingQueue(0, wsb, [32]byte{2}))
|
||||||
|
|
||||||
b3 := ethpb.CopySignedBeaconBlock(b)
|
b3 := b.Copy()
|
||||||
b3.Block.StateRoot = []byte{'c'}
|
b3.Block.StateRoot = []byte{'c'}
|
||||||
wsb, err = blocks.NewSignedBeaconBlock(b2)
|
wsb, err = blocks.NewSignedBeaconBlock(b2)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|||||||
@@ -52,40 +52,29 @@ func (b *SignedBeaconBlock) Copy() (interfaces.SignedBeaconBlock, error) {
|
|||||||
}
|
}
|
||||||
switch b.version {
|
switch b.version {
|
||||||
case version.Phase0:
|
case version.Phase0:
|
||||||
cp := eth.CopySignedBeaconBlock(pb.(*eth.SignedBeaconBlock))
|
return initSignedBlockFromProtoPhase0(pb.(*eth.SignedBeaconBlock).Copy())
|
||||||
return initSignedBlockFromProtoPhase0(cp)
|
|
||||||
case version.Altair:
|
case version.Altair:
|
||||||
cp := eth.CopySignedBeaconBlockAltair(pb.(*eth.SignedBeaconBlockAltair))
|
return initSignedBlockFromProtoAltair(pb.(*eth.SignedBeaconBlockAltair).Copy())
|
||||||
return initSignedBlockFromProtoAltair(cp)
|
|
||||||
case version.Bellatrix:
|
case version.Bellatrix:
|
||||||
if b.IsBlinded() {
|
if b.IsBlinded() {
|
||||||
cp := eth.CopySignedBlindedBeaconBlockBellatrix(pb.(*eth.SignedBlindedBeaconBlockBellatrix))
|
return initBlindedSignedBlockFromProtoBellatrix(pb.(*eth.SignedBlindedBeaconBlockBellatrix).Copy())
|
||||||
return initBlindedSignedBlockFromProtoBellatrix(cp)
|
|
||||||
}
|
}
|
||||||
cp := eth.CopySignedBeaconBlockBellatrix(pb.(*eth.SignedBeaconBlockBellatrix))
|
return initSignedBlockFromProtoBellatrix(pb.(*eth.SignedBeaconBlockBellatrix).Copy())
|
||||||
return initSignedBlockFromProtoBellatrix(cp)
|
|
||||||
case version.Capella:
|
case version.Capella:
|
||||||
if b.IsBlinded() {
|
if b.IsBlinded() {
|
||||||
cp := eth.CopySignedBlindedBeaconBlockCapella(pb.(*eth.SignedBlindedBeaconBlockCapella))
|
return initBlindedSignedBlockFromProtoCapella(pb.(*eth.SignedBlindedBeaconBlockCapella).Copy())
|
||||||
return initBlindedSignedBlockFromProtoCapella(cp)
|
|
||||||
}
|
}
|
||||||
cp := eth.CopySignedBeaconBlockCapella(pb.(*eth.SignedBeaconBlockCapella))
|
return initSignedBlockFromProtoCapella(pb.(*eth.SignedBeaconBlockCapella).Copy())
|
||||||
return initSignedBlockFromProtoCapella(cp)
|
|
||||||
case version.Deneb:
|
case version.Deneb:
|
||||||
if b.IsBlinded() {
|
if b.IsBlinded() {
|
||||||
cp := eth.CopySignedBlindedBeaconBlockDeneb(pb.(*eth.SignedBlindedBeaconBlockDeneb))
|
return initBlindedSignedBlockFromProtoDeneb(pb.(*eth.SignedBlindedBeaconBlockDeneb).Copy())
|
||||||
return initBlindedSignedBlockFromProtoDeneb(cp)
|
|
||||||
}
|
}
|
||||||
cp := eth.CopySignedBeaconBlockDeneb(pb.(*eth.SignedBeaconBlockDeneb))
|
return initSignedBlockFromProtoDeneb(pb.(*eth.SignedBeaconBlockDeneb).Copy())
|
||||||
return initSignedBlockFromProtoDeneb(cp)
|
|
||||||
case version.Electra:
|
case version.Electra:
|
||||||
if b.IsBlinded() {
|
if b.IsBlinded() {
|
||||||
cp := eth.CopySignedBlindedBeaconBlockElectra(pb.(*eth.SignedBlindedBeaconBlockElectra))
|
return initBlindedSignedBlockFromProtoElectra(pb.(*eth.SignedBlindedBeaconBlockElectra).Copy())
|
||||||
return initBlindedSignedBlockFromProtoElectra(cp)
|
|
||||||
}
|
}
|
||||||
cp := eth.CopySignedBeaconBlockElectra(pb.(*eth.SignedBeaconBlockElectra))
|
return initSignedBlockFromProtoElectra(pb.(*eth.SignedBeaconBlockElectra).Copy())
|
||||||
return initSignedBlockFromProtoElectra(cp)
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nil, errIncorrectBlockVersion
|
return nil, errIncorrectBlockVersion
|
||||||
}
|
}
|
||||||
@@ -972,39 +961,29 @@ func (b *BeaconBlock) Copy() (interfaces.ReadOnlyBeaconBlock, error) {
|
|||||||
}
|
}
|
||||||
switch b.version {
|
switch b.version {
|
||||||
case version.Phase0:
|
case version.Phase0:
|
||||||
cp := eth.CopyBeaconBlock(pb.(*eth.BeaconBlock))
|
return initBlockFromProtoPhase0(pb.(*eth.BeaconBlock).Copy())
|
||||||
return initBlockFromProtoPhase0(cp)
|
|
||||||
case version.Altair:
|
case version.Altair:
|
||||||
cp := eth.CopyBeaconBlockAltair(pb.(*eth.BeaconBlockAltair))
|
return initBlockFromProtoAltair(pb.(*eth.BeaconBlockAltair).Copy())
|
||||||
return initBlockFromProtoAltair(cp)
|
|
||||||
case version.Bellatrix:
|
case version.Bellatrix:
|
||||||
if b.IsBlinded() {
|
if b.IsBlinded() {
|
||||||
cp := eth.CopyBlindedBeaconBlockBellatrix(pb.(*eth.BlindedBeaconBlockBellatrix))
|
return initBlindedBlockFromProtoBellatrix(pb.(*eth.BlindedBeaconBlockBellatrix).Copy())
|
||||||
return initBlindedBlockFromProtoBellatrix(cp)
|
|
||||||
}
|
}
|
||||||
cp := eth.CopyBeaconBlockBellatrix(pb.(*eth.BeaconBlockBellatrix))
|
return initBlockFromProtoBellatrix(pb.(*eth.BeaconBlockBellatrix).Copy())
|
||||||
return initBlockFromProtoBellatrix(cp)
|
|
||||||
case version.Capella:
|
case version.Capella:
|
||||||
if b.IsBlinded() {
|
if b.IsBlinded() {
|
||||||
cp := eth.CopyBlindedBeaconBlockCapella(pb.(*eth.BlindedBeaconBlockCapella))
|
return initBlindedBlockFromProtoCapella(pb.(*eth.BlindedBeaconBlockCapella).Copy())
|
||||||
return initBlindedBlockFromProtoCapella(cp)
|
|
||||||
}
|
}
|
||||||
cp := eth.CopyBeaconBlockCapella(pb.(*eth.BeaconBlockCapella))
|
return initBlockFromProtoCapella(pb.(*eth.BeaconBlockCapella).Copy())
|
||||||
return initBlockFromProtoCapella(cp)
|
|
||||||
case version.Deneb:
|
case version.Deneb:
|
||||||
if b.IsBlinded() {
|
if b.IsBlinded() {
|
||||||
cp := eth.CopyBlindedBeaconBlockDeneb(pb.(*eth.BlindedBeaconBlockDeneb))
|
return initBlindedBlockFromProtoDeneb(pb.(*eth.BlindedBeaconBlockDeneb).Copy())
|
||||||
return initBlindedBlockFromProtoDeneb(cp)
|
|
||||||
}
|
}
|
||||||
cp := eth.CopyBeaconBlockDeneb(pb.(*eth.BeaconBlockDeneb))
|
return initBlockFromProtoDeneb(pb.(*eth.BeaconBlockDeneb).Copy())
|
||||||
return initBlockFromProtoDeneb(cp)
|
|
||||||
case version.Electra:
|
case version.Electra:
|
||||||
if b.IsBlinded() {
|
if b.IsBlinded() {
|
||||||
cp := eth.CopyBlindedBeaconBlockElectra(pb.(*eth.BlindedBeaconBlockElectra))
|
return initBlindedBlockFromProtoElectra(pb.(*eth.BlindedBeaconBlockElectra).Copy())
|
||||||
return initBlindedBlockFromProtoElectra(cp)
|
|
||||||
}
|
}
|
||||||
cp := eth.CopyBeaconBlockElectra(pb.(*eth.BeaconBlockElectra))
|
return initBlockFromProtoElectra(pb.(*eth.BeaconBlockElectra).Copy())
|
||||||
return initBlockFromProtoElectra(cp)
|
|
||||||
default:
|
default:
|
||||||
return nil, errIncorrectBlockVersion
|
return nil, errIncorrectBlockVersion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,458 @@ package eth
|
|||||||
|
|
||||||
import "github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
|
import "github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (sigBlock *SignedBeaconBlock) Copy() *SignedBeaconBlock {
|
||||||
|
if sigBlock == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &SignedBeaconBlock{
|
||||||
|
Block: sigBlock.Block.Copy(),
|
||||||
|
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (block *BeaconBlock) Copy() *BeaconBlock {
|
||||||
|
if block == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BeaconBlock{
|
||||||
|
Slot: block.Slot,
|
||||||
|
ProposerIndex: block.ProposerIndex,
|
||||||
|
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
||||||
|
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
||||||
|
Body: block.Body.Copy(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (body *BeaconBlockBody) Copy() *BeaconBlockBody {
|
||||||
|
if body == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BeaconBlockBody{
|
||||||
|
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
||||||
|
Eth1Data: body.Eth1Data.Copy(),
|
||||||
|
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
||||||
|
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
||||||
|
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
||||||
|
Attestations: CopySlice(body.Attestations),
|
||||||
|
Deposits: CopySlice(body.Deposits),
|
||||||
|
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (sigBlock *SignedBeaconBlockAltair) Copy() *SignedBeaconBlockAltair {
|
||||||
|
if sigBlock == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &SignedBeaconBlockAltair{
|
||||||
|
Block: sigBlock.Block.Copy(),
|
||||||
|
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (block *BeaconBlockAltair) Copy() *BeaconBlockAltair {
|
||||||
|
if block == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BeaconBlockAltair{
|
||||||
|
Slot: block.Slot,
|
||||||
|
ProposerIndex: block.ProposerIndex,
|
||||||
|
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
||||||
|
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
||||||
|
Body: block.Body.Copy(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (body *BeaconBlockBodyAltair) Copy() *BeaconBlockBodyAltair {
|
||||||
|
if body == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BeaconBlockBodyAltair{
|
||||||
|
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
||||||
|
Eth1Data: body.Eth1Data.Copy(),
|
||||||
|
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
||||||
|
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
||||||
|
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
||||||
|
Attestations: CopySlice(body.Attestations),
|
||||||
|
Deposits: CopySlice(body.Deposits),
|
||||||
|
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
||||||
|
SyncAggregate: body.SyncAggregate.Copy(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (sigBlock *SignedBeaconBlockBellatrix) Copy() *SignedBeaconBlockBellatrix {
|
||||||
|
if sigBlock == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &SignedBeaconBlockBellatrix{
|
||||||
|
Block: sigBlock.Block.Copy(),
|
||||||
|
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (block *BeaconBlockBellatrix) Copy() *BeaconBlockBellatrix {
|
||||||
|
if block == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BeaconBlockBellatrix{
|
||||||
|
Slot: block.Slot,
|
||||||
|
ProposerIndex: block.ProposerIndex,
|
||||||
|
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
||||||
|
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
||||||
|
Body: block.Body.Copy(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (body *BeaconBlockBodyBellatrix) Copy() *BeaconBlockBodyBellatrix {
|
||||||
|
if body == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BeaconBlockBodyBellatrix{
|
||||||
|
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
||||||
|
Eth1Data: body.Eth1Data.Copy(),
|
||||||
|
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
||||||
|
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
||||||
|
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
||||||
|
Attestations: CopySlice(body.Attestations),
|
||||||
|
Deposits: CopySlice(body.Deposits),
|
||||||
|
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
||||||
|
SyncAggregate: body.SyncAggregate.Copy(),
|
||||||
|
ExecutionPayload: body.ExecutionPayload.Copy(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (sigBlock *SignedBeaconBlockCapella) Copy() *SignedBeaconBlockCapella {
|
||||||
|
if sigBlock == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &SignedBeaconBlockCapella{
|
||||||
|
Block: sigBlock.Block.Copy(),
|
||||||
|
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (block *BeaconBlockCapella) Copy() *BeaconBlockCapella {
|
||||||
|
if block == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BeaconBlockCapella{
|
||||||
|
Slot: block.Slot,
|
||||||
|
ProposerIndex: block.ProposerIndex,
|
||||||
|
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
||||||
|
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
||||||
|
Body: block.Body.Copy(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (body *BeaconBlockBodyCapella) Copy() *BeaconBlockBodyCapella {
|
||||||
|
if body == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BeaconBlockBodyCapella{
|
||||||
|
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
||||||
|
Eth1Data: body.Eth1Data.Copy(),
|
||||||
|
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
||||||
|
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
||||||
|
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
||||||
|
Attestations: CopySlice(body.Attestations),
|
||||||
|
Deposits: CopySlice(body.Deposits),
|
||||||
|
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
||||||
|
SyncAggregate: body.SyncAggregate.Copy(),
|
||||||
|
ExecutionPayload: body.ExecutionPayload.Copy(),
|
||||||
|
BlsToExecutionChanges: CopySlice(body.BlsToExecutionChanges),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (sigBlock *SignedBlindedBeaconBlockCapella) Copy() *SignedBlindedBeaconBlockCapella {
|
||||||
|
if sigBlock == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &SignedBlindedBeaconBlockCapella{
|
||||||
|
Block: sigBlock.Block.Copy(),
|
||||||
|
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (block *BlindedBeaconBlockCapella) Copy() *BlindedBeaconBlockCapella {
|
||||||
|
if block == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BlindedBeaconBlockCapella{
|
||||||
|
Slot: block.Slot,
|
||||||
|
ProposerIndex: block.ProposerIndex,
|
||||||
|
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
||||||
|
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
||||||
|
Body: block.Body.Copy(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (body *BlindedBeaconBlockBodyCapella) Copy() *BlindedBeaconBlockBodyCapella {
|
||||||
|
if body == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BlindedBeaconBlockBodyCapella{
|
||||||
|
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
||||||
|
Eth1Data: body.Eth1Data.Copy(),
|
||||||
|
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
||||||
|
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
||||||
|
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
||||||
|
Attestations: CopySlice(body.Attestations),
|
||||||
|
Deposits: CopySlice(body.Deposits),
|
||||||
|
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
||||||
|
SyncAggregate: body.SyncAggregate.Copy(),
|
||||||
|
ExecutionPayloadHeader: body.ExecutionPayloadHeader.Copy(),
|
||||||
|
BlsToExecutionChanges: CopySlice(body.BlsToExecutionChanges),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (sigBlock *SignedBlindedBeaconBlockDeneb) Copy() *SignedBlindedBeaconBlockDeneb {
|
||||||
|
if sigBlock == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &SignedBlindedBeaconBlockDeneb{
|
||||||
|
Message: sigBlock.Message.Copy(),
|
||||||
|
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (block *BlindedBeaconBlockDeneb) Copy() *BlindedBeaconBlockDeneb {
|
||||||
|
if block == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BlindedBeaconBlockDeneb{
|
||||||
|
Slot: block.Slot,
|
||||||
|
ProposerIndex: block.ProposerIndex,
|
||||||
|
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
||||||
|
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
||||||
|
Body: block.Body.Copy(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (body *BlindedBeaconBlockBodyDeneb) Copy() *BlindedBeaconBlockBodyDeneb {
|
||||||
|
if body == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BlindedBeaconBlockBodyDeneb{
|
||||||
|
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
||||||
|
Eth1Data: body.Eth1Data.Copy(),
|
||||||
|
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
||||||
|
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
||||||
|
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
||||||
|
Attestations: CopySlice(body.Attestations),
|
||||||
|
Deposits: CopySlice(body.Deposits),
|
||||||
|
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
||||||
|
SyncAggregate: body.SyncAggregate.Copy(),
|
||||||
|
ExecutionPayloadHeader: body.ExecutionPayloadHeader.Copy(),
|
||||||
|
BlsToExecutionChanges: CopySlice(body.BlsToExecutionChanges),
|
||||||
|
BlobKzgCommitments: CopyBlobKZGs(body.BlobKzgCommitments),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (sigBlock *SignedBlindedBeaconBlockElectra) Copy() *SignedBlindedBeaconBlockElectra {
|
||||||
|
if sigBlock == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &SignedBlindedBeaconBlockElectra{
|
||||||
|
Message: sigBlock.Message.Copy(),
|
||||||
|
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (block *BlindedBeaconBlockElectra) Copy() *BlindedBeaconBlockElectra {
|
||||||
|
if block == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BlindedBeaconBlockElectra{
|
||||||
|
Slot: block.Slot,
|
||||||
|
ProposerIndex: block.ProposerIndex,
|
||||||
|
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
||||||
|
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
||||||
|
Body: block.Body.Copy(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (body *BlindedBeaconBlockBodyElectra) Copy() *BlindedBeaconBlockBodyElectra {
|
||||||
|
if body == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BlindedBeaconBlockBodyElectra{
|
||||||
|
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
||||||
|
Eth1Data: body.Eth1Data.Copy(),
|
||||||
|
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
||||||
|
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
||||||
|
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
||||||
|
Attestations: CopySlice(body.Attestations),
|
||||||
|
Deposits: CopySlice(body.Deposits),
|
||||||
|
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
||||||
|
SyncAggregate: body.SyncAggregate.Copy(),
|
||||||
|
ExecutionPayloadHeader: body.ExecutionPayloadHeader.Copy(),
|
||||||
|
BlsToExecutionChanges: CopySlice(body.BlsToExecutionChanges),
|
||||||
|
BlobKzgCommitments: CopyBlobKZGs(body.BlobKzgCommitments),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (sigBlock *SignedBlindedBeaconBlockBellatrix) Copy() *SignedBlindedBeaconBlockBellatrix {
|
||||||
|
if sigBlock == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &SignedBlindedBeaconBlockBellatrix{
|
||||||
|
Block: sigBlock.Block.Copy(),
|
||||||
|
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (block *BlindedBeaconBlockBellatrix) Copy() *BlindedBeaconBlockBellatrix {
|
||||||
|
if block == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BlindedBeaconBlockBellatrix{
|
||||||
|
Slot: block.Slot,
|
||||||
|
ProposerIndex: block.ProposerIndex,
|
||||||
|
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
||||||
|
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
||||||
|
Body: block.Body.Copy(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (body *BlindedBeaconBlockBodyBellatrix) Copy() *BlindedBeaconBlockBodyBellatrix {
|
||||||
|
if body == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BlindedBeaconBlockBodyBellatrix{
|
||||||
|
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
||||||
|
Eth1Data: body.Eth1Data.Copy(),
|
||||||
|
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
||||||
|
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
||||||
|
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
||||||
|
Attestations: CopySlice(body.Attestations),
|
||||||
|
Deposits: CopySlice(body.Deposits),
|
||||||
|
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
||||||
|
SyncAggregate: body.SyncAggregate.Copy(),
|
||||||
|
ExecutionPayloadHeader: body.ExecutionPayloadHeader.Copy(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CopyBlobKZGs copies the provided blob kzgs object.
|
||||||
|
func CopyBlobKZGs(b [][]byte) [][]byte {
|
||||||
|
return bytesutil.SafeCopy2dBytes(b)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (sigBlock *SignedBeaconBlockDeneb) Copy() *SignedBeaconBlockDeneb {
|
||||||
|
if sigBlock == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &SignedBeaconBlockDeneb{
|
||||||
|
Block: sigBlock.Block.Copy(),
|
||||||
|
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (block *BeaconBlockDeneb) Copy() *BeaconBlockDeneb {
|
||||||
|
if block == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BeaconBlockDeneb{
|
||||||
|
Slot: block.Slot,
|
||||||
|
ProposerIndex: block.ProposerIndex,
|
||||||
|
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
||||||
|
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
||||||
|
Body: block.Body.Copy(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (body *BeaconBlockBodyDeneb) Copy() *BeaconBlockBodyDeneb {
|
||||||
|
if body == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BeaconBlockBodyDeneb{
|
||||||
|
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
||||||
|
Eth1Data: body.Eth1Data.Copy(),
|
||||||
|
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
||||||
|
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
||||||
|
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
||||||
|
Attestations: CopySlice(body.Attestations),
|
||||||
|
Deposits: CopySlice(body.Deposits),
|
||||||
|
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
||||||
|
SyncAggregate: body.SyncAggregate.Copy(),
|
||||||
|
ExecutionPayload: body.ExecutionPayload.Copy(),
|
||||||
|
BlsToExecutionChanges: CopySlice(body.BlsToExecutionChanges),
|
||||||
|
BlobKzgCommitments: CopyBlobKZGs(body.BlobKzgCommitments),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (sigBlock *SignedBeaconBlockElectra) Copy() *SignedBeaconBlockElectra {
|
||||||
|
if sigBlock == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &SignedBeaconBlockElectra{
|
||||||
|
Block: sigBlock.Block.Copy(),
|
||||||
|
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (block *BeaconBlockElectra) Copy() *BeaconBlockElectra {
|
||||||
|
if block == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BeaconBlockElectra{
|
||||||
|
Slot: block.Slot,
|
||||||
|
ProposerIndex: block.ProposerIndex,
|
||||||
|
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
||||||
|
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
||||||
|
Body: block.Body.Copy(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy --
|
||||||
|
func (body *BeaconBlockBodyElectra) Copy() *BeaconBlockBodyElectra {
|
||||||
|
if body == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &BeaconBlockBodyElectra{
|
||||||
|
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
||||||
|
Eth1Data: body.Eth1Data.Copy(),
|
||||||
|
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
||||||
|
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
||||||
|
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
||||||
|
Attestations: CopySlice(body.Attestations),
|
||||||
|
Deposits: CopySlice(body.Deposits),
|
||||||
|
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
||||||
|
SyncAggregate: body.SyncAggregate.Copy(),
|
||||||
|
ExecutionPayload: body.ExecutionPayload.Copy(),
|
||||||
|
BlsToExecutionChanges: CopySlice(body.BlsToExecutionChanges),
|
||||||
|
BlobKzgCommitments: CopyBlobKZGs(body.BlobKzgCommitments),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Copy --
|
// Copy --
|
||||||
func (data *Eth1Data) Copy() *Eth1Data {
|
func (data *Eth1Data) Copy() *Eth1Data {
|
||||||
if data == nil {
|
if data == nil {
|
||||||
|
|||||||
@@ -6,6 +6,49 @@ import (
|
|||||||
eth "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
eth "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestBeaconBlock_Fuzz(t *testing.T) {
|
||||||
|
// Phase 0 Full
|
||||||
|
fuzzCopies(t, ð.SignedBeaconBlock{})
|
||||||
|
fuzzCopies(t, ð.BeaconBlock{})
|
||||||
|
fuzzCopies(t, ð.BeaconBlockBody{})
|
||||||
|
// Altair Full
|
||||||
|
fuzzCopies(t, ð.SignedBeaconBlockAltair{})
|
||||||
|
fuzzCopies(t, ð.BeaconBlockAltair{})
|
||||||
|
fuzzCopies(t, ð.BeaconBlockBodyAltair{})
|
||||||
|
// Bellatrix Full
|
||||||
|
fuzzCopies(t, ð.SignedBeaconBlockBellatrix{})
|
||||||
|
fuzzCopies(t, ð.BeaconBlockBellatrix{})
|
||||||
|
fuzzCopies(t, ð.BeaconBlockBodyBellatrix{})
|
||||||
|
// Bellatrix Blinded
|
||||||
|
fuzzCopies(t, ð.SignedBlindedBeaconBlockBellatrix{})
|
||||||
|
fuzzCopies(t, ð.BlindedBeaconBlockBellatrix{})
|
||||||
|
fuzzCopies(t, ð.BlindedBeaconBlockBodyBellatrix{})
|
||||||
|
// Capella Full
|
||||||
|
fuzzCopies(t, ð.SignedBeaconBlockCapella{})
|
||||||
|
fuzzCopies(t, ð.BeaconBlockCapella{})
|
||||||
|
fuzzCopies(t, ð.BeaconBlockBodyCapella{})
|
||||||
|
// Capella Blinded
|
||||||
|
fuzzCopies(t, ð.SignedBlindedBeaconBlockCapella{})
|
||||||
|
fuzzCopies(t, ð.BlindedBeaconBlockCapella{})
|
||||||
|
fuzzCopies(t, ð.BlindedBeaconBlockBodyCapella{})
|
||||||
|
// Deneb Full
|
||||||
|
fuzzCopies(t, ð.SignedBeaconBlockDeneb{})
|
||||||
|
fuzzCopies(t, ð.BeaconBlockDeneb{})
|
||||||
|
fuzzCopies(t, ð.BeaconBlockBodyDeneb{})
|
||||||
|
// Deneb Blinded
|
||||||
|
fuzzCopies(t, ð.SignedBlindedBeaconBlockDeneb{})
|
||||||
|
fuzzCopies(t, ð.BlindedBeaconBlockDeneb{})
|
||||||
|
fuzzCopies(t, ð.BlindedBeaconBlockBodyDeneb{})
|
||||||
|
// Electra Full
|
||||||
|
fuzzCopies(t, ð.SignedBeaconBlockElectra{})
|
||||||
|
fuzzCopies(t, ð.BeaconBlockElectra{})
|
||||||
|
fuzzCopies(t, ð.BeaconBlockBodyElectra{})
|
||||||
|
// Electra Blinded
|
||||||
|
fuzzCopies(t, ð.SignedBlindedBeaconBlockElectra{})
|
||||||
|
fuzzCopies(t, ð.BlindedBeaconBlockElectra{})
|
||||||
|
fuzzCopies(t, ð.BlindedBeaconBlockBodyElectra{})
|
||||||
|
}
|
||||||
|
|
||||||
func TestCopyBeaconBlockFields_Fuzz(t *testing.T) {
|
func TestCopyBeaconBlockFields_Fuzz(t *testing.T) {
|
||||||
fuzzCopies(t, ð.Eth1Data{})
|
fuzzCopies(t, ð.Eth1Data{})
|
||||||
fuzzCopies(t, ð.ProposerSlashing{})
|
fuzzCopies(t, ð.ProposerSlashing{})
|
||||||
|
|||||||
@@ -17,91 +17,6 @@ func CopySlice[T any, C copier[T]](original []C) []T {
|
|||||||
return newSlice
|
return newSlice
|
||||||
}
|
}
|
||||||
|
|
||||||
// CopySignedBeaconBlock copies the provided SignedBeaconBlock.
|
|
||||||
func CopySignedBeaconBlock(sigBlock *SignedBeaconBlock) *SignedBeaconBlock {
|
|
||||||
if sigBlock == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &SignedBeaconBlock{
|
|
||||||
Block: CopyBeaconBlock(sigBlock.Block),
|
|
||||||
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBeaconBlock copies the provided BeaconBlock.
|
|
||||||
func CopyBeaconBlock(block *BeaconBlock) *BeaconBlock {
|
|
||||||
if block == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BeaconBlock{
|
|
||||||
Slot: block.Slot,
|
|
||||||
ProposerIndex: block.ProposerIndex,
|
|
||||||
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
|
||||||
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
|
||||||
Body: CopyBeaconBlockBody(block.Body),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBeaconBlockBody copies the provided BeaconBlockBody.
|
|
||||||
func CopyBeaconBlockBody(body *BeaconBlockBody) *BeaconBlockBody {
|
|
||||||
if body == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BeaconBlockBody{
|
|
||||||
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
|
||||||
Eth1Data: body.Eth1Data.Copy(),
|
|
||||||
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
|
||||||
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
|
||||||
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
|
||||||
Attestations: CopySlice(body.Attestations),
|
|
||||||
Deposits: CopySlice(body.Deposits),
|
|
||||||
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopySignedBeaconBlockAltair copies the provided SignedBeaconBlock.
|
|
||||||
func CopySignedBeaconBlockAltair(sigBlock *SignedBeaconBlockAltair) *SignedBeaconBlockAltair {
|
|
||||||
if sigBlock == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &SignedBeaconBlockAltair{
|
|
||||||
Block: CopyBeaconBlockAltair(sigBlock.Block),
|
|
||||||
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBeaconBlockAltair copies the provided BeaconBlock.
|
|
||||||
func CopyBeaconBlockAltair(block *BeaconBlockAltair) *BeaconBlockAltair {
|
|
||||||
if block == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BeaconBlockAltair{
|
|
||||||
Slot: block.Slot,
|
|
||||||
ProposerIndex: block.ProposerIndex,
|
|
||||||
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
|
||||||
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
|
||||||
Body: CopyBeaconBlockBodyAltair(block.Body),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBeaconBlockBodyAltair copies the provided BeaconBlockBody.
|
|
||||||
func CopyBeaconBlockBodyAltair(body *BeaconBlockBodyAltair) *BeaconBlockBodyAltair {
|
|
||||||
if body == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BeaconBlockBodyAltair{
|
|
||||||
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
|
||||||
Eth1Data: body.Eth1Data.Copy(),
|
|
||||||
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
|
||||||
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
|
||||||
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
|
||||||
Attestations: CopySlice(body.Attestations),
|
|
||||||
Deposits: CopySlice(body.Deposits),
|
|
||||||
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
|
||||||
SyncAggregate: body.SyncAggregate.Copy(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyValidator copies the provided validator.
|
// CopyValidator copies the provided validator.
|
||||||
func CopyValidator(val *Validator) *Validator {
|
func CopyValidator(val *Validator) *Validator {
|
||||||
pubKey := make([]byte, len(val.PublicKey))
|
pubKey := make([]byte, len(val.PublicKey))
|
||||||
@@ -146,370 +61,3 @@ func CopySyncCommitteeContribution(c *SyncCommitteeContribution) *SyncCommitteeC
|
|||||||
Signature: bytesutil.SafeCopyBytes(c.Signature),
|
Signature: bytesutil.SafeCopyBytes(c.Signature),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CopySignedBeaconBlockBellatrix copies the provided SignedBeaconBlockBellatrix.
|
|
||||||
func CopySignedBeaconBlockBellatrix(sigBlock *SignedBeaconBlockBellatrix) *SignedBeaconBlockBellatrix {
|
|
||||||
if sigBlock == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &SignedBeaconBlockBellatrix{
|
|
||||||
Block: CopyBeaconBlockBellatrix(sigBlock.Block),
|
|
||||||
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBeaconBlockBellatrix copies the provided BeaconBlockBellatrix.
|
|
||||||
func CopyBeaconBlockBellatrix(block *BeaconBlockBellatrix) *BeaconBlockBellatrix {
|
|
||||||
if block == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BeaconBlockBellatrix{
|
|
||||||
Slot: block.Slot,
|
|
||||||
ProposerIndex: block.ProposerIndex,
|
|
||||||
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
|
||||||
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
|
||||||
Body: CopyBeaconBlockBodyBellatrix(block.Body),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBeaconBlockBodyBellatrix copies the provided BeaconBlockBodyBellatrix.
|
|
||||||
func CopyBeaconBlockBodyBellatrix(body *BeaconBlockBodyBellatrix) *BeaconBlockBodyBellatrix {
|
|
||||||
if body == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BeaconBlockBodyBellatrix{
|
|
||||||
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
|
||||||
Eth1Data: body.Eth1Data.Copy(),
|
|
||||||
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
|
||||||
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
|
||||||
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
|
||||||
Attestations: CopySlice(body.Attestations),
|
|
||||||
Deposits: CopySlice(body.Deposits),
|
|
||||||
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
|
||||||
SyncAggregate: body.SyncAggregate.Copy(),
|
|
||||||
ExecutionPayload: body.ExecutionPayload.Copy(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopySignedBeaconBlockCapella copies the provided SignedBeaconBlockCapella.
|
|
||||||
func CopySignedBeaconBlockCapella(sigBlock *SignedBeaconBlockCapella) *SignedBeaconBlockCapella {
|
|
||||||
if sigBlock == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &SignedBeaconBlockCapella{
|
|
||||||
Block: CopyBeaconBlockCapella(sigBlock.Block),
|
|
||||||
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBeaconBlockCapella copies the provided BeaconBlockCapella.
|
|
||||||
func CopyBeaconBlockCapella(block *BeaconBlockCapella) *BeaconBlockCapella {
|
|
||||||
if block == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BeaconBlockCapella{
|
|
||||||
Slot: block.Slot,
|
|
||||||
ProposerIndex: block.ProposerIndex,
|
|
||||||
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
|
||||||
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
|
||||||
Body: CopyBeaconBlockBodyCapella(block.Body),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBeaconBlockBodyCapella copies the provided BeaconBlockBodyCapella.
|
|
||||||
func CopyBeaconBlockBodyCapella(body *BeaconBlockBodyCapella) *BeaconBlockBodyCapella {
|
|
||||||
if body == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BeaconBlockBodyCapella{
|
|
||||||
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
|
||||||
Eth1Data: body.Eth1Data.Copy(),
|
|
||||||
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
|
||||||
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
|
||||||
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
|
||||||
Attestations: CopySlice(body.Attestations),
|
|
||||||
Deposits: CopySlice(body.Deposits),
|
|
||||||
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
|
||||||
SyncAggregate: body.SyncAggregate.Copy(),
|
|
||||||
ExecutionPayload: body.ExecutionPayload.Copy(),
|
|
||||||
BlsToExecutionChanges: CopySlice(body.BlsToExecutionChanges),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopySignedBlindedBeaconBlockCapella copies the provided SignedBlindedBeaconBlockCapella.
|
|
||||||
func CopySignedBlindedBeaconBlockCapella(sigBlock *SignedBlindedBeaconBlockCapella) *SignedBlindedBeaconBlockCapella {
|
|
||||||
if sigBlock == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &SignedBlindedBeaconBlockCapella{
|
|
||||||
Block: CopyBlindedBeaconBlockCapella(sigBlock.Block),
|
|
||||||
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBlindedBeaconBlockCapella copies the provided BlindedBeaconBlockCapella.
|
|
||||||
func CopyBlindedBeaconBlockCapella(block *BlindedBeaconBlockCapella) *BlindedBeaconBlockCapella {
|
|
||||||
if block == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BlindedBeaconBlockCapella{
|
|
||||||
Slot: block.Slot,
|
|
||||||
ProposerIndex: block.ProposerIndex,
|
|
||||||
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
|
||||||
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
|
||||||
Body: CopyBlindedBeaconBlockBodyCapella(block.Body),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBlindedBeaconBlockBodyCapella copies the provided BlindedBeaconBlockBodyCapella.
|
|
||||||
func CopyBlindedBeaconBlockBodyCapella(body *BlindedBeaconBlockBodyCapella) *BlindedBeaconBlockBodyCapella {
|
|
||||||
if body == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BlindedBeaconBlockBodyCapella{
|
|
||||||
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
|
||||||
Eth1Data: body.Eth1Data.Copy(),
|
|
||||||
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
|
||||||
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
|
||||||
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
|
||||||
Attestations: CopySlice(body.Attestations),
|
|
||||||
Deposits: CopySlice(body.Deposits),
|
|
||||||
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
|
||||||
SyncAggregate: body.SyncAggregate.Copy(),
|
|
||||||
ExecutionPayloadHeader: body.ExecutionPayloadHeader.Copy(),
|
|
||||||
BlsToExecutionChanges: CopySlice(body.BlsToExecutionChanges),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopySignedBlindedBeaconBlockDeneb copies the provided SignedBlindedBeaconBlockDeneb.
|
|
||||||
func CopySignedBlindedBeaconBlockDeneb(sigBlock *SignedBlindedBeaconBlockDeneb) *SignedBlindedBeaconBlockDeneb {
|
|
||||||
if sigBlock == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &SignedBlindedBeaconBlockDeneb{
|
|
||||||
Message: CopyBlindedBeaconBlockDeneb(sigBlock.Message),
|
|
||||||
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBlindedBeaconBlockDeneb copies the provided BlindedBeaconBlockDeneb.
|
|
||||||
func CopyBlindedBeaconBlockDeneb(block *BlindedBeaconBlockDeneb) *BlindedBeaconBlockDeneb {
|
|
||||||
if block == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BlindedBeaconBlockDeneb{
|
|
||||||
Slot: block.Slot,
|
|
||||||
ProposerIndex: block.ProposerIndex,
|
|
||||||
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
|
||||||
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
|
||||||
Body: CopyBlindedBeaconBlockBodyDeneb(block.Body),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBlindedBeaconBlockBodyDeneb copies the provided BlindedBeaconBlockBodyDeneb.
|
|
||||||
func CopyBlindedBeaconBlockBodyDeneb(body *BlindedBeaconBlockBodyDeneb) *BlindedBeaconBlockBodyDeneb {
|
|
||||||
if body == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BlindedBeaconBlockBodyDeneb{
|
|
||||||
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
|
||||||
Eth1Data: body.Eth1Data.Copy(),
|
|
||||||
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
|
||||||
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
|
||||||
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
|
||||||
Attestations: CopySlice(body.Attestations),
|
|
||||||
Deposits: CopySlice(body.Deposits),
|
|
||||||
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
|
||||||
SyncAggregate: body.SyncAggregate.Copy(),
|
|
||||||
ExecutionPayloadHeader: body.ExecutionPayloadHeader.Copy(),
|
|
||||||
BlsToExecutionChanges: CopySlice(body.BlsToExecutionChanges),
|
|
||||||
BlobKzgCommitments: CopyBlobKZGs(body.BlobKzgCommitments),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopySignedBlindedBeaconBlockElectra copies the provided SignedBlindedBeaconBlockElectra.
|
|
||||||
func CopySignedBlindedBeaconBlockElectra(sigBlock *SignedBlindedBeaconBlockElectra) *SignedBlindedBeaconBlockElectra {
|
|
||||||
if sigBlock == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &SignedBlindedBeaconBlockElectra{
|
|
||||||
Message: CopyBlindedBeaconBlockElectra(sigBlock.Message),
|
|
||||||
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBlindedBeaconBlockElectra copies the provided BlindedBeaconBlockElectra.
|
|
||||||
func CopyBlindedBeaconBlockElectra(block *BlindedBeaconBlockElectra) *BlindedBeaconBlockElectra {
|
|
||||||
if block == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BlindedBeaconBlockElectra{
|
|
||||||
Slot: block.Slot,
|
|
||||||
ProposerIndex: block.ProposerIndex,
|
|
||||||
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
|
||||||
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
|
||||||
Body: CopyBlindedBeaconBlockBodyElectra(block.Body),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBlindedBeaconBlockBodyElectra copies the provided BlindedBeaconBlockBodyElectra.
|
|
||||||
func CopyBlindedBeaconBlockBodyElectra(body *BlindedBeaconBlockBodyElectra) *BlindedBeaconBlockBodyElectra {
|
|
||||||
if body == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BlindedBeaconBlockBodyElectra{
|
|
||||||
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
|
||||||
Eth1Data: body.Eth1Data.Copy(),
|
|
||||||
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
|
||||||
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
|
||||||
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
|
||||||
Attestations: CopySlice(body.Attestations),
|
|
||||||
Deposits: CopySlice(body.Deposits),
|
|
||||||
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
|
||||||
SyncAggregate: body.SyncAggregate.Copy(),
|
|
||||||
ExecutionPayloadHeader: body.ExecutionPayloadHeader.Copy(),
|
|
||||||
BlsToExecutionChanges: CopySlice(body.BlsToExecutionChanges),
|
|
||||||
BlobKzgCommitments: CopyBlobKZGs(body.BlobKzgCommitments),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopySignedBlindedBeaconBlockBellatrix copies the provided SignedBlindedBeaconBlockBellatrix.
|
|
||||||
func CopySignedBlindedBeaconBlockBellatrix(sigBlock *SignedBlindedBeaconBlockBellatrix) *SignedBlindedBeaconBlockBellatrix {
|
|
||||||
if sigBlock == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &SignedBlindedBeaconBlockBellatrix{
|
|
||||||
Block: CopyBlindedBeaconBlockBellatrix(sigBlock.Block),
|
|
||||||
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBlindedBeaconBlockBellatrix copies the provided BlindedBeaconBlockBellatrix.
|
|
||||||
func CopyBlindedBeaconBlockBellatrix(block *BlindedBeaconBlockBellatrix) *BlindedBeaconBlockBellatrix {
|
|
||||||
if block == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BlindedBeaconBlockBellatrix{
|
|
||||||
Slot: block.Slot,
|
|
||||||
ProposerIndex: block.ProposerIndex,
|
|
||||||
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
|
||||||
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
|
||||||
Body: CopyBlindedBeaconBlockBodyBellatrix(block.Body),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBlindedBeaconBlockBodyBellatrix copies the provided BlindedBeaconBlockBodyBellatrix.
|
|
||||||
func CopyBlindedBeaconBlockBodyBellatrix(body *BlindedBeaconBlockBodyBellatrix) *BlindedBeaconBlockBodyBellatrix {
|
|
||||||
if body == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BlindedBeaconBlockBodyBellatrix{
|
|
||||||
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
|
||||||
Eth1Data: body.Eth1Data.Copy(),
|
|
||||||
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
|
||||||
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
|
||||||
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
|
||||||
Attestations: CopySlice(body.Attestations),
|
|
||||||
Deposits: CopySlice(body.Deposits),
|
|
||||||
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
|
||||||
SyncAggregate: body.SyncAggregate.Copy(),
|
|
||||||
ExecutionPayloadHeader: body.ExecutionPayloadHeader.Copy(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBlobKZGs copies the provided blob kzgs object.
|
|
||||||
func CopyBlobKZGs(b [][]byte) [][]byte {
|
|
||||||
return bytesutil.SafeCopy2dBytes(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopySignedBeaconBlockDeneb copies the provided SignedBeaconBlockDeneb.
|
|
||||||
func CopySignedBeaconBlockDeneb(sigBlock *SignedBeaconBlockDeneb) *SignedBeaconBlockDeneb {
|
|
||||||
if sigBlock == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &SignedBeaconBlockDeneb{
|
|
||||||
Block: CopyBeaconBlockDeneb(sigBlock.Block),
|
|
||||||
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBeaconBlockDeneb copies the provided BeaconBlockDeneb.
|
|
||||||
func CopyBeaconBlockDeneb(block *BeaconBlockDeneb) *BeaconBlockDeneb {
|
|
||||||
if block == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BeaconBlockDeneb{
|
|
||||||
Slot: block.Slot,
|
|
||||||
ProposerIndex: block.ProposerIndex,
|
|
||||||
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
|
||||||
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
|
||||||
Body: CopyBeaconBlockBodyDeneb(block.Body),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBeaconBlockBodyDeneb copies the provided BeaconBlockBodyDeneb.
|
|
||||||
func CopyBeaconBlockBodyDeneb(body *BeaconBlockBodyDeneb) *BeaconBlockBodyDeneb {
|
|
||||||
if body == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BeaconBlockBodyDeneb{
|
|
||||||
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
|
||||||
Eth1Data: body.Eth1Data.Copy(),
|
|
||||||
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
|
||||||
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
|
||||||
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
|
||||||
Attestations: CopySlice(body.Attestations),
|
|
||||||
Deposits: CopySlice(body.Deposits),
|
|
||||||
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
|
||||||
SyncAggregate: body.SyncAggregate.Copy(),
|
|
||||||
ExecutionPayload: body.ExecutionPayload.Copy(),
|
|
||||||
BlsToExecutionChanges: CopySlice(body.BlsToExecutionChanges),
|
|
||||||
BlobKzgCommitments: CopyBlobKZGs(body.BlobKzgCommitments),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopySignedBeaconBlockElectra copies the provided SignedBeaconBlockElectra.
|
|
||||||
func CopySignedBeaconBlockElectra(sigBlock *SignedBeaconBlockElectra) *SignedBeaconBlockElectra {
|
|
||||||
if sigBlock == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &SignedBeaconBlockElectra{
|
|
||||||
Block: CopyBeaconBlockElectra(sigBlock.Block),
|
|
||||||
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBeaconBlockElectra copies the provided BeaconBlockElectra.
|
|
||||||
func CopyBeaconBlockElectra(block *BeaconBlockElectra) *BeaconBlockElectra {
|
|
||||||
if block == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BeaconBlockElectra{
|
|
||||||
Slot: block.Slot,
|
|
||||||
ProposerIndex: block.ProposerIndex,
|
|
||||||
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
|
||||||
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
|
||||||
Body: CopyBeaconBlockBodyElectra(block.Body),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyBeaconBlockBodyElectra copies the provided BeaconBlockBodyElectra.
|
|
||||||
func CopyBeaconBlockBodyElectra(body *BeaconBlockBodyElectra) *BeaconBlockBodyElectra {
|
|
||||||
if body == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &BeaconBlockBodyElectra{
|
|
||||||
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
|
||||||
Eth1Data: body.Eth1Data.Copy(),
|
|
||||||
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
|
||||||
ProposerSlashings: CopySlice(body.ProposerSlashings),
|
|
||||||
AttesterSlashings: CopySlice(body.AttesterSlashings),
|
|
||||||
Attestations: CopySlice(body.Attestations),
|
|
||||||
Deposits: CopySlice(body.Deposits),
|
|
||||||
VoluntaryExits: CopySlice(body.VoluntaryExits),
|
|
||||||
SyncAggregate: body.SyncAggregate.Copy(),
|
|
||||||
ExecutionPayload: body.ExecutionPayload.Copy(),
|
|
||||||
BlsToExecutionChanges: CopySlice(body.BlsToExecutionChanges),
|
|
||||||
BlobKzgCommitments: CopyBlobKZGs(body.BlobKzgCommitments),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
func TestCopySignedBeaconBlock(t *testing.T) {
|
func TestCopySignedBeaconBlock(t *testing.T) {
|
||||||
blk := genSignedBeaconBlock()
|
blk := genSignedBeaconBlock()
|
||||||
|
|
||||||
got := v1alpha1.CopySignedBeaconBlock(blk)
|
got := blk.Copy()
|
||||||
if !reflect.DeepEqual(got, blk) {
|
if !reflect.DeepEqual(got, blk) {
|
||||||
t.Errorf("CopySignedBeaconBlock() = %v, want %v", got, blk)
|
t.Errorf("CopySignedBeaconBlock() = %v, want %v", got, blk)
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ func TestCopySignedBeaconBlock(t *testing.T) {
|
|||||||
func TestCopyBeaconBlock(t *testing.T) {
|
func TestCopyBeaconBlock(t *testing.T) {
|
||||||
blk := genBeaconBlock()
|
blk := genBeaconBlock()
|
||||||
|
|
||||||
got := v1alpha1.CopyBeaconBlock(blk)
|
got := blk.Copy()
|
||||||
if !reflect.DeepEqual(got, blk) {
|
if !reflect.DeepEqual(got, blk) {
|
||||||
t.Errorf("CopyBeaconBlock() = %v, want %v", got, blk)
|
t.Errorf("CopyBeaconBlock() = %v, want %v", got, blk)
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ func TestCopyBeaconBlock(t *testing.T) {
|
|||||||
func TestCopyBeaconBlockBody(t *testing.T) {
|
func TestCopyBeaconBlockBody(t *testing.T) {
|
||||||
body := genBeaconBlockBody()
|
body := genBeaconBlockBody()
|
||||||
|
|
||||||
got := v1alpha1.CopyBeaconBlockBody(body)
|
got := body.Copy()
|
||||||
if !reflect.DeepEqual(got, body) {
|
if !reflect.DeepEqual(got, body) {
|
||||||
t.Errorf("CopyBeaconBlockBody() = %v, want %v", got, body)
|
t.Errorf("CopyBeaconBlockBody() = %v, want %v", got, body)
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ func TestCopyBeaconBlockBody(t *testing.T) {
|
|||||||
func TestCopySignedBeaconBlockAltair(t *testing.T) {
|
func TestCopySignedBeaconBlockAltair(t *testing.T) {
|
||||||
sbb := genSignedBeaconBlockAltair()
|
sbb := genSignedBeaconBlockAltair()
|
||||||
|
|
||||||
got := v1alpha1.CopySignedBeaconBlockAltair(sbb)
|
got := sbb.Copy()
|
||||||
if !reflect.DeepEqual(got, sbb) {
|
if !reflect.DeepEqual(got, sbb) {
|
||||||
t.Errorf("CopySignedBeaconBlockAltair() = %v, want %v", got, sbb)
|
t.Errorf("CopySignedBeaconBlockAltair() = %v, want %v", got, sbb)
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ func TestCopySignedBeaconBlockAltair(t *testing.T) {
|
|||||||
func TestCopyBeaconBlockAltair(t *testing.T) {
|
func TestCopyBeaconBlockAltair(t *testing.T) {
|
||||||
b := genBeaconBlockAltair()
|
b := genBeaconBlockAltair()
|
||||||
|
|
||||||
got := v1alpha1.CopyBeaconBlockAltair(b)
|
got := b.Copy()
|
||||||
if !reflect.DeepEqual(got, b) {
|
if !reflect.DeepEqual(got, b) {
|
||||||
t.Errorf("CopyBeaconBlockAltair() = %v, want %v", got, b)
|
t.Errorf("CopyBeaconBlockAltair() = %v, want %v", got, b)
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ func TestCopyBeaconBlockAltair(t *testing.T) {
|
|||||||
func TestCopyBeaconBlockBodyAltair(t *testing.T) {
|
func TestCopyBeaconBlockBodyAltair(t *testing.T) {
|
||||||
bb := genBeaconBlockBodyAltair()
|
bb := genBeaconBlockBodyAltair()
|
||||||
|
|
||||||
got := v1alpha1.CopyBeaconBlockBodyAltair(bb)
|
got := bb.Copy()
|
||||||
if !reflect.DeepEqual(got, bb) {
|
if !reflect.DeepEqual(got, bb) {
|
||||||
t.Errorf("CopyBeaconBlockBodyAltair() = %v, want %v", got, bb)
|
t.Errorf("CopyBeaconBlockBodyAltair() = %v, want %v", got, bb)
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ func TestCopyPendingAttestationSlice(t *testing.T) {
|
|||||||
func TestCopySignedBeaconBlockBellatrix(t *testing.T) {
|
func TestCopySignedBeaconBlockBellatrix(t *testing.T) {
|
||||||
sbb := genSignedBeaconBlockBellatrix()
|
sbb := genSignedBeaconBlockBellatrix()
|
||||||
|
|
||||||
got := v1alpha1.CopySignedBeaconBlockBellatrix(sbb)
|
got := sbb.Copy()
|
||||||
if !reflect.DeepEqual(got, sbb) {
|
if !reflect.DeepEqual(got, sbb) {
|
||||||
t.Errorf("CopySignedBeaconBlockBellatrix() = %v, want %v", got, sbb)
|
t.Errorf("CopySignedBeaconBlockBellatrix() = %v, want %v", got, sbb)
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ func TestCopySignedBeaconBlockBellatrix(t *testing.T) {
|
|||||||
func TestCopyBeaconBlockBellatrix(t *testing.T) {
|
func TestCopyBeaconBlockBellatrix(t *testing.T) {
|
||||||
b := genBeaconBlockBellatrix()
|
b := genBeaconBlockBellatrix()
|
||||||
|
|
||||||
got := v1alpha1.CopyBeaconBlockBellatrix(b)
|
got := b.Copy()
|
||||||
if !reflect.DeepEqual(got, b) {
|
if !reflect.DeepEqual(got, b) {
|
||||||
t.Errorf("CopyBeaconBlockBellatrix() = %v, want %v", got, b)
|
t.Errorf("CopyBeaconBlockBellatrix() = %v, want %v", got, b)
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@ func TestCopyBeaconBlockBellatrix(t *testing.T) {
|
|||||||
func TestCopyBeaconBlockBodyBellatrix(t *testing.T) {
|
func TestCopyBeaconBlockBodyBellatrix(t *testing.T) {
|
||||||
bb := genBeaconBlockBodyBellatrix()
|
bb := genBeaconBlockBodyBellatrix()
|
||||||
|
|
||||||
got := v1alpha1.CopyBeaconBlockBodyBellatrix(bb)
|
got := bb.Copy()
|
||||||
if !reflect.DeepEqual(got, bb) {
|
if !reflect.DeepEqual(got, bb) {
|
||||||
t.Errorf("CopyBeaconBlockBodyBellatrix() = %v, want %v", got, bb)
|
t.Errorf("CopyBeaconBlockBodyBellatrix() = %v, want %v", got, bb)
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ func TestCopyBeaconBlockBodyBellatrix(t *testing.T) {
|
|||||||
func TestCopySignedBlindedBeaconBlockBellatrix(t *testing.T) {
|
func TestCopySignedBlindedBeaconBlockBellatrix(t *testing.T) {
|
||||||
sbb := genSignedBeaconBlockBellatrix()
|
sbb := genSignedBeaconBlockBellatrix()
|
||||||
|
|
||||||
got := v1alpha1.CopySignedBeaconBlockBellatrix(sbb)
|
got := sbb.Copy()
|
||||||
if !reflect.DeepEqual(got, sbb) {
|
if !reflect.DeepEqual(got, sbb) {
|
||||||
t.Errorf("CopySignedBeaconBlockBellatrix() = %v, want %v", got, sbb)
|
t.Errorf("CopySignedBeaconBlockBellatrix() = %v, want %v", got, sbb)
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ func TestCopySignedBlindedBeaconBlockBellatrix(t *testing.T) {
|
|||||||
func TestCopyBlindedBeaconBlockBellatrix(t *testing.T) {
|
func TestCopyBlindedBeaconBlockBellatrix(t *testing.T) {
|
||||||
b := genBeaconBlockBellatrix()
|
b := genBeaconBlockBellatrix()
|
||||||
|
|
||||||
got := v1alpha1.CopyBeaconBlockBellatrix(b)
|
got := b.Copy()
|
||||||
if !reflect.DeepEqual(got, b) {
|
if !reflect.DeepEqual(got, b) {
|
||||||
t.Errorf("CopyBeaconBlockBellatrix() = %v, want %v", got, b)
|
t.Errorf("CopyBeaconBlockBellatrix() = %v, want %v", got, b)
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ func TestCopyBlindedBeaconBlockBellatrix(t *testing.T) {
|
|||||||
func TestCopyBlindedBeaconBlockBodyBellatrix(t *testing.T) {
|
func TestCopyBlindedBeaconBlockBodyBellatrix(t *testing.T) {
|
||||||
bb := genBeaconBlockBodyBellatrix()
|
bb := genBeaconBlockBodyBellatrix()
|
||||||
|
|
||||||
got := v1alpha1.CopyBeaconBlockBodyBellatrix(bb)
|
got := bb.Copy()
|
||||||
if !reflect.DeepEqual(got, bb) {
|
if !reflect.DeepEqual(got, bb) {
|
||||||
t.Errorf("CopyBeaconBlockBodyBellatrix() = %v, want %v", got, bb)
|
t.Errorf("CopyBeaconBlockBodyBellatrix() = %v, want %v", got, bb)
|
||||||
}
|
}
|
||||||
@@ -193,7 +193,7 @@ func TestCopyBlindedBeaconBlockBodyBellatrix(t *testing.T) {
|
|||||||
func TestCopySignedBeaconBlockCapella(t *testing.T) {
|
func TestCopySignedBeaconBlockCapella(t *testing.T) {
|
||||||
sbb := genSignedBeaconBlockCapella()
|
sbb := genSignedBeaconBlockCapella()
|
||||||
|
|
||||||
got := v1alpha1.CopySignedBeaconBlockCapella(sbb)
|
got := sbb.Copy()
|
||||||
if !reflect.DeepEqual(got, sbb) {
|
if !reflect.DeepEqual(got, sbb) {
|
||||||
t.Errorf("CopySignedBeaconBlockCapella() = %v, want %v", got, sbb)
|
t.Errorf("CopySignedBeaconBlockCapella() = %v, want %v", got, sbb)
|
||||||
}
|
}
|
||||||
@@ -203,7 +203,7 @@ func TestCopySignedBeaconBlockCapella(t *testing.T) {
|
|||||||
func TestCopyBeaconBlockCapella(t *testing.T) {
|
func TestCopyBeaconBlockCapella(t *testing.T) {
|
||||||
b := genBeaconBlockCapella()
|
b := genBeaconBlockCapella()
|
||||||
|
|
||||||
got := v1alpha1.CopyBeaconBlockCapella(b)
|
got := b.Copy()
|
||||||
if !reflect.DeepEqual(got, b) {
|
if !reflect.DeepEqual(got, b) {
|
||||||
t.Errorf("CopyBeaconBlockCapella() = %v, want %v", got, b)
|
t.Errorf("CopyBeaconBlockCapella() = %v, want %v", got, b)
|
||||||
}
|
}
|
||||||
@@ -213,7 +213,7 @@ func TestCopyBeaconBlockCapella(t *testing.T) {
|
|||||||
func TestCopyBeaconBlockBodyCapella(t *testing.T) {
|
func TestCopyBeaconBlockBodyCapella(t *testing.T) {
|
||||||
bb := genBeaconBlockBodyCapella()
|
bb := genBeaconBlockBodyCapella()
|
||||||
|
|
||||||
got := v1alpha1.CopyBeaconBlockBodyCapella(bb)
|
got := bb.Copy()
|
||||||
if !reflect.DeepEqual(got, bb) {
|
if !reflect.DeepEqual(got, bb) {
|
||||||
t.Errorf("CopyBeaconBlockBodyCapella() = %v, want %v", got, bb)
|
t.Errorf("CopyBeaconBlockBodyCapella() = %v, want %v", got, bb)
|
||||||
}
|
}
|
||||||
@@ -223,7 +223,7 @@ func TestCopyBeaconBlockBodyCapella(t *testing.T) {
|
|||||||
func TestCopySignedBlindedBeaconBlockCapella(t *testing.T) {
|
func TestCopySignedBlindedBeaconBlockCapella(t *testing.T) {
|
||||||
sbb := genSignedBlindedBeaconBlockCapella()
|
sbb := genSignedBlindedBeaconBlockCapella()
|
||||||
|
|
||||||
got := v1alpha1.CopySignedBlindedBeaconBlockCapella(sbb)
|
got := sbb.Copy()
|
||||||
if !reflect.DeepEqual(got, sbb) {
|
if !reflect.DeepEqual(got, sbb) {
|
||||||
t.Errorf("CopySignedBlindedBeaconBlockCapella() = %v, want %v", got, sbb)
|
t.Errorf("CopySignedBlindedBeaconBlockCapella() = %v, want %v", got, sbb)
|
||||||
}
|
}
|
||||||
@@ -233,7 +233,7 @@ func TestCopySignedBlindedBeaconBlockCapella(t *testing.T) {
|
|||||||
func TestCopyBlindedBeaconBlockCapella(t *testing.T) {
|
func TestCopyBlindedBeaconBlockCapella(t *testing.T) {
|
||||||
b := genBlindedBeaconBlockCapella()
|
b := genBlindedBeaconBlockCapella()
|
||||||
|
|
||||||
got := v1alpha1.CopyBlindedBeaconBlockCapella(b)
|
got := b.Copy()
|
||||||
if !reflect.DeepEqual(got, b) {
|
if !reflect.DeepEqual(got, b) {
|
||||||
t.Errorf("CopyBlindedBeaconBlockCapella() = %v, want %v", got, b)
|
t.Errorf("CopyBlindedBeaconBlockCapella() = %v, want %v", got, b)
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ func TestCopyBlindedBeaconBlockCapella(t *testing.T) {
|
|||||||
func TestCopyBlindedBeaconBlockBodyCapella(t *testing.T) {
|
func TestCopyBlindedBeaconBlockBodyCapella(t *testing.T) {
|
||||||
bb := genBlindedBeaconBlockBodyCapella()
|
bb := genBlindedBeaconBlockBodyCapella()
|
||||||
|
|
||||||
got := v1alpha1.CopyBlindedBeaconBlockBodyCapella(bb)
|
got := bb.Copy()
|
||||||
if !reflect.DeepEqual(got, bb) {
|
if !reflect.DeepEqual(got, bb) {
|
||||||
t.Errorf("CopyBlindedBeaconBlockBodyCapella() = %v, want %v", got, bb)
|
t.Errorf("CopyBlindedBeaconBlockBodyCapella() = %v, want %v", got, bb)
|
||||||
}
|
}
|
||||||
@@ -253,7 +253,7 @@ func TestCopyBlindedBeaconBlockBodyCapella(t *testing.T) {
|
|||||||
func TestCopySignedBeaconBlockDeneb(t *testing.T) {
|
func TestCopySignedBeaconBlockDeneb(t *testing.T) {
|
||||||
sbb := genSignedBeaconBlockDeneb()
|
sbb := genSignedBeaconBlockDeneb()
|
||||||
|
|
||||||
got := v1alpha1.CopySignedBeaconBlockDeneb(sbb)
|
got := sbb.Copy()
|
||||||
if !reflect.DeepEqual(got, sbb) {
|
if !reflect.DeepEqual(got, sbb) {
|
||||||
t.Errorf("CopySignedBeaconBlockDeneb() = %v, want %v", got, sbb)
|
t.Errorf("CopySignedBeaconBlockDeneb() = %v, want %v", got, sbb)
|
||||||
}
|
}
|
||||||
@@ -263,7 +263,7 @@ func TestCopySignedBeaconBlockDeneb(t *testing.T) {
|
|||||||
func TestCopyBeaconBlockDeneb(t *testing.T) {
|
func TestCopyBeaconBlockDeneb(t *testing.T) {
|
||||||
b := genBeaconBlockDeneb()
|
b := genBeaconBlockDeneb()
|
||||||
|
|
||||||
got := v1alpha1.CopyBeaconBlockDeneb(b)
|
got := b.Copy()
|
||||||
if !reflect.DeepEqual(got, b) {
|
if !reflect.DeepEqual(got, b) {
|
||||||
t.Errorf("CopyBeaconBlockDeneb() = %v, want %v", got, b)
|
t.Errorf("CopyBeaconBlockDeneb() = %v, want %v", got, b)
|
||||||
}
|
}
|
||||||
@@ -273,7 +273,7 @@ func TestCopyBeaconBlockDeneb(t *testing.T) {
|
|||||||
func TestCopyBeaconBlockBodyDeneb(t *testing.T) {
|
func TestCopyBeaconBlockBodyDeneb(t *testing.T) {
|
||||||
bb := genBeaconBlockBodyDeneb()
|
bb := genBeaconBlockBodyDeneb()
|
||||||
|
|
||||||
got := v1alpha1.CopyBeaconBlockBodyDeneb(bb)
|
got := bb.Copy()
|
||||||
if !reflect.DeepEqual(got, bb) {
|
if !reflect.DeepEqual(got, bb) {
|
||||||
t.Errorf("CopyBeaconBlockBodyDeneb() = %v, want %v", got, bb)
|
t.Errorf("CopyBeaconBlockBodyDeneb() = %v, want %v", got, bb)
|
||||||
}
|
}
|
||||||
@@ -283,7 +283,7 @@ func TestCopyBeaconBlockBodyDeneb(t *testing.T) {
|
|||||||
func TestCopySignedBlindedBeaconBlockDeneb(t *testing.T) {
|
func TestCopySignedBlindedBeaconBlockDeneb(t *testing.T) {
|
||||||
sbb := genSignedBlindedBeaconBlockDeneb()
|
sbb := genSignedBlindedBeaconBlockDeneb()
|
||||||
|
|
||||||
got := v1alpha1.CopySignedBlindedBeaconBlockDeneb(sbb)
|
got := sbb.Copy()
|
||||||
if !reflect.DeepEqual(got, sbb) {
|
if !reflect.DeepEqual(got, sbb) {
|
||||||
t.Errorf("CopySignedBlindedBeaconBlockDeneb() = %v, want %v", got, sbb)
|
t.Errorf("CopySignedBlindedBeaconBlockDeneb() = %v, want %v", got, sbb)
|
||||||
}
|
}
|
||||||
@@ -293,7 +293,7 @@ func TestCopySignedBlindedBeaconBlockDeneb(t *testing.T) {
|
|||||||
func TestCopyBlindedBeaconBlockDeneb(t *testing.T) {
|
func TestCopyBlindedBeaconBlockDeneb(t *testing.T) {
|
||||||
b := genBlindedBeaconBlockDeneb()
|
b := genBlindedBeaconBlockDeneb()
|
||||||
|
|
||||||
got := v1alpha1.CopyBlindedBeaconBlockDeneb(b)
|
got := b.Copy()
|
||||||
if !reflect.DeepEqual(got, b) {
|
if !reflect.DeepEqual(got, b) {
|
||||||
t.Errorf("CopyBlindedBeaconBlockDeneb() = %v, want %v", got, b)
|
t.Errorf("CopyBlindedBeaconBlockDeneb() = %v, want %v", got, b)
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,7 @@ func TestCopyBlindedBeaconBlockDeneb(t *testing.T) {
|
|||||||
func TestCopyBlindedBeaconBlockBodyDeneb(t *testing.T) {
|
func TestCopyBlindedBeaconBlockBodyDeneb(t *testing.T) {
|
||||||
bb := genBlindedBeaconBlockBodyDeneb()
|
bb := genBlindedBeaconBlockBodyDeneb()
|
||||||
|
|
||||||
got := v1alpha1.CopyBlindedBeaconBlockBodyDeneb(bb)
|
got := bb.Copy()
|
||||||
if !reflect.DeepEqual(got, bb) {
|
if !reflect.DeepEqual(got, bb) {
|
||||||
t.Errorf("CopyBlindedBeaconBlockBodyDeneb() = %v, want %v", got, bb)
|
t.Errorf("CopyBlindedBeaconBlockBodyDeneb() = %v, want %v", got, bb)
|
||||||
}
|
}
|
||||||
@@ -321,7 +321,7 @@ func bytes(length int) []byte {
|
|||||||
func TestCopySignedBlindedBeaconBlockElectra(t *testing.T) {
|
func TestCopySignedBlindedBeaconBlockElectra(t *testing.T) {
|
||||||
sbb := genSignedBlindedBeaconBlockElectra()
|
sbb := genSignedBlindedBeaconBlockElectra()
|
||||||
|
|
||||||
got := v1alpha1.CopySignedBlindedBeaconBlockElectra(sbb)
|
got := sbb.Copy()
|
||||||
if !reflect.DeepEqual(got, sbb) {
|
if !reflect.DeepEqual(got, sbb) {
|
||||||
t.Errorf("TestCopySignedBlindedBeaconBlockElectra() = %v, want %v", got, sbb)
|
t.Errorf("TestCopySignedBlindedBeaconBlockElectra() = %v, want %v", got, sbb)
|
||||||
}
|
}
|
||||||
@@ -330,7 +330,7 @@ func TestCopySignedBlindedBeaconBlockElectra(t *testing.T) {
|
|||||||
func TestCopyBlindedBeaconBlockElectra(t *testing.T) {
|
func TestCopyBlindedBeaconBlockElectra(t *testing.T) {
|
||||||
b := genBlindedBeaconBlockElectra()
|
b := genBlindedBeaconBlockElectra()
|
||||||
|
|
||||||
got := v1alpha1.CopyBlindedBeaconBlockElectra(b)
|
got := b.Copy()
|
||||||
if !reflect.DeepEqual(got, b) {
|
if !reflect.DeepEqual(got, b) {
|
||||||
t.Errorf("TestCopyBlindedBeaconBlockElectra() = %v, want %v", got, b)
|
t.Errorf("TestCopyBlindedBeaconBlockElectra() = %v, want %v", got, b)
|
||||||
}
|
}
|
||||||
@@ -339,7 +339,7 @@ func TestCopyBlindedBeaconBlockElectra(t *testing.T) {
|
|||||||
func TestCopyBlindedBeaconBlockBodyElectra(t *testing.T) {
|
func TestCopyBlindedBeaconBlockBodyElectra(t *testing.T) {
|
||||||
bb := genBlindedBeaconBlockBodyElectra()
|
bb := genBlindedBeaconBlockBodyElectra()
|
||||||
|
|
||||||
got := v1alpha1.CopyBlindedBeaconBlockBodyElectra(bb)
|
got := bb.Copy()
|
||||||
if !reflect.DeepEqual(got, bb) {
|
if !reflect.DeepEqual(got, bb) {
|
||||||
t.Errorf("TestCopyBlindedBeaconBlockBodyElectra() = %v, want %v", got, bb)
|
t.Errorf("TestCopyBlindedBeaconBlockBodyElectra() = %v, want %v", got, bb)
|
||||||
}
|
}
|
||||||
@@ -348,7 +348,7 @@ func TestCopyBlindedBeaconBlockBodyElectra(t *testing.T) {
|
|||||||
func TestCopySignedBeaconBlockElectra(t *testing.T) {
|
func TestCopySignedBeaconBlockElectra(t *testing.T) {
|
||||||
sbb := genSignedBeaconBlockElectra()
|
sbb := genSignedBeaconBlockElectra()
|
||||||
|
|
||||||
got := v1alpha1.CopySignedBeaconBlockElectra(sbb)
|
got := sbb.Copy()
|
||||||
if !reflect.DeepEqual(got, sbb) {
|
if !reflect.DeepEqual(got, sbb) {
|
||||||
t.Errorf("TestCopySignedBeaconBlockElectra() = %v, want %v", got, sbb)
|
t.Errorf("TestCopySignedBeaconBlockElectra() = %v, want %v", got, sbb)
|
||||||
}
|
}
|
||||||
@@ -357,7 +357,7 @@ func TestCopySignedBeaconBlockElectra(t *testing.T) {
|
|||||||
func TestCopyBeaconBlockElectra(t *testing.T) {
|
func TestCopyBeaconBlockElectra(t *testing.T) {
|
||||||
b := genBeaconBlockElectra()
|
b := genBeaconBlockElectra()
|
||||||
|
|
||||||
got := v1alpha1.CopyBeaconBlockElectra(b)
|
got := b.Copy()
|
||||||
if !reflect.DeepEqual(got, b) {
|
if !reflect.DeepEqual(got, b) {
|
||||||
t.Errorf("TestCopyBeaconBlockElectra() = %v, want %v", got, b)
|
t.Errorf("TestCopyBeaconBlockElectra() = %v, want %v", got, b)
|
||||||
}
|
}
|
||||||
@@ -366,7 +366,7 @@ func TestCopyBeaconBlockElectra(t *testing.T) {
|
|||||||
func TestCopyBeaconBlockBodyElectra(t *testing.T) {
|
func TestCopyBeaconBlockBodyElectra(t *testing.T) {
|
||||||
bb := genBeaconBlockBodyElectra()
|
bb := genBeaconBlockBodyElectra()
|
||||||
|
|
||||||
got := v1alpha1.CopyBeaconBlockBodyElectra(bb)
|
got := bb.Copy()
|
||||||
if !reflect.DeepEqual(got, bb) {
|
if !reflect.DeepEqual(got, bb) {
|
||||||
t.Errorf("TestCopyBeaconBlockBodyElectra() = %v, want %v", got, bb)
|
t.Errorf("TestCopyBeaconBlockBodyElectra() = %v, want %v", got, bb)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user