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

Naiive on-chain-verification (Plutus scripts) #145

Closed
ch1bo opened this issue Dec 21, 2021 · 8 comments
Closed

Naiive on-chain-verification (Plutus scripts) #145

ch1bo opened this issue Dec 21, 2021 · 8 comments
Labels
amber ⚠️ Medium complexity or partly unclear feature 💬 feature A feature on our roadmap
Milestone

Comments

@ch1bo
Copy link
Member

ch1bo commented Dec 21, 2021

What & Why

So far, we have implemented the whole Hydra Head life-cycle via proper Cardano transactions. However, only mocked validators had been used and thus the Hydra Head is not secure. For example, any attacker could submit a transaction to close the Head. To make the Head secure, we need to add script validators to the Head's UTXO.

This feature is called "naiive" on-chain-verification (OCV) because we want to implement in a complete & correct, but simplified form. See technical requirements for details.

Product requirements

  • The full life-cycle of a Hydra Head is secured by script validators.
  • The abort life-cycle of a Hydra Head is secured by script validators.
  • Script validators are tested with an attacker mindset.

Technical requirements

  • Scripts are developed in a test-driven way, where unit- and property-tests are used to ensure correctness in adversarial cases.
  • Naiive algorithms are used to implement the scripts:
    a. Multi-signatures - a list of Ed25519 signatures is checked, not an aggregated one. This is relevant for the close & contest scripts.
    b. UTXO checking - instead of using full Merkle-(Patricia)-Trees to proof non-/existence of UTXOs in the fanout script, a simple list/map lookup shall be used complete hash of the [TxOut] shall be used.
  • Script sizes, execution unit budgets and costs are determined
  • Benchmark & demo scenarios are adapted with increased budgets
@ch1bo ch1bo added the 💬 feature A feature on our roadmap label Dec 21, 2021
@ghost
Copy link

ghost commented Dec 21, 2021

Is it implicit in this description that we use real (e.g not MockDSIGN) signatures in the Head?

@ch1bo
Copy link
Member Author

ch1bo commented Dec 21, 2021

Is it implicit in this description that we use real (e.g not MockDSIGN) signatures in the Head?

Yes, we should aim for using real (non-musig2) signatures. Good point. I'll make it explicit.

@kk-hainq
Copy link
Contributor

Will you guys accept an external PR for this task? We can do it in baby steps or in full during the New Year holiday as our Lunar New Year is in February. We do have more time to contribute upstream while the Western half of the team goes on holiday :).

@ch1bo
Copy link
Member Author

ch1bo commented Dec 22, 2021

Thanks for the offer @kk-hainq. I wrote this down to have a a first high-level feature on this platform to gauge how detailed we want/need this to be, before I write them all up to have a transparent, public roadmap. It was not intended for seeking assistance as it's lacking some details, but I can definitely see that for one of the next features or subtasks of it. Plus, we are currently in the midst of it as can be seen on master and the open ensemble branch.

@ch1bo ch1bo changed the title [DRAFT] Naiive on-chain-verification (Plutus scripts) Naiive on-chain-verification (Plutus scripts) Jan 11, 2022
@ch1bo
Copy link
Member Author

ch1bo commented Jan 11, 2022

Scope change: As this is only covering the "complete" fanout transaction, it suffices to check whether all fanned out outputs are present in a closed state. Thus we do hash the list of outputs and compare with the stored hash of the closed UTXO state (instead of en-/decoding the full UTXO type as plutus datum).

@ch1bo
Copy link
Member Author

ch1bo commented Jan 11, 2022

Complexity of hashing is covered in PR #155.

@ch1bo ch1bo added help wanted Issues where we could need some help and removed help wanted Issues where we could need some help labels Jan 13, 2022
@ch1bo ch1bo moved this to In Progress in Hydra Head Roadmap Jan 13, 2022
@ch1bo ch1bo moved this from In Progress to Testnet maturity in Hydra Head Roadmap Jan 13, 2022
@ch1bo ch1bo moved this from Testnet maturity to Mainnet maturity in Hydra Head Roadmap Jan 13, 2022
@ch1bo ch1bo moved this from Mainnet maturity to Testnet maturity in Hydra Head Roadmap Jan 13, 2022
@ch1bo ch1bo moved this from Mainnet maturity to Testnet maturity in Hydra Head Roadmap Jan 13, 2022
@ch1bo ch1bo moved this from Testnet maturity to Mainnet maturity in Hydra Head Roadmap Jan 13, 2022
@ch1bo ch1bo moved this from Testnet maturity to Mainnet maturity in Hydra Head Roadmap Jan 13, 2022
@ch1bo ch1bo moved this from Testnet maturity to In Progress in Hydra Head Roadmap Jan 13, 2022
@ch1bo ch1bo moved this from Mainnet maturity to Testnet maturity in Hydra Head Roadmap Jan 13, 2022
@ch1bo ch1bo modified the milestone: 0.4.0 Jan 13, 2022
@ch1bo
Copy link
Member Author

ch1bo commented Feb 1, 2022

Last PR with relevant validators was merged #201 , so closing this in prep for 0.3.0

@ch1bo ch1bo closed this as completed Feb 1, 2022
Repository owner moved this from In Progress to Done in Hydra Head Roadmap Feb 1, 2022
@ch1bo ch1bo added the amber ⚠️ Medium complexity or partly unclear feature label Feb 3, 2022
@ch1bo
Copy link
Member Author

ch1bo commented Feb 8, 2022

Status quo implementation also documented in #204

@ch1bo ch1bo modified the milestones: Testnet maturity, 0.3.0 Mar 8, 2022
@ch1bo ch1bo mentioned this issue Jun 10, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
amber ⚠️ Medium complexity or partly unclear feature 💬 feature A feature on our roadmap
Projects
None yet
Development

No branches or pull requests

2 participants