Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions beacon-chain/rpc/eth/beacon/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,6 @@ func TestGetSpec(t *testing.T) {
assert.Equal(t, "2", v)
case "REORG_WEIGHT_THRESHOLD":
assert.Equal(t, "20", v)
case "REORG_PARENT_WEIGHT_THRESHOLD":
assert.Equal(t, "160", v)
case "SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY":
default:
t.Errorf("Incorrect key: %s", k)
Expand Down
8 changes: 4 additions & 4 deletions consensus-types/blocks/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ func NewSignedBeaconBlock(i interface{}) (interfaces.SignedBeaconBlock, error) {
return initSignedBlockFromProtoDeneb(b)
case *eth.SignedBlindedBeaconBlockDeneb:
return initBlindedSignedBlockFromProtoDeneb(b)
case *eth.GenericSignedBeaconBlock_Blinded_Deneb:
return initBlindedSignedBlockFromProtoDeneb(b.Blinded_Deneb.Block)
case *eth.GenericSignedBeaconBlock_BlindedDeneb:
return initBlindedSignedBlockFromProtoDeneb(b.BlindedDeneb.Block)
default:
return nil, errors.Wrapf(ErrUnsupportedSignedBeaconBlock, "unable to create block from type %T", i)
}
Expand Down Expand Up @@ -104,8 +104,8 @@ func NewBeaconBlock(i interface{}) (interfaces.ReadOnlyBeaconBlock, error) {
return initBlockFromProtoDeneb(b)
case *eth.BlindedBeaconBlockDeneb:
return initBlindedBlockFromProtoDeneb(b)
case *eth.GenericBeaconBlock_Blinded_Deneb:
return initBlindedBlockFromProtoDeneb(b.Blinded_Deneb.Block)
case *eth.GenericBeaconBlock_BlindedDeneb:
return initBlindedBlockFromProtoDeneb(b.BlindedDeneb.Block)
default:
return nil, errors.Wrapf(errUnsupportedBeaconBlock, "unable to create block from type %T", i)
}
Expand Down
8 changes: 4 additions & 4 deletions consensus-types/blocks/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ func Test_NewSignedBeaconBlock(t *testing.T) {
assert.Equal(t, true, b.IsBlinded())
})
t.Run("GenericSignedBeaconBlock_BlindedDeneb", func(t *testing.T) {
pb := &eth.GenericSignedBeaconBlock_Blinded_Deneb{
Blinded_Deneb: &eth.SignedBlindedBeaconBlockDenebAndBlobs{
pb := &eth.GenericSignedBeaconBlock_BlindedDeneb{
BlindedDeneb: &eth.SignedBlindedBeaconBlockAndBlobsDeneb{
Block: &eth.SignedBlindedBeaconBlockDeneb{
Block: &eth.BlindedBeaconBlockDeneb{
Body: &eth.BlindedBeaconBlockBodyDeneb{},
Expand Down Expand Up @@ -249,7 +249,7 @@ func Test_NewBeaconBlock(t *testing.T) {
assert.Equal(t, true, b.IsBlinded())
})
t.Run("GenericBeaconBlock_Deneb", func(t *testing.T) {
pb := &eth.GenericBeaconBlock_Deneb{Deneb: &eth.BeaconBlockDenebAndBlobs{Block: &eth.BeaconBlockDeneb{
pb := &eth.GenericBeaconBlock_Deneb{Deneb: &eth.BeaconBlockAndBlobsDeneb{Block: &eth.BeaconBlockDeneb{
Body: &eth.BeaconBlockBodyDeneb{},
}}}
b, err := NewBeaconBlock(pb)
Expand All @@ -270,7 +270,7 @@ func Test_NewBeaconBlock(t *testing.T) {
assert.Equal(t, true, b.IsBlinded())
})
t.Run("GenericBeaconBlock_BlindedDeneb", func(t *testing.T) {
pb := &eth.GenericBeaconBlock_Blinded_Deneb{Blinded_Deneb: &eth.BlindedBeaconBlockDenebAndBlobs{Block: &eth.BlindedBeaconBlockDeneb{Body: &eth.BlindedBeaconBlockBodyDeneb{}}}}
pb := &eth.GenericBeaconBlock_BlindedDeneb{BlindedDeneb: &eth.BlindedBeaconBlockAndBlobsDeneb{Block: &eth.BlindedBeaconBlockDeneb{Body: &eth.BlindedBeaconBlockBodyDeneb{}}}}
b, err := NewBeaconBlock(pb)
require.NoError(t, err)
assert.Equal(t, version.Deneb, b.Version())
Expand Down
14 changes: 14 additions & 0 deletions consensus-types/blocks/getters.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ func (b *SignedBeaconBlock) PbGenericBlock() (*eth.GenericSignedBeaconBlock, err
return &eth.GenericSignedBeaconBlock{
Block: &eth.GenericSignedBeaconBlock_Capella{Capella: pb.(*eth.SignedBeaconBlockCapella)},
}, nil
case version.Deneb:
if b.IsBlinded() {
return &eth.GenericSignedBeaconBlock{
Block: &eth.GenericSignedBeaconBlock_BlindedDeneb{BlindedDeneb: pb.(*eth.SignedBlindedBeaconBlockAndBlobsDeneb)},
}, nil
}
return &eth.GenericSignedBeaconBlock{
Block: &eth.GenericSignedBeaconBlock_Deneb{Deneb: pb.(*eth.SignedBeaconBlockAndBlobsDeneb)},
}, nil
default:
return nil, errIncorrectBlockVersion
}
Expand Down Expand Up @@ -870,6 +879,11 @@ func (b *BeaconBlock) AsSignRequestObject() (validatorpb.SignRequestObject, erro
return &validatorpb.SignRequest_BlindedBlockCapella{BlindedBlockCapella: pb.(*eth.BlindedBeaconBlockCapella)}, nil
}
return &validatorpb.SignRequest_BlockCapella{BlockCapella: pb.(*eth.BeaconBlockCapella)}, nil
case version.Deneb:
if b.IsBlinded() {
return &validatorpb.SignRequest_BlindedBlockDeneb{BlindedBlockDeneb: pb.(*eth.BlindedBeaconBlockDeneb)}, nil
}
return &validatorpb.SignRequest_BlockDeneb{BlockDeneb: pb.(*eth.BeaconBlockDeneb)}, nil
default:
return nil, errIncorrectBlockVersion
}
Expand Down
1 change: 1 addition & 0 deletions consensus-types/blocks/testing/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func NewSignedBeaconBlockFromGeneric(gb *eth.GenericSignedBeaconBlock) (interfac
return blocks.NewSignedBeaconBlock(bb.Capella)
case *eth.GenericSignedBeaconBlock_BlindedCapella:
return blocks.NewSignedBeaconBlock(bb.BlindedCapella)
// Generic Signed Beacon Block Deneb can't be used here as it is not a block, but block content with blobs
default:
return nil, errors.Wrapf(blocks.ErrUnsupportedSignedBeaconBlock, "unable to create block from type %T", gb)
}
Expand Down
Loading