Skip to content

Commit

Permalink
fix: real-bidder panic
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci committed Jul 10, 2024
1 parent 3946648 commit dc574de
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions p2p/integrationtest/real-bidder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,25 +224,21 @@ func main() {
continue
}

bundleLen := rand.Intn(10)
bundleStart := rand.Intn(len(currentBlock.txns) - 1)
bundleEnd := bundleStart + bundleLen
if bundleEnd > len(currentBlock.txns) {
bundleEnd = len(currentBlock.txns) - 1
}
bundleStart := rand.Intn(len(currentBlock.txns))
bundleEnd := min(bundleStart+rand.Intn(10), len(currentBlock.txns)-1)

const dMin, dMax = 5000, 10000
startTimeDiff := rand.Int63n(dMax-dMin+1) + dMin
endTimeDiff := rand.Int63n(dMax-dMin+1) + dMin

min := 5000
max := 10000
startTimeDiff := rand.Intn(max-min+1) + min
endTimeDiff := rand.Intn(max-min+1) + min
err = sendBid(
bidderClient,
logger,
rpcClient,
currentBlock.txns[bundleStart:bundleEnd],
currentBlock.blockNum,
(time.Now().UnixMilli())-int64(startTimeDiff),
(time.Now().UnixMilli())+int64(endTimeDiff),
time.Now().UnixMilli()-startTimeDiff,
time.Now().UnixMilli()+endTimeDiff,
)
if err != nil {
logger.Error("failed to send bid", "err", err)
Expand Down

0 comments on commit dc574de

Please sign in to comment.