mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Native Blocks Ep. 2 - Switch usages to new package (#10885)
* panic in SizeSSZ
* moving slowly
* adapt old code to new interfaces
* return interfaces from factory functions
* replace the rest of WrappedSignedBeaconBlock
* WrappedBeaconBlock
* WrappedBeaconBlockBody
* miscellaneous
* Test_BeaconBlockIsNil
* replace usages of BeaconBlockIsNil
* replace usages of mutator
* fix all build errors
* fix some more issues
* mutator changes
* relax assertions when initializing
* revert changes in object_mapping.go
* allow calling Proto on nil
* Revert "allow calling Proto on nil"
This reverts commit ecc84e4553.
* modify Copy and Proto methods
* remove unused var
* fix block batch tests
* correct BUILD file
* Error when initializing nil objects
* one more error fix
* add missing comma
* rename alias to blocktest
* add logging
* error when SignedBeaconBlock is nil
* fix last test
* import fix
* broken
* working
* test fixes
* reduce complexity of processPendingBlocks
* simplified
This commit is contained in:
@@ -122,29 +122,45 @@ func WrappedBeaconBlockBody(i interface{}) (interfaces.BeaconBlockBody, error) {
|
||||
func BuildSignedBeaconBlock(blk interfaces.BeaconBlock, signature []byte) (interfaces.SignedBeaconBlock, error) {
|
||||
switch b := blk.(type) {
|
||||
case Phase0BeaconBlock:
|
||||
pb, ok := b.Proto().(*eth.BeaconBlock)
|
||||
pb, err := b.Proto()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
blkPb, ok := pb.(*eth.BeaconBlock)
|
||||
if !ok {
|
||||
return nil, errors.New("unable to access inner phase0 proto")
|
||||
}
|
||||
return WrappedSignedBeaconBlock(ð.SignedBeaconBlock{Block: pb, Signature: signature})
|
||||
return WrappedSignedBeaconBlock(ð.SignedBeaconBlock{Block: blkPb, Signature: signature})
|
||||
case altairBeaconBlock:
|
||||
pb, ok := b.Proto().(*eth.BeaconBlockAltair)
|
||||
pb, err := b.Proto()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
blkPb, ok := pb.(*eth.BeaconBlockAltair)
|
||||
if !ok {
|
||||
return nil, errors.New("unable to access inner altair proto")
|
||||
}
|
||||
return WrappedSignedBeaconBlock(ð.SignedBeaconBlockAltair{Block: pb, Signature: signature})
|
||||
return WrappedSignedBeaconBlock(ð.SignedBeaconBlockAltair{Block: blkPb, Signature: signature})
|
||||
case bellatrixBeaconBlock:
|
||||
pb, ok := b.Proto().(*eth.BeaconBlockBellatrix)
|
||||
pb, err := b.Proto()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
blkPb, ok := pb.(*eth.BeaconBlockBellatrix)
|
||||
if !ok {
|
||||
return nil, errors.New("unable to access inner bellatrix proto")
|
||||
}
|
||||
return WrappedSignedBeaconBlock(ð.SignedBeaconBlockBellatrix{Block: pb, Signature: signature})
|
||||
return WrappedSignedBeaconBlock(ð.SignedBeaconBlockBellatrix{Block: blkPb, Signature: signature})
|
||||
case blindedBeaconBlockBellatrix:
|
||||
pb, ok := b.Proto().(*eth.BlindedBeaconBlockBellatrix)
|
||||
pb, err := b.Proto()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
blkPb, ok := pb.(*eth.BlindedBeaconBlockBellatrix)
|
||||
if !ok {
|
||||
return nil, errors.New("unable to access inner bellatrix proto")
|
||||
}
|
||||
return WrappedSignedBeaconBlock(ð.SignedBlindedBeaconBlockBellatrix{Block: pb, Signature: signature})
|
||||
return WrappedSignedBeaconBlock(ð.SignedBlindedBeaconBlockBellatrix{Block: blkPb, Signature: signature})
|
||||
default:
|
||||
return nil, errors.Wrapf(ErrUnsupportedBeaconBlock, "unable to wrap block of type %T", b)
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ func (w altairSignedBeaconBlock) IsNil() bool {
|
||||
|
||||
// Copy performs a deep copy of the signed beacon block
|
||||
// object.
|
||||
func (w altairSignedBeaconBlock) Copy() interfaces.SignedBeaconBlock {
|
||||
return altairSignedBeaconBlock{b: eth.CopySignedBeaconBlockAltair(w.b)}
|
||||
func (w altairSignedBeaconBlock) Copy() (interfaces.SignedBeaconBlock, error) {
|
||||
return altairSignedBeaconBlock{b: eth.CopySignedBeaconBlockAltair(w.b)}, nil
|
||||
}
|
||||
|
||||
// MarshalSSZ marshals the signed beacon block to its relevant ssz
|
||||
@@ -81,8 +81,8 @@ func (w altairSignedBeaconBlock) UnmarshalSSZ(buf []byte) error {
|
||||
|
||||
// Proto returns the block in its underlying protobuf
|
||||
// interface.
|
||||
func (w altairSignedBeaconBlock) Proto() proto.Message {
|
||||
return w.b
|
||||
func (w altairSignedBeaconBlock) Proto() (proto.Message, error) {
|
||||
return w.b, nil
|
||||
}
|
||||
|
||||
// PbGenericBlock returns a generic signed beacon block.
|
||||
@@ -224,8 +224,8 @@ func (w altairBeaconBlock) UnmarshalSSZ(buf []byte) error {
|
||||
|
||||
// Proto returns the underlying block object in its
|
||||
// proto form.
|
||||
func (w altairBeaconBlock) Proto() proto.Message {
|
||||
return w.b
|
||||
func (w altairBeaconBlock) Proto() (proto.Message, error) {
|
||||
return w.b, nil
|
||||
}
|
||||
|
||||
// Version of the underlying protobuf object.
|
||||
@@ -234,10 +234,10 @@ func (altairBeaconBlock) Version() int {
|
||||
}
|
||||
|
||||
// AsSignRequestObject returns the underlying sign request object.
|
||||
func (w altairBeaconBlock) AsSignRequestObject() validatorpb.SignRequestObject {
|
||||
func (w altairBeaconBlock) AsSignRequestObject() (validatorpb.SignRequestObject, error) {
|
||||
return &validatorpb.SignRequest_BlockV2{
|
||||
BlockV2: w.b,
|
||||
}
|
||||
}, nil
|
||||
}
|
||||
|
||||
// altairBeaconBlockBody is a wrapper of a beacon block body.
|
||||
@@ -312,8 +312,8 @@ func (w altairBeaconBlockBody) HashTreeRoot() ([32]byte, error) {
|
||||
|
||||
// Proto returns the underlying proto form of the block
|
||||
// body.
|
||||
func (w altairBeaconBlockBody) Proto() proto.Message {
|
||||
return w.b
|
||||
func (w altairBeaconBlockBody) Proto() (proto.Message, error) {
|
||||
return w.b, nil
|
||||
}
|
||||
|
||||
// Execution is a stub.
|
||||
|
||||
@@ -29,7 +29,9 @@ func TestAltairSignedBeaconBlock_Block(t *testing.T) {
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(ðpb.SignedBeaconBlockAltair{Block: blk})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.DeepEqual(t, blk, wsb.Block().Proto())
|
||||
pb, err := wsb.Block().Proto()
|
||||
require.NoError(t, err)
|
||||
assert.DeepEqual(t, blk, pb)
|
||||
}
|
||||
|
||||
func TestAltairSignedBeaconBlock_IsNil(t *testing.T) {
|
||||
@@ -54,7 +56,9 @@ func TestAltairSignedBeaconBlock_Proto(t *testing.T) {
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(sb)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, sb, wsb.Proto())
|
||||
pb, err := wsb.Proto()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, sb, pb)
|
||||
}
|
||||
|
||||
func TestAltairSignedBeaconBlock_PbPhase0Block(t *testing.T) {
|
||||
@@ -146,7 +150,9 @@ func TestAltairBeaconBlock_Body(t *testing.T) {
|
||||
wb, err := wrapper.WrappedBeaconBlock(ðpb.BeaconBlockAltair{Body: body})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, body, wb.Body().Proto())
|
||||
pb, err := wb.Body().Proto()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, body, pb)
|
||||
}
|
||||
|
||||
func TestAltairBeaconBlock_IsNil(t *testing.T) {
|
||||
@@ -179,7 +185,9 @@ func TestAltairBeaconBlock_Proto(t *testing.T) {
|
||||
wb, err := wrapper.WrappedBeaconBlock(blk)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, blk, wb.Proto())
|
||||
pb, err := wb.Proto()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, blk, pb)
|
||||
}
|
||||
|
||||
func TestAltairBeaconBlock_SSZ(t *testing.T) {
|
||||
@@ -309,7 +317,9 @@ func TestAltairBeaconBlockBody_Proto(t *testing.T) {
|
||||
wbb, err := wrapper.WrappedBeaconBlockBody(body)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, body, wbb.Proto())
|
||||
pb, err := wbb.Proto()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, body, pb)
|
||||
}
|
||||
|
||||
func TestAltairBeaconBlock_PbGenericBlock(t *testing.T) {
|
||||
@@ -329,7 +339,8 @@ func TestAltairBeaconBlock_AsSignRequestObject(t *testing.T) {
|
||||
wsb, err := wrapper.WrappedBeaconBlock(abb)
|
||||
require.NoError(t, err)
|
||||
|
||||
sro := wsb.AsSignRequestObject()
|
||||
sro, err := wsb.AsSignRequestObject()
|
||||
require.NoError(t, err)
|
||||
got, ok := sro.(*validatorpb.SignRequest_BlockV2)
|
||||
require.Equal(t, true, ok, "Not a SignRequest_BlockV2")
|
||||
assert.Equal(t, abb, got.BlockV2)
|
||||
|
||||
@@ -49,8 +49,8 @@ func (w bellatrixSignedBeaconBlock) IsNil() bool {
|
||||
}
|
||||
|
||||
// Copy performs a deep copy of the signed beacon block object.
|
||||
func (w bellatrixSignedBeaconBlock) Copy() interfaces.SignedBeaconBlock {
|
||||
return bellatrixSignedBeaconBlock{b: eth.CopySignedBeaconBlockBellatrix(w.b)}
|
||||
func (w bellatrixSignedBeaconBlock) Copy() (interfaces.SignedBeaconBlock, error) {
|
||||
return bellatrixSignedBeaconBlock{b: eth.CopySignedBeaconBlockBellatrix(w.b)}, nil
|
||||
}
|
||||
|
||||
// MarshalSSZ marshals the signed beacon block to its relevant ssz form.
|
||||
@@ -76,8 +76,8 @@ func (w bellatrixSignedBeaconBlock) UnmarshalSSZ(buf []byte) error {
|
||||
}
|
||||
|
||||
// Proto returns the block in its underlying protobuf interface.
|
||||
func (w bellatrixSignedBeaconBlock) Proto() proto.Message {
|
||||
return w.b
|
||||
func (w bellatrixSignedBeaconBlock) Proto() (proto.Message, error) {
|
||||
return w.b, nil
|
||||
}
|
||||
|
||||
// PbGenericBlock returns a generic signed beacon block.
|
||||
@@ -253,8 +253,8 @@ func (w bellatrixBeaconBlock) UnmarshalSSZ(buf []byte) error {
|
||||
|
||||
// Proto returns the underlying block object in its
|
||||
// proto form.
|
||||
func (w bellatrixBeaconBlock) Proto() proto.Message {
|
||||
return w.b
|
||||
func (w bellatrixBeaconBlock) Proto() (proto.Message, error) {
|
||||
return w.b, nil
|
||||
}
|
||||
|
||||
// Version of the underlying protobuf object.
|
||||
@@ -263,10 +263,10 @@ func (bellatrixBeaconBlock) Version() int {
|
||||
}
|
||||
|
||||
// AsSignRequestObject returns the underlying sign request object.
|
||||
func (w bellatrixBeaconBlock) AsSignRequestObject() validatorpb.SignRequestObject {
|
||||
func (w bellatrixBeaconBlock) AsSignRequestObject() (validatorpb.SignRequestObject, error) {
|
||||
return &validatorpb.SignRequest_BlockV3{
|
||||
BlockV3: w.b,
|
||||
}
|
||||
}, nil
|
||||
}
|
||||
|
||||
// bellatrixBeaconBlockBody is a wrapper of a beacon block body.
|
||||
@@ -341,8 +341,8 @@ func (w bellatrixBeaconBlockBody) HashTreeRoot() ([32]byte, error) {
|
||||
|
||||
// Proto returns the underlying proto form of the block
|
||||
// body.
|
||||
func (w bellatrixBeaconBlockBody) Proto() proto.Message {
|
||||
return w.b
|
||||
func (w bellatrixBeaconBlockBody) Proto() (proto.Message, error) {
|
||||
return w.b, nil
|
||||
}
|
||||
|
||||
// Execution returns the Execution payload of the block body.
|
||||
|
||||
@@ -61,7 +61,9 @@ func TestBellatrixSignedBeaconBlock_Block(t *testing.T) {
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(ðpb.SignedBeaconBlockBellatrix{Block: blk})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.DeepEqual(t, blk, wsb.Block().Proto())
|
||||
pb, err := wsb.Block().Proto()
|
||||
require.NoError(t, err)
|
||||
assert.DeepEqual(t, blk, pb)
|
||||
}
|
||||
|
||||
func TestBellatrixSignedBeaconBlock_IsNil(t *testing.T) {
|
||||
@@ -86,7 +88,9 @@ func TestBellatrixSignedBeaconBlock_Proto(t *testing.T) {
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(sb)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, sb, wsb.Proto())
|
||||
pb, err := wsb.Proto()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, sb, pb)
|
||||
}
|
||||
|
||||
func TestBellatrixSignedBeaconBlock_PbPhase0Block(t *testing.T) {
|
||||
@@ -178,7 +182,9 @@ func TestBellatrixBeaconBlock_Body(t *testing.T) {
|
||||
wb, err := wrapper.WrappedBeaconBlock(ðpb.BeaconBlockBellatrix{Body: body})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, body, wb.Body().Proto())
|
||||
pb, err := wb.Body().Proto()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, body, pb)
|
||||
}
|
||||
|
||||
func TestBellatrixBeaconBlock_IsNil(t *testing.T) {
|
||||
@@ -211,7 +217,9 @@ func TestBellatrixBeaconBlock_Proto(t *testing.T) {
|
||||
wb, err := wrapper.WrappedBeaconBlock(blk)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, blk, wb.Proto())
|
||||
pb, err := wb.Proto()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, blk, pb)
|
||||
}
|
||||
|
||||
func TestBellatrixBeaconBlock_SSZ(t *testing.T) {
|
||||
@@ -341,7 +349,9 @@ func TestBellatrixBeaconBlockBody_Proto(t *testing.T) {
|
||||
wbb, err := wrapper.WrappedBeaconBlockBody(body)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, body, wbb.Proto())
|
||||
pb, err := wbb.Proto()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, body, pb)
|
||||
}
|
||||
|
||||
func TestBellatrixBeaconBlockBody_ExecutionPayload(t *testing.T) {
|
||||
@@ -374,7 +384,8 @@ func TestBellatrixBeaconBlock_AsSignRequestObject(t *testing.T) {
|
||||
wsb, err := wrapper.WrappedBeaconBlock(abb)
|
||||
require.NoError(t, err)
|
||||
|
||||
sro := wsb.AsSignRequestObject()
|
||||
sro, err := wsb.AsSignRequestObject()
|
||||
require.NoError(t, err)
|
||||
got, ok := sro.(*validatorpb.SignRequest_BlockV3)
|
||||
require.Equal(t, true, ok, "Not a SignRequest_BlockV3")
|
||||
assert.Equal(t, abb, got.BlockV3)
|
||||
|
||||
@@ -48,8 +48,8 @@ func (w Phase0SignedBeaconBlock) IsNil() bool {
|
||||
|
||||
// Copy performs a deep copy of the signed beacon block
|
||||
// object.
|
||||
func (w Phase0SignedBeaconBlock) Copy() interfaces.SignedBeaconBlock {
|
||||
return wrappedPhase0SignedBeaconBlock(eth.CopySignedBeaconBlock(w.b))
|
||||
func (w Phase0SignedBeaconBlock) Copy() (interfaces.SignedBeaconBlock, error) {
|
||||
return wrappedPhase0SignedBeaconBlock(eth.CopySignedBeaconBlock(w.b)), nil
|
||||
}
|
||||
|
||||
// MarshalSSZ marshals the signed beacon block to its relevant ssz
|
||||
@@ -77,8 +77,8 @@ func (w Phase0SignedBeaconBlock) UnmarshalSSZ(buf []byte) error {
|
||||
|
||||
// Proto returns the block in its underlying protobuf
|
||||
// interface.
|
||||
func (w Phase0SignedBeaconBlock) Proto() proto.Message {
|
||||
return w.b
|
||||
func (w Phase0SignedBeaconBlock) Proto() (proto.Message, error) {
|
||||
return w.b, nil
|
||||
}
|
||||
|
||||
// PbGenericBlock returns a generic signed beacon block.
|
||||
@@ -216,8 +216,8 @@ func (w Phase0BeaconBlock) UnmarshalSSZ(buf []byte) error {
|
||||
|
||||
// Proto returns the underlying block object in its
|
||||
// proto form.
|
||||
func (w Phase0BeaconBlock) Proto() proto.Message {
|
||||
return w.b
|
||||
func (w Phase0BeaconBlock) Proto() (proto.Message, error) {
|
||||
return w.b, nil
|
||||
}
|
||||
|
||||
// Version of the underlying protobuf object.
|
||||
@@ -226,10 +226,10 @@ func (Phase0BeaconBlock) Version() int {
|
||||
}
|
||||
|
||||
// AsSignRequestObject returns the underlying sign request object.
|
||||
func (w Phase0BeaconBlock) AsSignRequestObject() validatorpb.SignRequestObject {
|
||||
func (w Phase0BeaconBlock) AsSignRequestObject() (validatorpb.SignRequestObject, error) {
|
||||
return &validatorpb.SignRequest_Block{
|
||||
Block: w.b,
|
||||
}
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Phase0BeaconBlockBody is a wrapper of a beacon block body.
|
||||
@@ -300,8 +300,8 @@ func (w Phase0BeaconBlockBody) HashTreeRoot() ([32]byte, error) {
|
||||
|
||||
// Proto returns the underlying proto form of the block
|
||||
// body.
|
||||
func (w Phase0BeaconBlockBody) Proto() proto.Message {
|
||||
return w.b
|
||||
func (w Phase0BeaconBlockBody) Proto() (proto.Message, error) {
|
||||
return w.b, nil
|
||||
}
|
||||
|
||||
// Execution is a stub.
|
||||
|
||||
@@ -60,7 +60,8 @@ func TestBeaconBlock_AsSignRequestObject(t *testing.T) {
|
||||
wsb, err := wrapper.WrappedBeaconBlock(abb)
|
||||
require.NoError(t, err)
|
||||
|
||||
sro := wsb.AsSignRequestObject()
|
||||
sro, err := wsb.AsSignRequestObject()
|
||||
require.NoError(t, err)
|
||||
got, ok := sro.(*validatorpb.SignRequest_Block)
|
||||
require.Equal(t, true, ok, "Not a SignRequest_Block")
|
||||
assert.Equal(t, abb, got.Block)
|
||||
|
||||
@@ -49,8 +49,8 @@ func (w signedBlindedBeaconBlockBellatrix) IsNil() bool {
|
||||
}
|
||||
|
||||
// Copy performs a deep copy of the signed beacon block object.
|
||||
func (w signedBlindedBeaconBlockBellatrix) Copy() interfaces.SignedBeaconBlock {
|
||||
return signedBlindedBeaconBlockBellatrix{b: eth.CopySignedBlindedBeaconBlockBellatrix(w.b)}
|
||||
func (w signedBlindedBeaconBlockBellatrix) Copy() (interfaces.SignedBeaconBlock, error) {
|
||||
return signedBlindedBeaconBlockBellatrix{b: eth.CopySignedBlindedBeaconBlockBellatrix(w.b)}, nil
|
||||
}
|
||||
|
||||
// MarshalSSZ marshals the signed beacon block to its relevant ssz form.
|
||||
@@ -76,8 +76,8 @@ func (w signedBlindedBeaconBlockBellatrix) UnmarshalSSZ(buf []byte) error {
|
||||
}
|
||||
|
||||
// Proto returns the block in its underlying protobuf interface.
|
||||
func (w signedBlindedBeaconBlockBellatrix) Proto() proto.Message {
|
||||
return w.b
|
||||
func (w signedBlindedBeaconBlockBellatrix) Proto() (proto.Message, error) {
|
||||
return w.b, nil
|
||||
}
|
||||
|
||||
// PbGenericBlock returns a generic signed beacon block.
|
||||
@@ -220,8 +220,8 @@ func (w blindedBeaconBlockBellatrix) UnmarshalSSZ(buf []byte) error {
|
||||
|
||||
// Proto returns the underlying block object in its
|
||||
// proto form.
|
||||
func (w blindedBeaconBlockBellatrix) Proto() proto.Message {
|
||||
return w.b
|
||||
func (w blindedBeaconBlockBellatrix) Proto() (proto.Message, error) {
|
||||
return w.b, nil
|
||||
}
|
||||
|
||||
// Version of the underlying protobuf object.
|
||||
@@ -230,10 +230,10 @@ func (blindedBeaconBlockBellatrix) Version() int {
|
||||
}
|
||||
|
||||
// AsSignRequestObject returns the underlying sign request object.
|
||||
func (w blindedBeaconBlockBellatrix) AsSignRequestObject() validatorpb.SignRequestObject {
|
||||
func (w blindedBeaconBlockBellatrix) AsSignRequestObject() (validatorpb.SignRequestObject, error) {
|
||||
return &validatorpb.SignRequest_BlindedBlockV3{
|
||||
BlindedBlockV3: w.b,
|
||||
}
|
||||
}, nil
|
||||
}
|
||||
|
||||
// blindedBeaconBlockBodyBellatrix is a wrapper of a beacon block body.
|
||||
@@ -308,8 +308,8 @@ func (w blindedBeaconBlockBodyBellatrix) HashTreeRoot() ([32]byte, error) {
|
||||
|
||||
// Proto returns the underlying proto form of the block
|
||||
// body.
|
||||
func (w blindedBeaconBlockBodyBellatrix) Proto() proto.Message {
|
||||
return w.b
|
||||
func (w blindedBeaconBlockBodyBellatrix) Proto() (proto.Message, error) {
|
||||
return w.b, nil
|
||||
}
|
||||
|
||||
func (w blindedBeaconBlockBodyBellatrix) Execution() (interfaces.ExecutionData, error) {
|
||||
|
||||
@@ -61,7 +61,9 @@ func TestBellatrixSignedBlindedBeaconBlock_Block(t *testing.T) {
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(ðpb.SignedBlindedBeaconBlockBellatrix{Block: blk})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.DeepEqual(t, blk, wsb.Block().Proto())
|
||||
pb, err := wsb.Block().Proto()
|
||||
require.NoError(t, err)
|
||||
assert.DeepEqual(t, blk, pb)
|
||||
}
|
||||
|
||||
func TestBellatrixSignedBlindedBeaconBlock_IsNil(t *testing.T) {
|
||||
@@ -86,7 +88,9 @@ func TestBellatrixSignedBlindedBeaconBlock_Proto(t *testing.T) {
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(sb)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, sb, wsb.Proto())
|
||||
pb, err := wsb.Proto()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, sb, pb)
|
||||
}
|
||||
|
||||
func TestBellatrixSignedBlindedBeaconBlock_PbPhase0Block(t *testing.T) {
|
||||
@@ -190,7 +194,9 @@ func TestBellatrixBlindedBeaconBlock_Body(t *testing.T) {
|
||||
wb, err := wrapper.WrappedBeaconBlock(ðpb.BlindedBeaconBlockBellatrix{Body: body})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, body, wb.Body().Proto())
|
||||
pb, err := wb.Body().Proto()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, body, pb)
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlock_IsNil(t *testing.T) {
|
||||
@@ -224,7 +230,9 @@ func TestBellatrixBlindedBeaconBlock_Proto(t *testing.T) {
|
||||
wb, err := wrapper.WrappedBeaconBlock(blk)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, blk, wb.Proto())
|
||||
pb, err := wb.Proto()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, blk, pb)
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlock_SSZ(t *testing.T) {
|
||||
@@ -354,7 +362,9 @@ func TestBellatrixBlindedBeaconBlockBody_Proto(t *testing.T) {
|
||||
wbb, err := wrapper.WrappedBeaconBlockBody(body)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, body, wbb.Proto())
|
||||
pb, err := wbb.Proto()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, body, pb)
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlockBody_ExecutionPayloadHeader(t *testing.T) {
|
||||
@@ -388,7 +398,8 @@ func TestBellatrixBlindedBeaconBlock_AsSignRequestObject(t *testing.T) {
|
||||
wsb, err := wrapper.WrappedBeaconBlock(abb)
|
||||
require.NoError(t, err)
|
||||
|
||||
sro := wsb.AsSignRequestObject()
|
||||
sro, err := wsb.AsSignRequestObject()
|
||||
require.NoError(t, err)
|
||||
got, ok := sro.(*validatorpb.SignRequest_BlindedBlockV3)
|
||||
require.Equal(t, true, ok, "Not a SignRequest_BlockV3")
|
||||
assert.Equal(t, abb, got.BlindedBlockV3)
|
||||
|
||||
Reference in New Issue
Block a user