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

No extra redeemers #2392

Merged
merged 5 commits into from
Jul 23, 2021
Merged

No extra redeemers #2392

merged 5 commits into from
Jul 23, 2021

Conversation

polinavino
Copy link
Contributor

Add a check to the UTXOW rule that forbids redeemers that have pointers that do not point to script purposes required for validation of the Tx's contracts

Comment on lines 314 to 319
let extraRdmrs :: [RdmrPtr]
extraRdmrs =
Map.keys $
Map.filterWithKey
(\el _ -> not $ elem (SJust el) [rdptr @era txbody sp | (sp, _) <- sphs])
(unRedeemers $ txrdmrs . wits $ tx)
Copy link
Collaborator

@lehins lehins Jul 22, 2021

Choose a reason for hiding this comment

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

A more efficient way of doing the same thing

Suggested change
let extraRdmrs :: [RdmrPtr]
extraRdmrs =
Map.keys $
Map.filterWithKey
(\el _ -> not $ elem (SJust el) [rdptr @era txbody sp | (sp, _) <- sphs])
(unRedeemers $ txrdmrs . wits $ tx)
let rdptrs = Set.fromList [el | (sp, _) <- sphs, SJust el <- [rdptr @era txbody sp]]
extraRdmrs :: [RdmrPtr]
extraRdmrs = Map.keys $ Map.withoutKeys (unRedeemers $ txrdmrs $ wits tx) rdptrs

Copy link
Contributor

@JaredCorduan JaredCorduan left a comment

Choose a reason for hiding this comment

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

@polinavino
Copy link
Contributor Author

@JaredCorduan do you happen to know why "Chain and Ledger traces cover the relevant cases" is failing now? I have no idea what to do about that...

@JaredCorduan
Copy link
Contributor

@JaredCorduan do you happen to know why "Chain and Ledger traces cover the relevant cases" is failing now? I have no idea what to do about that...

yea, the alonzo traces are still flakey, it's very frustrating. no tests are really failing, it's that we do not get a high enough percentage of good traces:

*** Gave up! Passed only 199 tests; 37 discarded tests:

Once the PR is ready to merge, I can always re-run the tests if this happens again.

@polinavino
Copy link
Contributor Author

I added a test with an extra redeemer - so it could be ready, unless more tests are needed

@JaredCorduan
Copy link
Contributor

I added a test with an extra redeemer - so it could be ready, unless more tests are needed

fantastic, thank you! let me spin the wheel! 🎰

Copy link
Contributor

@JaredCorduan JaredCorduan left a comment

Choose a reason for hiding this comment

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

looks good to me, thank you @polinavino !

@polinavino polinavino merged commit 4055140 into master Jul 23, 2021
@iohk-bors iohk-bors bot deleted the polina/redeemers branch July 23, 2021 02:47
@WhatisRT
Copy link
Contributor

I'm a bit confused about what this is doing, this looks like a weakening in the condition in the formal spec to me. checkScriptData verifies that every necessary script is present, and that all 2-phase scripts have redeemers. This means that all required redeemers are present. The next line then was just a size check previously, which already implies that the redeemers that are present are exactly the redeemers required.

Now, it's a check that all redeemers are required by scriptsNeeded, but this also includes 1-phase scripts. So now, in addition to the 2-phase redeemers it can also contain redeemers for 1-phase scripts. So this change now allows a larger set of redeemers than before, which is not at all what the intent of this PR seems to be. This smells like a mismatch between spec and code for me

@WhatisRT
Copy link
Contributor

And from reading the Haskell diff, it seems like this size check was just not implemented before?

@polinavino
Copy link
Contributor Author

yea, youre right! fixing this now (adding the constraint that SP has to be for a non-native script). There was no check at all before I put the size check, and the reason I changed it from the size-check to the current one is that we want to be able to get a better error report (a list of the extra redeemers)

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.

4 participants