Skip to content

Flaky: itest TestAPIV2_ThroughRPC #13116

@rvagg

Description

@rvagg

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:

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🎉 Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions