-
Notifications
You must be signed in to change notification settings - Fork 751
Fix flaky MultiAssetReturnCollateral test #6504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| <!-- | ||
| A new scriv changelog fragment. | ||
|
|
||
| Uncomment the section that is right (remove the HTML comment wrapper). | ||
| For top level release notes, leave all the headers commented out. | ||
| --> | ||
|
|
||
| <!-- | ||
| ### Removed | ||
|
|
||
| - A bullet item for the Removed category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Added | ||
|
|
||
| - A bullet item for the Added category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Changed | ||
|
|
||
| - A bullet item for the Changed category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Deprecated | ||
|
|
||
| - A bullet item for the Deprecated category. | ||
|
|
||
| --> | ||
| ### Fixed | ||
|
|
||
| - Fixed flaky `MultiAssetReturnCollateral` test by using deterministic UTxO | ||
| selection instead of relying on query ordering. | ||
|
|
||
| <!-- | ||
| ### Security | ||
|
|
||
| - A bullet item for the Security category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Tests | ||
|
|
||
| - A bullet item for the Tests category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Documentation | ||
|
|
||
| - A bullet item for the Documentation category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Maintenance | ||
|
|
||
| - A bullet item for the Maintenance category. | ||
|
|
||
| --> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,7 @@ import Testnet.Components.Configuration | |
| import Testnet.Components.Query | ||
| import Testnet.Defaults | ||
| import Testnet.Process.Run (execCli', mkExecConfig) | ||
| import Testnet.Property.Util (integrationWorkspace) | ||
| import Testnet.Property.Util (integrationRetryWorkspace) | ||
| import Testnet.Types | ||
|
|
||
| import Hedgehog (Property) | ||
|
|
@@ -31,7 +31,7 @@ import qualified Hedgehog.Extras as H | |
|
|
||
| -- @DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/Collateral With Multiassets/"'@ | ||
| hprop_collateral_with_tokens :: Property | ||
| hprop_collateral_with_tokens = integrationWorkspace "collateral-with-tokens" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do | ||
| hprop_collateral_with_tokens = integrationRetryWorkspace 2 "collateral-with-tokens" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do | ||
| conf@Conf { tempAbsPath } <- mkConf tempAbsBasePath' | ||
| let tempAbsPath' = unTmpAbsPath tempAbsPath | ||
| work <- H.createDirectoryIfMissing $ tempAbsPath' </> "work" | ||
|
|
@@ -145,13 +145,9 @@ hprop_collateral_with_tokens = integrationWorkspace "collateral-with-tokens" $ \ | |
| -- STEP 2: Attempt to spend from script with collateral containing tokens | ||
| -- This will fail because collateral cannot contain non-ADA tokens | ||
|
|
||
| -- Wait for transactions to be processed and find UTxOs | ||
| _ <- waitForBlocks epochStateView 1 | ||
|
|
||
| -- Find the UTxO with tokens at wallet1 (for collateral) | ||
| txinCollateralWithTokensM <- | ||
| -- Find the UTxO with tokens at wallet2 (for collateral) | ||
| (txinCollateralWithTokens, collateralTxOut) <- retryUntilJustM epochStateView (WaitForBlocks 10) $ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When this happens? Why it may not get confirmed within a single block?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hard to say exactly, but maybe a block gets forged before the tx has time to enter the mempool. We then wait for that block and query the node state, but it still reflects the pre-tx state. The tx only gets included in the next block, which updates the node state but by then the test has already failed. |
||
| findLargestMultiAssetUtxoWithAddress epochStateView sbe $ T.pack maCollateralAddress | ||
| (txinCollateralWithTokens, collateralTxOut) <- H.evalMaybe txinCollateralWithTokensM | ||
| H.note_ "Collateral TxOut" | ||
| H.noteShow_ collateralTxOut | ||
| -- Find the UTxO at the script address | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test should use
integrationRetryWorkspaceinstead ofintegrationWorkspace