mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
parent
65b90abdda
commit
38f208d70d
@ -4,10 +4,10 @@ go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"aggregator.go",
|
||||
"duties.go",
|
||||
"attester.go",
|
||||
"blocks.go",
|
||||
"construct_generic_block.go",
|
||||
"duties.go",
|
||||
"exit.go",
|
||||
"log.go",
|
||||
"proposer.go",
|
||||
@ -179,10 +179,10 @@ go_test(
|
||||
timeout = "moderate",
|
||||
srcs = [
|
||||
"aggregator_test.go",
|
||||
"duties_test.go",
|
||||
"attester_test.go",
|
||||
"blocks_test.go",
|
||||
"construct_generic_block_test.go",
|
||||
"duties_test.go",
|
||||
"exit_test.go",
|
||||
"proposer_altair_test.go",
|
||||
"proposer_attestations_test.go",
|
||||
@ -201,6 +201,7 @@ go_test(
|
||||
"status_mainnet_test.go",
|
||||
"status_test.go",
|
||||
"sync_committee_test.go",
|
||||
"unblinder_test.go",
|
||||
"validator_test.go",
|
||||
],
|
||||
embed = [":go_default_library"],
|
||||
|
@ -13,18 +13,25 @@ import (
|
||||
)
|
||||
|
||||
func unblindBlobsSidecars(block interfaces.SignedBeaconBlock, bundle *enginev1.BlobsBundle) ([]*ethpb.BlobSidecar, error) {
|
||||
if block.Version() < version.Deneb || bundle == nil {
|
||||
if block.Version() < version.Deneb {
|
||||
return nil, nil
|
||||
}
|
||||
header, err := block.Header()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
body := block.Block().Body()
|
||||
blockCommitments, err := body.BlobKzgCommitments()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(blockCommitments) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
// Do not allow builders to provide no blob bundles for blocks which carry commitments.
|
||||
if bundle == nil {
|
||||
return nil, errors.New("no valid bundle provided")
|
||||
}
|
||||
header, err := block.Header()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Ensure there are equal counts of blobs/commitments/proofs.
|
||||
if len(bundle.KzgCommitments) != len(bundle.Blobs) {
|
||||
|
34
beacon-chain/rpc/prysm/v1alpha1/validator/unblinder_test.go
Normal file
34
beacon-chain/rpc/prysm/v1alpha1/validator/unblinder_test.go
Normal file
@ -0,0 +1,34 @@
|
||||
package validator
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
consensusblocks "github.com/prysmaticlabs/prysm/v5/consensus-types/blocks"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
)
|
||||
|
||||
func TestUnblinder_UnblindBlobSidecars_InvalidBundle(t *testing.T) {
|
||||
wBlock, err := consensusblocks.NewSignedBeaconBlock(ðpb.SignedBeaconBlockDeneb{
|
||||
Block: ðpb.BeaconBlockDeneb{
|
||||
Body: ðpb.BeaconBlockBodyDeneb{},
|
||||
},
|
||||
Signature: nil,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
_, err = unblindBlobsSidecars(wBlock, nil)
|
||||
assert.NoError(t, err)
|
||||
|
||||
wBlock, err = consensusblocks.NewSignedBeaconBlock(ðpb.SignedBeaconBlockDeneb{
|
||||
Block: ðpb.BeaconBlockDeneb{
|
||||
Body: ðpb.BeaconBlockBodyDeneb{
|
||||
BlobKzgCommitments: [][]byte{[]byte("a"), []byte("b")},
|
||||
},
|
||||
},
|
||||
Signature: nil,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
_, err = unblindBlobsSidecars(wBlock, nil)
|
||||
assert.ErrorContains(t, "no valid bundle provided", err)
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user