mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 23:48:06 -05:00
Refactor p2p requests: extract BeaconBlocksByRangeRequest and BeaconBlocksByRootRequest (#7718)
* extract SendBeaconBlocksByRangeRequest * adds extra processing * extract SendBeaconBlocksByRootRequest * extract into rpc_send_request.go * add tests * more tests * gazelle * remove redundant import * for consistency * for consistency Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -633,7 +633,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
|
||||
validate: func(req *p2ppb.BeaconBlocksByRangeRequest, blocks []*eth.SignedBeaconBlock) {
|
||||
assert.Equal(t, 0, len(blocks))
|
||||
},
|
||||
wantedErr: errInvalidFetchedData.Error(),
|
||||
wantedErr: beaconsync.ErrInvalidFetchedData.Error(),
|
||||
},
|
||||
{
|
||||
name: "not in a consecutive order",
|
||||
@@ -657,7 +657,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
|
||||
validate: func(req *p2ppb.BeaconBlocksByRangeRequest, blocks []*eth.SignedBeaconBlock) {
|
||||
assert.Equal(t, 0, len(blocks))
|
||||
},
|
||||
wantedErr: errInvalidFetchedData.Error(),
|
||||
wantedErr: beaconsync.ErrInvalidFetchedData.Error(),
|
||||
},
|
||||
{
|
||||
name: "same slot number",
|
||||
@@ -681,7 +681,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
|
||||
validate: func(req *p2ppb.BeaconBlocksByRangeRequest, blocks []*eth.SignedBeaconBlock) {
|
||||
assert.Equal(t, 0, len(blocks))
|
||||
},
|
||||
wantedErr: errInvalidFetchedData.Error(),
|
||||
wantedErr: beaconsync.ErrInvalidFetchedData.Error(),
|
||||
},
|
||||
{
|
||||
name: "slot is too low",
|
||||
@@ -709,7 +709,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
|
||||
}
|
||||
}
|
||||
},
|
||||
wantedErr: errInvalidFetchedData.Error(),
|
||||
wantedErr: beaconsync.ErrInvalidFetchedData.Error(),
|
||||
validate: func(req *p2ppb.BeaconBlocksByRangeRequest, blocks []*eth.SignedBeaconBlock) {
|
||||
assert.Equal(t, 0, len(blocks))
|
||||
},
|
||||
@@ -740,7 +740,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
|
||||
}
|
||||
}
|
||||
},
|
||||
wantedErr: errInvalidFetchedData.Error(),
|
||||
wantedErr: beaconsync.ErrInvalidFetchedData.Error(),
|
||||
validate: func(req *p2ppb.BeaconBlocksByRangeRequest, blocks []*eth.SignedBeaconBlock) {
|
||||
assert.Equal(t, 0, len(blocks))
|
||||
},
|
||||
@@ -790,7 +790,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
|
||||
validate: func(req *p2ppb.BeaconBlocksByRangeRequest, blocks []*eth.SignedBeaconBlock) {
|
||||
assert.Equal(t, 0, len(blocks))
|
||||
},
|
||||
wantedErr: errInvalidFetchedData.Error(),
|
||||
wantedErr: beaconsync.ErrInvalidFetchedData.Error(),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user