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

Align minting policy #720

Closed
3 tasks done
ch1bo opened this issue Feb 10, 2023 Discussed in #718 · 0 comments · Fixed by #742
Closed
3 tasks done

Align minting policy #720

ch1bo opened this issue Feb 10, 2023 Discussed in #718 · 0 comments · Fixed by #742
Labels
green 💚 Low complexity or well understood feature 💬 feature A feature on our roadmap
Milestone

Comments

@ch1bo
Copy link
Collaborator

ch1bo commented Feb 10, 2023

Why

The minting policy ensures security of a Hydra Head on-chain by:

  • providing a unique identity to a Head (HeadId)
  • helps in identifying a "proper" Head, i.e. one that follows the rules
  • able to tell a proper Head from a faked one apart
  • want to limit necessary knowledge required by users/implementations off-chain

Within this feature we want to make observing arbitrary, proper Heads correct and as simple as possible. While observing and deciding whether to interact with a head in the hydra-node may still involve some off-chain checks.

The overall strategy should be that off-chain code ensures that minting policy ran for a given InitTx.

What

We want to implement a "full" minting policy to do some checks on-chain and simplify the off-chain handling. See #718 for some more details and rationale.

  1. ✔ Ensure minting policy mu_head is parameterized by an out-ref, it's policy id / currency symbol then is the unique headId

    • to enforce on-chain check that out-ref is spent when minting any token under this policy
  2. ✔ Ensure out-ref and the headId are in the datum of the first output of the transaction which mints tokens.

  3. ✔ Off-chain, we use the out-ref and headId from the datum to check whether headId == hash(mu_head(out-ref)) holds.

    • need to check there's a matching ST too
  4. ✔️ Ensure the minting policy mu_head also checks on-chain when minting:

    • There is single state token that is paid into v_head, which ensures continuity
    • The the number of minted PTs == number of participants evident from the datum
  5. ✔️ Do not restrict burning on the mu_head at all. It is ensured by the v_head validator, when tokens of a specific headId may be burned.

  6. ✔️ Additional checks we decide to do off-chain still (when constructing and observing the init tx) :

    • the pub key hashes of all configured participants == the token names of PTs
    • the contestation period in the datum matches the configured one
    • the Hydra keys (parties) in the datum matches the configured keys

How

  • Update the spec to reflect these changes (and rationale)
  • Implement the on-chain checks as specified above
    • Using mutation tests on the init and abort transactions to verify correct working of mu_head
    • Update mutation test expectations on burning tokens as we not do these checks anymore.
  • Update initTx and observeInitTx to satisfy and do the off-chain checks above
    • Using state-full tx interface of intialize and observeInit functions and verify in StateSpec
@ch1bo ch1bo added the 💭 idea An idea or feature request label Feb 10, 2023
@ch1bo ch1bo moved this to Now in Hydra Head Roadmap Feb 10, 2023
@ch1bo ch1bo added 💬 feature A feature on our roadmap green 💚 Low complexity or well understood feature and removed 💭 idea An idea or feature request labels Feb 10, 2023
@ch1bo ch1bo added this to the Mainnet milestone Feb 10, 2023
ghost pushed a commit that referenced this issue Feb 13, 2023
ch1bo pushed a commit that referenced this issue Feb 14, 2023
ch1bo pushed a commit that referenced this issue Feb 17, 2023
v0d1ch pushed a commit that referenced this issue Feb 17, 2023
@ch1bo ch1bo assigned ffakenz and unassigned ch1bo Feb 21, 2023
ffakenz pushed a commit that referenced this issue Feb 21, 2023
ffakenz pushed a commit that referenced this issue Feb 21, 2023
v0d1ch pushed a commit that referenced this issue Feb 22, 2023
v0d1ch pushed a commit that referenced this issue Feb 23, 2023
@v0d1ch v0d1ch mentioned this issue Feb 23, 2023
2 tasks
ffakenz pushed a commit that referenced this issue Feb 23, 2023
ch1bo pushed a commit that referenced this issue Feb 24, 2023
ch1bo pushed a commit that referenced this issue Feb 24, 2023
@github-project-automation github-project-automation bot moved this from Now to Done in Hydra Head Roadmap Feb 24, 2023
@ch1bo ch1bo unassigned v0d1ch and ffakenz Feb 28, 2023
@ch1bo ch1bo removed this from the Mainnet milestone Mar 2, 2023
@ch1bo ch1bo added this to the 0.9.0 milestone Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
green 💚 Low complexity or well understood feature 💬 feature A feature on our roadmap
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants