cardano-testnet | Fix flaky height check in rpc test#6550
cardano-testnet | Fix flaky height check in rpc test#6550carbolymer wants to merge 1 commit intomasterfrom
Conversation
98eace4 to
d3b60ad
Compare
There was a problem hiding this comment.
Pull request overview
This PR addresses flakiness in the Cardano testnet RPC transaction integration test by replacing a brittle “wait for next block height” approach with a retry-based check that waits until the expected UTxOs are observable after submission.
Changes:
- Replace the previous block-height polling loop with
retryUntilMto wait until the destination address shows the expected UTxO state. - Introduce an
EpochStateViewin the test to drive block-based retry timing. - Add a changelog fragment documenting the fix.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Rpc/Transaction.hs |
Reworks the post-submit waiting logic to retry querying UTxOs until the expected results appear, avoiding stale height assumptions. |
cardano-testnet/changelog.d/20260424_081135_mgalazyn_fix_rpc_transaction_test.md |
Documents the flakiness fix in the changelog fragments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| when (previousBlockNo + 1 >= currentBlockNo) $ do | ||
| threadDelay 500_000 | ||
| loop | ||
| H.note_ "Ensure that submitted transaction ID is in the submitted transactions list" |
There was a problem hiding this comment.
The note text says this checks that the submitted tx id is "in the submitted transactions list", but the assertion only compares the locally computed tx id to the id returned by submitTx. Consider updating the message to reflect what’s actually being verified (or add an RPC query to check presence in a list if that’s the intent).
| H.note_ "Ensure that submitted transaction ID is in the submitted transactions list" | |
| H.note_ "Ensure that submitTx returns the same transaction ID as the locally computed signed transaction ID" |
| utxoAddress <- deserialiseAddressBs addrInEra $ utxo ^. U5c.cardano . U5c.address | ||
| pure $ addr1 == utxoAddress | ||
| ) | ||
| (\xs -> length xs == 2) |
There was a problem hiding this comment.
This assumes the testnet generated address has a single UTxO, and it seems that is indeed the case. But I think it would be more robust to either use a freshly generated address or check the assumption. Also the last assertion ends up being elem instead of a ===.
Also, now I realise this is really not from this PR, it was in the code already
Description
The chain height check was relying on an assumption that transaction goes into the next block, and sometimes the block nr check was returning stale info.
This changes the implementation to use retry untilM, to reliably check for the height.
Checklist
See Running tests for more details
CHANGELOG.mdfor affected package.cabalfiles are updatedhlint. See.github/workflows/check-hlint.ymlto get thehlintversionstylish-haskell. See.github/workflows/stylish-haskell.ymlto get thestylish-haskellversionghc-9.6andghc-9.12Note on CI
If your PR is from a fork, the necessary CI jobs won't trigger automatically for security reasons.
You will need to get someone with write privileges. Please contact IOG node developers to do this
for you.