-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
e.g. https://github.com/filecoin-project/lotus/actions/runs/14933637490/job/41955873252?pr=13115
I'm pretty sure this is just a race where the chain moves on while observing it. I think the api_v2_test.go
tests need a variant of the stableExecute
in eth_api_f3_test.go
to ensure that a test run doesn't straddle tipsets:
lotus/itests/eth_api_f3_test.go
Lines 826 to 849 in 54bd2c7
mkStableExecute := func(wantTipSet func(t *testing.T) *types.TipSet) func(fn func()) *types.TipSet { | |
if wantTipSet == nil { | |
wantTipSet = func(t *testing.T) *types.TipSet { return nil } | |
} | |
// stableExecute is a helper that will execute a function required by the test case | |
// repeatedly until the tipset observed before is the same as after execution of the | |
// function. This helps reduce flakies that come from reorgs between capturing the tipset | |
// and executing the function. | |
// Unfortunately it doesn't remove the problem entirely as we could have multiple reorgs | |
// off the tipset we observe and then back to it, but it should be extremely rare. | |
return func(fn func()) *types.TipSet { | |
beforeTs := wantTipSet(t) | |
for { | |
fn() | |
afterTs := wantTipSet(t) | |
if beforeTs.Equals(afterTs) { | |
// it seems that the chain hasn't changed while executing, so it ought to be safe to | |
// tell the test function that this is the tipset against which they executed | |
return beforeTs | |
} | |
beforeTs = afterTs | |
} | |
} | |
} |
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
🎉 Done