Skip to content
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

Fix random failure: MissingScriptWitnessesUTXOW (fromList []) #3039

Merged
merged 1 commit into from Sep 16, 2022

Conversation

TimSheard
Copy link
Contributor

@TimSheard TimSheard commented Sep 15, 2022

For a long time we get random, in frequent failures in the property tests labeled with
MissingScriptWitnessesUTXOW (fromList [])
This is annoying, and actually very misleading because the actual failure is that there is an extra script witness that is not actually needed. This misleading error message is caused by a long known bug that was improved by code like this

validateMissingScripts pp sNeeded sReceived =
  if HardForks.missingScriptsSymmetricDifference pp
    then
      sequenceA_
        [ failureUnless (sNeeded `Set.isSubsetOf` sReceived) $
            MissingScriptWitnessesUTXOW (sNeeded `Set.difference` sReceived),
          failureUnless (sReceived `Set.isSubsetOf` sNeeded) $
            ExtraneousScriptWitnessesUTXOW (sReceived `Set.difference` sNeeded)
        ]
    else
      failureUnless (sNeeded == sReceived) $
        MissingScriptWitnessesUTXOW (sNeeded `Set.difference` sReceived) 

Note when (HardForks.missingScriptsSymmetricDifference pp) is False, and sRecieved is a supersetof sNeeded, we get the misleading error.

So the real problem is that the EraGen process of generating random traces, occasionally (and randomly) generates an extra script witness. It is hard to track this down. There is some evidence that this arises because the script hash appears as the PolicyId in a Value. But that is not been verified. Regardless of the cause, we fix this by
discarding the trace. Note that this is failure to generate a "random" but valid transaction. Discarding the trace adjust for this inadequacy in the generation process. This only appears in the Alonzo era, so this "fix" is applied here, in the genEraDone
method of the EraGen class in the (AlonzoEra c) instance.

@JaredCorduan
Copy link
Contributor

I believe this PR will resolve #2839 and #2811 🎉

Copy link
Contributor

@lehins lehins left a comment

Choose a reason for hiding this comment

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

Thank you for finally fixing this annoyance

@TimSheard TimSheard force-pushed the ts-fixRandomExtraScriptWitness branch 2 times, most recently from d755abb to 354569e Compare September 15, 2022 23:43
Copy link
Contributor

@lehins lehins left a comment

Choose a reason for hiding this comment

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

👍

@JaredCorduan JaredCorduan merged commit 28559a8 into master Sep 16, 2022
@iohk-bors iohk-bors bot deleted the ts-fixRandomExtraScriptWitness branch September 16, 2022 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants