Skip to content

Commit

Permalink
Add comment explaining why we use the inequality check <= instead o…
Browse files Browse the repository at this point in the history
…f `==`
  • Loading branch information
palas committed Feb 20, 2025
1 parent cf0af8a commit 3305710
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cardano-api/test/cardano-api-test/Test/Cardano/Api/TxBody.hs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ prop_simple_script_witness_count = H.property $ do
<$> genTxIn
witList <- H.forAll $ satisfyScript script
let witCount = fromIntegral $ Set.size witList
-- We use the inequality @<=@ instead of @==@ because 'estimateTransactionKeyWitnessCount'
-- calculates an upper bound on the number of key witnesses required to validate a transaction,
-- and the @witList@ contains a random subset that can potentially be used to satisfy the script.
-- So we only know it must be smaller or equal to the upper bound.
H.diff
(estimateTransactionKeyWitnessCount contentWithoutScript + witCount)
(<=)
Expand Down

0 comments on commit 3305710

Please sign in to comment.