Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

-->
Copy link
Copy Markdown
Contributor

@carbolymer carbolymer Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should use integrationRetryWorkspace instead of integrationWorkspace

Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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"
Expand Down Expand Up @@ -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) $
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mint transaction may not be confirmed within a single block, causing findLargestMultiAssetUtxoWithAddress to return Nothing and the test to fail spuriously

When this happens? Why it may not get confirmed within a single block?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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
Expand Down
Loading