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

Abort heads using reference scripts/inputs #397

Closed
6 of 7 tasks
ch1bo opened this issue Jun 14, 2022 · 3 comments
Closed
6 of 7 tasks

Abort heads using reference scripts/inputs #397

ch1bo opened this issue Jun 14, 2022 · 3 comments
Labels
amber ⚠️ Medium complexity or partly unclear feature 💬 feature A feature on our roadmap
Milestone

Comments

@ch1bo
Copy link
Member

ch1bo commented Jun 14, 2022

Why

The current implementation of the Hydra Head cannot always abort a Head initialization. This is because the abort transaction is too big (> 16kB), especially if all it's aborting a mix of both, initial and commit outputs. However, it is vital that we can abort any Head initialized (up to a reasonable number of parties).

What

We want to improve transaction size utilization by not needing to include head, initial and commit scripts in the abort transaction. The upcoming Babbage era features of "reference scripts and inputs" allow us to use scripts from reference inputs as witnesses of spending head, initial and commit outputs. This will allow us to only reference and not include scripts on transactions like abort and collect.

How

After some discussion we decided publishing Head scripts in a distinct transaction on each release of the hydra-node, or more specifically of the hydra-plutus package.

  • The scripts are packed into outputs addressed to some v_publish validator, that is parameterized by a HeadVersion, which yields a unique address per Head script version.
  • The hydra-node would be aware of this version and the script hashes (compiled into it, like right now) and needs to "discover" these outputs on-chain.
    • We could provide the relevant TxId to the node
    • Or we could "scan the chain" for the relevant addresses (not using the local state query by address) from our starting chain point
  • Found reference scripts are checked for integrity against the known script hashes. Any error leads to a shutdown of the hydra-node.
  • The v_publish validator shall make the published outputs unspendable, e.g. const False
    • We discussed authorized access or garbage collection, but decided not needing that for now.

We have drafted this design also on Miro here:

Image

Tasks

  • Propose an ADR on reference scripts #438
  • Update the end-to-end tests to publish reference scripts using such a release transaction
  • Update the abortTx to reference these scripts
  • Parameterize the hydra-node to take TxId where to find Head script to reference
  • Create a tool to publish tagged versions of our scripts onto testnet/mainnet
  • Ensure the demo & testnet setups can be still run (i.e. publish scripts there)
  • (optional) Scan the chain and verify integrity of published scripts in hydra-node
@ch1bo ch1bo added 💬 feature A feature on our roadmap amber ⚠️ Medium complexity or partly unclear feature labels Jun 14, 2022
@ch1bo ch1bo changed the title Abort heads using reference scripts/inputs and switch to babbage Abort heads using reference scripts/inputs Jun 21, 2022
@ch1bo ch1bo moved this from Later to Now in Hydra Head Roadmap Jun 21, 2022
@ch1bo ch1bo added this to the 0.7.0 milestone Jun 22, 2022
@ch1bo ch1bo moved this from Now to Later in Hydra Head Roadmap Jun 24, 2022
@ch1bo ch1bo moved this from Later to Next in Hydra Head Roadmap Jun 28, 2022
@ghost
Copy link

ghost commented Jul 5, 2022

Random thoughts: Create scripts outputs in the InitTx, tied to a "lock" script that ensures the outputs can only be consumed by an Abort or FanOut transaction.

@ch1bo
Copy link
Member Author

ch1bo commented Jul 12, 2022

We discussed the approach and agree that we want to focus on the essentials right now:

  • no scanning for addresses or checking whether "synched enough"
  • no validation of the scripts

just "blindly" use the passed TxId

@ch1bo
Copy link
Member Author

ch1bo commented Aug 22, 2022

Added changelog entries and some remaining fixes in #459

@ch1bo ch1bo closed this as completed Aug 22, 2022
Repository owner moved this from Now to Done in Hydra Head Roadmap Aug 22, 2022
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

3 participants