File tree 3 files changed +48
-6
lines changed
beacon-chain/rpc/prysm/v1alpha1/validator
3 files changed +48
-6
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,10 @@ go_library(
4
4
name = "go_default_library" ,
5
5
srcs = [
6
6
"aggregator.go" ,
7
- "duties.go" ,
8
7
"attester.go" ,
9
8
"blocks.go" ,
10
9
"construct_generic_block.go" ,
10
+ "duties.go" ,
11
11
"exit.go" ,
12
12
"log.go" ,
13
13
"proposer.go" ,
@@ -179,10 +179,10 @@ go_test(
179
179
timeout = "moderate" ,
180
180
srcs = [
181
181
"aggregator_test.go" ,
182
- "duties_test.go" ,
183
182
"attester_test.go" ,
184
183
"blocks_test.go" ,
185
184
"construct_generic_block_test.go" ,
185
+ "duties_test.go" ,
186
186
"exit_test.go" ,
187
187
"proposer_altair_test.go" ,
188
188
"proposer_attestations_test.go" ,
@@ -201,6 +201,7 @@ go_test(
201
201
"status_mainnet_test.go" ,
202
202
"status_test.go" ,
203
203
"sync_committee_test.go" ,
204
+ "unblinder_test.go" ,
204
205
"validator_test.go" ,
205
206
],
206
207
embed = [":go_default_library" ],
Original file line number Diff line number Diff line change @@ -13,15 +13,22 @@ import (
13
13
)
14
14
15
15
func unblindBlobsSidecars (block interfaces.SignedBeaconBlock , bundle * enginev1.BlobsBundle ) ([]* ethpb.BlobSidecar , error ) {
16
- if block .Version () < version .Deneb || bundle == nil {
16
+ if block .Version () < version .Deneb {
17
17
return nil , nil
18
18
}
19
- header , err := block .Header ()
19
+ body := block .Block ().Body ()
20
+ blockCommitments , err := body .BlobKzgCommitments ()
20
21
if err != nil {
21
22
return nil , err
22
23
}
23
- body := block .Block ().Body ()
24
- blockCommitments , err := body .BlobKzgCommitments ()
24
+ if len (blockCommitments ) == 0 {
25
+ return nil , nil
26
+ }
27
+ // Do not allow builders to provide no blob bundles for blocks which carry commitments.
28
+ if bundle == nil {
29
+ return nil , errors .New ("no valid bundle provided" )
30
+ }
31
+ header , err := block .Header ()
25
32
if err != nil {
26
33
return nil , err
27
34
}
Original file line number Diff line number Diff line change
1
+ package validator
2
+
3
+ import (
4
+ "testing"
5
+
6
+ consensusblocks "github.com/prysmaticlabs/prysm/v5/consensus-types/blocks"
7
+ ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
8
+ "github.com/prysmaticlabs/prysm/v5/testing/assert"
9
+ )
10
+
11
+ func TestUnblinder_UnblindBlobSidecars_InvalidBundle (t * testing.T ) {
12
+ wBlock , err := consensusblocks .NewSignedBeaconBlock (& ethpb.SignedBeaconBlockDeneb {
13
+ Block : & ethpb.BeaconBlockDeneb {
14
+ Body : & ethpb.BeaconBlockBodyDeneb {},
15
+ },
16
+ Signature : nil ,
17
+ })
18
+ assert .NoError (t , err )
19
+ _ , err = unblindBlobsSidecars (wBlock , nil )
20
+ assert .NoError (t , err )
21
+
22
+ wBlock , err = consensusblocks .NewSignedBeaconBlock (& ethpb.SignedBeaconBlockDeneb {
23
+ Block : & ethpb.BeaconBlockDeneb {
24
+ Body : & ethpb.BeaconBlockBodyDeneb {
25
+ BlobKzgCommitments : [][]byte {[]byte ("a" ), []byte ("b" )},
26
+ },
27
+ },
28
+ Signature : nil ,
29
+ })
30
+ assert .NoError (t , err )
31
+ _ , err = unblindBlobsSidecars (wBlock , nil )
32
+ assert .ErrorContains (t , "no valid bundle provided" , err )
33
+
34
+ }
You can’t perform that action at this time.
0 commit comments