Fix flaky/environment-dependent tests (macOS) - #4115
Conversation
recoverAndLog printed the panic and stack trace unconditionally, then also invoked the panic hook if one was set. Tests that install a hook to capture panics were getting the default stderr logging on top of it, adding noise. Fall back to the default logging only when no hook handles the panic.
TestFreezeModeDisablesMempoolTraffic reserved an RPC listen address via tcp.TestReserveAddr and handed it to node Start, but net.Listen cannot adopt a reservation made by closing a :0 bind, and that address is stealable by another process on macOS in the window between reservation and Start. The test only calls rpcEnv in-process, so skip the TCP listener entirely by leaving RPC.ListenAddress empty.
NewMinter derived the minter's start/end dates from local wall-clock time, so the recorded calendar dates could shift by a day relative to the block time depending on the local timezone, making the test flaky outside UTC. Anchor start/end to UTC calendar dates instead. MintRelease independently recomputed the expected release amount from parsed start/end dates rather than through the minter's own release calculation, which no longer agreed with the UTC-anchored dates. Use Minter.GetReleaseAmountToday instead of re-deriving it.
PR SummaryLow Risk Overview In evmrpc, recovered panics now only invoke Mint processblock tests build minter start/end from UTC midnight calendar dates instead of local
Reviewed by Cursor Bugbot for commit afac58d. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4115 +/- ##
==========================================
- Coverage 61.21% 60.25% -0.97%
==========================================
Files 2196 2087 -109
Lines 193436 180445 -12991
==========================================
- Hits 118416 108719 -9697
+ Misses 63790 61580 -2210
+ Partials 11230 10146 -1084
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Three small, well-targeted flake fixes: the evmrpc panic-hook change keeps its only test passing unchanged and leaves production logging intact (no hook is set outside tests), and dropping the RPC listener from TestFreezeModeDisablesMempoolTraffic is safe since every assertion goes through rpcEnv in-process. The mint fix is right in direction, but the new expected-amount computation uses the block time instead of the epoch start time the mint hook actually uses, leaving a narrow midnight-crossing window.
Findings: 0 blocking | 1 non-blocking | 1 posted inline
Blockers
- None at the file/PR level.
Non-blocking
- None at the file/PR level.
- 1 suggestion(s)/nit(s) flagged inline on specific lines.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6cefa3e. Configure here.
Review feedback (seidroid, Cursor Bugbot) on the previous commit: MintRelease computed the expected release amount from the post-block BlockTime, but AfterEpochEnd computes the actual mint from the ended epoch's own CurrentEpochStartTime. Those two timestamps are roughly one epoch duration apart, so they can land on different UTC calendar dates around midnight and reintroduce the same flake this test was fixed to remove. oldEpoch already holds the timestamp the hook used.
giga/deps/testutil/processblock carries a copy of NewMinter and MintRelease with the same timezone- and BlockTime-dependent bugs just fixed in testutil/processblock. Apply the identical fixes here: UTC-anchored start/end calendar dates, and computing the expected release amount via Minter.GetReleaseAmountToday(oldEpoch.CurrentEpochStartTime) instead of re-deriving it by hand.

Summary
TestFreezeModeDisablesMempoolTrafficflaking on macOS: it reserved a listen address viaTestReserveAddrand handed it tonode.Start, butnet.Listencan't adopt that reservation and the freed:0bind is stealable by another process in the window beforeStartruns; the test only callsrpcEnvin-process, so skip the TCP listener entirelyNewMinterderived start/end dates from local wall-clock time instead of UTC calendar dates, andMintReleasere-derived the expected release amount by hand instead of viaMinter.GetReleaseAmountTodayTest plan
go test ./evmrpc/...go test ./sei-tendermint/node/...go test ./testutil/processblock/...