-
Notifications
You must be signed in to change notification settings - Fork 214
Don't take collateral if validation doesn't fail in phase 2 #510
Don't take collateral if validation doesn't fail in phase 2 #510
Conversation
@sjoerdvisscher here is a PR with that fix. I think we might need a bit of help debugging the PAB issue. Should we make an issue with this too? |
plutus-ledger/src/Ledger/Index.hs
Outdated
@@ -178,8 +178,7 @@ validateTransactionOffChain t = do | |||
|
|||
idx <- vctxIndex <$> ask | |||
pure (Nothing, insert t idx) | |||
) | |||
`catchError` payCollateral | |||
) `catchError` payCollateral |
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.
I don't understand how this actually changed the result of PAB testing? Isn't this a code format change?
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.
Oh, just saw your comment on the other PR: "because of how do and infix notation interact"
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.
But I guess I don't see the difference...
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 is super subtle, the old code would do catchError
on the whole do-block, not just the bits in the brackets (the phase 2 validation).
I have looked at this a bit. The problem seems to be that the test was not ok to begin with. The 3rd test does not fail if you comment out the second test. So there's some state transfer between tests. @koslambrou it seems you wrote these tests, does that sound plausible? |
Found the error, but I don't know why your fix triggered it. It's in the test case "PingPong contract state is maintained across PAB instances" in Change
to
That solved it locally. Edit: @sjoerdvisscher Mentionned that a better solution would be P.S. I would create a commit with the fix, but I don't have permission access for your fork. |
43babac
to
7c6a1b8
Compare
@koslambrou if the test failure is unrelated to this fix, maybe it makes more sense to fix the test in a separate PR and hold this PR until that has landed? If you want it here you can always make a PR to this branch. |
@MaximilianAlgehed The fix is on |
7c6a1b8
to
dfbb809
Compare
@koslambrou Rebased and tests are passing. |
Pre-submit checklist: