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

Actually check the CollectCom transition consumes consistent PTs/STs #249

Merged
merged 14 commits into from
Mar 11, 2022

Conversation

KtorZ
Copy link
Collaborator

@KtorZ KtorZ commented Mar 9, 2022

Fixes #241

@KtorZ KtorZ requested a review from a team March 9, 2022 10:59
Copy link
Collaborator

@ch1bo ch1bo left a comment

Choose a reason for hiding this comment

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

Only some comments on naming things and one outdated haddock.

@@ -440,17 +441,23 @@ alterRedeemers fn = \case
in TxBodyScriptData dats (Ledger.Redeemers newRedeemers)

-- | Remove redeemer for given `TxIn` from the transaction's redeemers map.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should: update this outdated doc.

@@ -80,11 +80,12 @@ genCommitMutation (tx, _utxo) =
, SomeMutation MutateCommittedValue <$> do
mutatedValue <- genValue `suchThat` (/= committedOutputValue)
let mutatedOutput = modifyTxOutValue (const mutatedValue) committedTxOut
pure $ ChangeInput committedTxIn mutatedOutput

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could: remove redundant new line

& filter (/= adaSymbol)
& \case
[headPolicyId] -> headPolicyId
_ -> traceError "malformed thread token, expected single asset"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice code. We should use consistent names though.

Should: As it seems not to be the thread token we retrieve, but this head's currency symbol, please rename threadToken.

Could: More minor, the term headPolicyId is not consistent with what plutus is calling it (ref symbols and adaSymbol). So maybe we should also be consistent in that regards?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As it seems not to be the thread token we retrieve, but this head's currency symbol

Yup, I told myself the same thing yesterday when I self reviewed the code. It's not a thread token indeed.

@@ -145,6 +168,13 @@ genCollectComMutation (tx, utxo) =
[ ChangeHeadDatum $ Head.Initial c moreParties
, ChangeOutput 0 $ mutatedPartiesHeadTxOut moreParties
]
, SomeMutation MutateHeadId <$> do
illedHeadResolvedInput <-
Copy link
Collaborator

Choose a reason for hiding this comment

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

😂 is that even a word? Maybe sickHeadResolvedInput is also an option?

No need to change, though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought that as a German-speaker, you would appreciate our creativity on words 🤓

@github-actions
Copy link

github-actions bot commented Mar 10, 2022

Unit Test Results

    6 files    80 suites   7m 10s ⏱️
210 tests 208 ✔️ 2 💤 0

Results for commit 4b8116c.

♻️ This comment has been updated with latest results.

KtorZ and others added 14 commits March 11, 2022 08:13
  The idea is to cause a mutation to force the inspection of
  participation tokens in the collect-com. Currently, tokens are only
  counted (and even... we only truly count commits). Yet, we do
  want in the end to look for token which have the same policy id as the
  thread token, and interpret them as PTs.

  Thus, by mutating the policy id of the thread token, we should in
  principle invalidate all PTs based on a different policy id. Which,
  for now, does not happen, hence the failing mutation test.
  Make validator more efficient by avoiding constructing and traversing
  a list of PTs. And, this also reflects a bit more the logic itself.
  So that, collect-com can validate properly.. but, we are running out of budget.
  We need to optimize the collect-com! ... and probably other validators too.
  Fortunately, this is a cost-free change! 🎉.
  This is a temporary measure because, if we indeed want to run this on
  THE testnet, we need the execution budget to be smaller. So optimizing
  collect-com is a must (or reviewing the approach to do smaller steps
  via sequential collect of commits).

  → #254
Discovered in a flaky test which saw didn't see enough initials/commits
because their TxIns were conflicting
Arbitrary TxIn, TxId, VerificationKey and Hashes thereof should not
conflict as this would lead to surprising test failures
@ch1bo ch1bo merged commit 739ba52 into master Mar 11, 2022
@ch1bo ch1bo deleted the ensemble/241 branch March 11, 2022 08:08
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.

Actually check the CollectCom transition consumes consistent PTs/STs
3 participants