Compare commits

...

1 Commits

Author SHA1 Message Date
Kasey Kirkham
4c14c6dbd7 test stil fails but patch shows hunch 2024-02-16 09:03:48 -06:00

View File

@@ -498,18 +498,18 @@ func TestRPCBeaconBlocksByRange_RPCHandlerRateLimitOverflow(t *testing.T) {
p1.Connect(p2)
assert.Equal(t, 1, len(p1.BHost.Network().Peers()), "Expected peers to be connected")
capacity := int64(flags.Get().BlockBatchLimit * 3)
clock := startup.NewClock(time.Unix(0, 0), [32]byte{})
capacity := int64(params.MaxRequestBlock(slots.ToEpoch(clock.CurrentSlot())))
r := &Service{cfg: &config{p2p: p1, beaconDB: d, clock: clock, chain: &chainMock.ChainService{}}, availableBlocker: mockBlocker{avail: true}, rateLimiter: newRateLimiter(p1)}
pcl := protocol.ID(p2p.RPCBlocksByRangeTopicV1)
topic := string(pcl)
r.rateLimiter.limiterMap[topic] = leakybucket.NewCollector(0.000001, capacity, time.Second, false)
r.rateLimiter.limiterMap[topic] = leakybucket.NewCollector(0.000001, capacity-1, time.Second, false)
req := &ethpb.BeaconBlocksByRangeRequest{
StartSlot: 100,
Step: 5,
Count: uint64(capacity + 1),
Count: uint64(capacity),
}
saveBlocks(req)
@@ -529,8 +529,9 @@ func TestRPCBeaconBlocksByRange_RPCHandlerRateLimitOverflow(t *testing.T) {
p1.Connect(p2)
assert.Equal(t, 1, len(p1.BHost.Network().Peers()), "Expected peers to be connected")
capacity := int64(flags.Get().BlockBatchLimit * flags.Get().BlockBatchLimitBurstFactor)
clock := startup.NewClock(time.Unix(0, 0), [32]byte{})
capacity := int64(params.MaxRequestBlock(slots.ToEpoch(clock.CurrentSlot()))) - 1
r := &Service{cfg: &config{p2p: p1, beaconDB: d, clock: clock, chain: &chainMock.ChainService{}}, availableBlocker: mockBlocker{avail: true}, rateLimiter: newRateLimiter(p1)}
pcl := protocol.ID(p2p.RPCBlocksByRangeTopicV1)
topic := string(pcl)