Update proposer RPC to new blob sidecar format (#13189)

This commit is contained in:
terence
2023-11-27 15:44:52 -08:00
committed by GitHub
parent cd8d499198
commit 7cc05401ca
24 changed files with 237 additions and 336 deletions

View File

@@ -57,7 +57,7 @@ func NewSignedBeaconBlock(i interface{}) (interfaces.SignedBeaconBlock, error) {
case *eth.SignedBlindedBeaconBlockCapella:
return initBlindedSignedBlockFromProtoCapella(b)
case *eth.GenericSignedBeaconBlock_Deneb:
return initSignedBlockFromProtoDeneb(b.Deneb.Block)
return initSignedBlockFromProtoDeneb(b.Deneb)
case *eth.SignedBeaconBlockDeneb:
return initSignedBlockFromProtoDeneb(b)
case *eth.SignedBlindedBeaconBlockDeneb:
@@ -99,7 +99,7 @@ func NewBeaconBlock(i interface{}) (interfaces.ReadOnlyBeaconBlock, error) {
case *eth.BlindedBeaconBlockCapella:
return initBlindedBlockFromProtoCapella(b)
case *eth.GenericBeaconBlock_Deneb:
return initBlockFromProtoDeneb(b.Deneb.Block)
return initBlockFromProtoDeneb(b.Deneb)
case *eth.BeaconBlockDeneb:
return initBlockFromProtoDeneb(b)
case *eth.BlindedBeaconBlockDeneb:

View File

@@ -123,11 +123,10 @@ func Test_NewSignedBeaconBlock(t *testing.T) {
})
t.Run("GenericSignedBeaconBlock_Deneb", func(t *testing.T) {
pb := &eth.GenericSignedBeaconBlock_Deneb{
Deneb: &eth.SignedBeaconBlockAndBlobsDeneb{
Block: &eth.SignedBeaconBlockDeneb{
Block: &eth.BeaconBlockDeneb{
Body: &eth.BeaconBlockBodyDeneb{},
}}}}
Deneb: &eth.SignedBeaconBlockDeneb{
Block: &eth.BeaconBlockDeneb{
Body: &eth.BeaconBlockBodyDeneb{},
}}}
b, err := NewSignedBeaconBlock(pb)
require.NoError(t, err)
assert.Equal(t, version.Deneb, b.Version())
@@ -249,9 +248,9 @@ 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.BeaconBlockAndBlobsDeneb{Block: &eth.BeaconBlockDeneb{
pb := &eth.GenericBeaconBlock_Deneb{Deneb: &eth.BeaconBlockDeneb{
Body: &eth.BeaconBlockBodyDeneb{},
}}}
}}
b, err := NewBeaconBlock(pb)
require.NoError(t, err)
assert.Equal(t, version.Deneb, b.Version())

View File

@@ -126,9 +126,7 @@ func (b *SignedBeaconBlock) PbGenericBlock() (*eth.GenericSignedBeaconBlock, err
}, nil
}
return &eth.GenericSignedBeaconBlock{
Block: &eth.GenericSignedBeaconBlock_Deneb{Deneb: &eth.SignedBeaconBlockAndBlobsDeneb{
Block: pb.(*eth.SignedBeaconBlockDeneb),
}},
Block: &eth.GenericSignedBeaconBlock_Deneb{Deneb: pb.(*eth.SignedBeaconBlockDeneb)},
}, nil
default:
return nil, errIncorrectBlockVersion

View File

@@ -27,7 +27,7 @@ func NewSignedBeaconBlockFromGeneric(gb *eth.GenericSignedBeaconBlock) (interfac
case *eth.GenericSignedBeaconBlock_BlindedCapella:
return blocks.NewSignedBeaconBlock(bb.BlindedCapella)
case *eth.GenericSignedBeaconBlock_Deneb:
return blocks.NewSignedBeaconBlock(bb.Deneb.Block)
return blocks.NewSignedBeaconBlock(bb.Deneb)
case *eth.GenericSignedBeaconBlock_BlindedDeneb:
return blocks.NewSignedBeaconBlock(bb.BlindedDeneb.SignedBlindedBlock)
// Generic Signed Beacon Block Deneb can't be used here as it is not a block, but block content with blobs