mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Replace a Few IntFlags with Uint64Flags (#9959)
* use uints instead of ints * fix method * fix * fix * builds * deepsource * deep source
This commit is contained in:
@@ -372,7 +372,7 @@ func TestBlocksFetcher_RoundRobin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestBlocksFetcher_scheduleRequest(t *testing.T) {
|
||||
blockBatchLimit := uint64(flags.Get().BlockBatchLimit)
|
||||
blockBatchLimit := flags.Get().BlockBatchLimit
|
||||
t.Run("context cancellation", func(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
fetcher := newBlocksFetcher(ctx, &blocksFetcherConfig{})
|
||||
@@ -426,7 +426,7 @@ func TestBlocksFetcher_handleRequest(t *testing.T) {
|
||||
})
|
||||
|
||||
cancel()
|
||||
response := fetcher.handleRequest(ctx, 1, uint64(blockBatchLimit))
|
||||
response := fetcher.handleRequest(ctx, 1, blockBatchLimit)
|
||||
assert.ErrorContains(t, "context canceled", response.err)
|
||||
})
|
||||
|
||||
@@ -441,7 +441,7 @@ func TestBlocksFetcher_handleRequest(t *testing.T) {
|
||||
requestCtx, reqCancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
defer reqCancel()
|
||||
go func() {
|
||||
response := fetcher.handleRequest(requestCtx, 1 /* start */, uint64(blockBatchLimit) /* count */)
|
||||
response := fetcher.handleRequest(requestCtx, 1 /* start */, blockBatchLimit /* count */)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
case fetcher.fetchResponses <- response:
|
||||
@@ -459,7 +459,7 @@ func TestBlocksFetcher_handleRequest(t *testing.T) {
|
||||
blocks = resp.blocks
|
||||
}
|
||||
}
|
||||
if uint64(len(blocks)) != uint64(blockBatchLimit) {
|
||||
if uint64(len(blocks)) != blockBatchLimit {
|
||||
t.Errorf("incorrect number of blocks returned, expected: %v, got: %v", blockBatchLimit, len(blocks))
|
||||
}
|
||||
|
||||
@@ -510,11 +510,11 @@ func TestBlocksFetcher_requestBeaconBlocksByRange(t *testing.T) {
|
||||
req := &p2ppb.BeaconBlocksByRangeRequest{
|
||||
StartSlot: 1,
|
||||
Step: 1,
|
||||
Count: uint64(blockBatchLimit),
|
||||
Count: blockBatchLimit,
|
||||
}
|
||||
blocks, err := fetcher.requestBlocks(ctx, req, peerIDs[0])
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, uint64(blockBatchLimit), uint64(len(blocks)), "Incorrect number of blocks returned")
|
||||
assert.Equal(t, blockBatchLimit, uint64(len(blocks)), "Incorrect number of blocks returned")
|
||||
|
||||
// Test context cancellation.
|
||||
ctx, cancel = context.WithCancel(context.Background())
|
||||
|
||||
Reference in New Issue
Block a user