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

Head in Head #1612

Open
12 tasks
ch1bo opened this issue Sep 10, 2024 · 0 comments
Open
12 tasks

Head in Head #1612

ch1bo opened this issue Sep 10, 2024 · 0 comments
Labels
💭 idea An idea or feature request

Comments

@ch1bo
Copy link
Collaborator

ch1bo commented Sep 10, 2024

Why

When a Hydra head is opened, a part of the underlying ledger state gets locked up and made available off-chain to a small group of participants. While this is already quite a "small world" to process transactions, we encountered use cases where it would make sense to even open further heads with different/even smaller groups of participants on parts of the L2 state into L3 heads. Hydra doom is one of those use cases where fragmentation of ledger state is not a problem as the Head ledger is merely used to off-chain check transactions of game sessions.

There are still some liveness caveats about opening a Head in another head, but this would not be scope of this feature.

What

This is a follow-up to a previous spike #1590

  • The hydra-node can be pointed to another hydra-node API endpoint instead of --node-socket of a directly connected cardano-node
    • Observe Hydra protocol transactions from SnapshotConfirmed server outputs of the underlying node
    • Evolve current slot of the L3 ledger state based on a new server output sent by the underlying node
    • Create and send Hydra protocol transactions to the underlying node, e.g. to initialize, close or fanout a head
  • The hydra-tui can commit into such a head by using the hydra-node API of the underlying node.
  • A head in a head can be opened in a similar sequence way like this: Spike: Hydra Head in Head #1590 (comment)

How

  • Map out components/modules and how they should be reused/reorganised across chain backends (see also Blockfrost chain layer  #1305 ).
  • Add a new Tick server output to inform clients of time evolution
  • SnapshotConfirmed contains full confirmed transactions, while TxValid only contains a txId API: Full transaction in SnapshotConfirmed #1685
  • Create a hydra-client package that allows for
    • easy fetching of /protocol-parameters, /snapshot/utxo using Haskell types
    • open a websocket and with it: submit ClientInput messages, receive and subscribe to some ServerOutput messages
  • Make script publishing independent of Hydra.Chain.Direct (see early commits of Spike / Not merge: Inception chain component #1603)
  • Implement a new Hydra.Chain.Inception component that uses hydra-client
    • Make prepareTxToPost re-usable by generalizing concepts like ChainContext, ScriptRegistry and TimeHandle to work for both, Direct and Inception (cardano) chain backends
      • This could mean that we unify the concept of IsChainTx (or so) which is instantiated using hydra-tx tx construction for Cardano Tx
    • Re-organize Hydra.Options to be able to re-use --hydra-scripts-tx-id, --cardano-signing-key etc. between Direct and Inception chain backends

TBD

  • We had a Tick server output at some point - what happened?
  • Is including full txs in SnapshotConfirmed fine? We moved away from it when we also did ReqSn only sends transaction ids #728
  • Instead of submitting through the websocket NewTx, we could create a synchronous tx submission API.
  • What should happen with /POST/cardano-transactions endpoint on an inception node? (i.e. if it can't send a tx to L1 at all)
  • What happens if the L2 hydra-node disconnects from L3 hydra-node; how should it catch up? Can it catch up? For any L3 Head closures on L2 Idea: Use the API history?
@ch1bo ch1bo added the 💭 idea An idea or feature request label Sep 10, 2024
@noonio noonio mentioned this issue Sep 25, 2024
7 tasks
@ch1bo ch1bo moved this to Next in Hydra Head Roadmap Sep 25, 2024
github-merge-queue bot pushed a commit that referenced this issue Oct 9, 2024
Updates `SnapshotConfirmed` server output to contain full transactions
(instead of only transaction ids). This also updates TxValid to only
include the transaction id, such that transactions are only submitted
once per client still. Hence, this will not change the overall bandwidth
requirement on websocket clients, but will make their implementation
significantly easier.

Before, if clients wanted to act on transactions this was a lot easier
to do upon seing `TxValid`. However, this was only confirming local
ledger application and not consensus / enforcability of this transaction
onto the L1.

The new API suggests to do the right thing by making it straight-forward
to act upon seeing a transaction in a `SnapshotConfirmed`.

**TBD:** Changed `ServerOutput` field name `snapshotNumber` -> `number`
to be consistent with `version` (and the internal Haskell data type
names). Does anyone like `version` -> `snapshotVersion` better as an
alternative?

**TBD:** The field holding the transaction id in `TxValid` is called
`transactionId` now. The transaction (envelop) itself though contains
`txId`. This feels a bit inconsistent, which of the two should be
renamed?

This will also make #1612 easier (is mentioned as a sub-task there).

---

* [x] CHANGELOG updated
* [x] Documentation updated
* [x] Haddocks updated
* [x] No new TODOs introduced
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💭 idea An idea or feature request
Projects
Status: Next
Development

No branches or pull requests

1 participant