Skip to content

Commit 65228b1

Browse files
authored
Poll for EVM-only receipts in the Autobahn load test (#4704)
`TestAutobahn/EVMOnlyLoad` flakes with "node N returned null for finalized EVM-only receipt". `waitForEVMOnlyTxs` returns once every validator's execute-stage metrics reach the target, and `assertEVMOnlyReceipts` then reads each receipt exactly once. `eth_getTransactionReceipt` answers `null` until the receipt's block is within `Info().LastBlockHeight`, which `evmOnlyApplication.Commit` advances only after execution, so a node that has executed the block but not yet committed it returns `null`. `assertEVMOnlyReceipts` now polls each node until its receipt is non-null, bounded by the load test's context, and then checks the receipt fields as before. The per-node poll loop is lifted out of `waitForEVMOnlyResult` into `waitForEVMOnlyNodeResult`, which both use, so the retry behaviour matches the other EVM-only RPC assertions. RPC errors and wrong receipt fields still fail immediately. Flaked in: https://github.com/sei-protocol/sei-chain/actions/runs/41438263888/job/125255347616
1 parent b1f0d1c commit 65228b1

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

‎integration_test/autobahn/autobahn_test.go‎

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -903,12 +903,8 @@ func assertEVMOnlyReceipts(t *testing.T, ctx context.Context, clients []*ethrpc.
903903
TransactionHash common.Hash `json:"transactionHash"`
904904
TransactionIndex hexutil.Uint64 `json:"transactionIndex"`
905905
}
906-
if err := client.CallContext(ctx, &got, "eth_getTransactionReceipt", txHash); err != nil {
907-
t.Fatalf("read EVM-only receipt %s from node %d: %v", txHash, nodeIndex, err)
908-
}
909-
if got == nil {
910-
t.Fatalf("node %d returned null for finalized EVM-only receipt %s", nodeIndex, txHash)
911-
}
906+
raw := waitForEVMOnlyNodeResult(t, ctx, client, nodeIndex, "eth_getTransactionReceipt", txHash)
907+
decodeEVMOnlyResult(t, nodeIndex, "eth_getTransactionReceipt", raw, &got)
912908
if got.BlockHash == (common.Hash{}) {
913909
t.Fatalf("node %d returned an empty block hash for receipt %s", nodeIndex, txHash)
914910
}
@@ -1092,24 +1088,29 @@ func waitForEVMOnlyResult(t *testing.T, ctx context.Context, clients []*ethrpc.C
10921088
t.Helper()
10931089
var first json.RawMessage
10941090
for nodeIndex, client := range clients {
1095-
for {
1096-
raw := evmOnlyCall(t, ctx, client, nodeIndex, method, args...)
1097-
if string(raw) != "null" {
1098-
if nodeIndex == 0 {
1099-
first = raw
1100-
}
1101-
break
1102-
}
1103-
select {
1104-
case <-ctx.Done():
1105-
t.Fatalf("node %d %s%v stayed null: %v", nodeIndex, method, args, ctx.Err())
1106-
case <-time.After(evmOnlyRPCPoll):
1107-
}
1091+
raw := waitForEVMOnlyNodeResult(t, ctx, client, nodeIndex, method, args...)
1092+
if nodeIndex == 0 {
1093+
first = raw
11081094
}
11091095
}
11101096
return first
11111097
}
11121098

1099+
// waitForEVMOnlyNodeResult polls method on node nodeIndex until it answers
1100+
// non-null, and returns that answer.
1101+
func waitForEVMOnlyNodeResult(t *testing.T, ctx context.Context, client *ethrpc.Client, nodeIndex int, method string, args ...any) json.RawMessage {
1102+
t.Helper()
1103+
for ctx.Err() == nil {
1104+
raw := evmOnlyCall(t, ctx, client, nodeIndex, method, args...)
1105+
if string(raw) != "null" {
1106+
return raw
1107+
}
1108+
time.Sleep(evmOnlyRPCPoll)
1109+
}
1110+
t.Fatalf("node %d %s%v stayed null: %v", nodeIndex, method, args, ctx.Err())
1111+
return nil
1112+
}
1113+
11131114
// assertEVMOnlyBlockQueries checks every block-scoped method against the block
11141115
// that executed raw, on every node: the block lists raw at its receipt's index,
11151116
// lookups by number, by hash, and by index agree with each other and with

0 commit comments

Comments
 (0)