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

Revise POST /commit endpoint interface #1350

Closed
ch1bo opened this issue Mar 12, 2024 Discussed in #1337 · 0 comments · Fixed by #1380
Closed

Revise POST /commit endpoint interface #1350

ch1bo opened this issue Mar 12, 2024 Discussed in #1337 · 0 comments · Fixed by #1380
Labels
api Items related to the Hydra client API green 💚 Low complexity or well understood feature 💬 feature A feature on our roadmap
Milestone

Comments

@ch1bo
Copy link
Collaborator

ch1bo commented Mar 12, 2024

Discussed in #1337

Why

Currently POST /commit endpoint accepts utxos with witnesses as request payload and supports spending from script addresses. However, it does not provide any means to tweak transaction context, making it impractical for many real-world cases that often involve checking transaction validity range, required signers, etc. as part of the validator logic.

What

  • The /commit endpoint can accept a "Blueprint" Tx (CBOR-encoded) + a UTxO (as JSON) to resolve inputs for higher configurability

    • This transactions is used by the hydra-node as as starting point to draftCommitTx

    • Anything that does not conflict with the requirements of a valid head commit transaction should be kept. For example:

      • A Hydra commitTx does not need to have some specific validity range, so any lower or upper bound is also present on the resulting commit tx draft
      • Any inputs, already present are also present on the resulting commit tx draft
      • Any outputs of the blueprint tx are NOT outputs of the commit tx.
    • The drafted commit tx is balanced (hydra-node estimates and pays fees) and signed by the --cardano-signing-key (as before)

  • Tests covering a transaction with additional required signers and lower/upper validity set which assert that the resulting commitTx has the same things present as the blueprint has.

  • The existing UTxOWithWitnesses is still supported as a request body on /commit

  • API reference and documentation is updated (explain how to use this with cardano-cli as an example)

How

  • New signature of draftCommitTx :: HeadId -> UTxOType tx -> tx -> m tx (roughly)
  • commitTx basically starts with the TxBody instead of emptyTxBody
  • The UTxOWithWitnesses is implemented in terms of the now more capable tx-based draftCommitTx by building the blueprint transaction from the UTxOWithWitnesses
  • Support both request types by making the request a sum-type, e.g.
data DraftCommitTxRequest
  = SimpleCommitRequest {utxoToCommit :: UTxO' TxOutWithWitness}
  | FullCommitRequest {blueprintTx :: Tx}

TBD

  • Mix CBOR and JSON on the request body?
@ch1bo ch1bo added 💬 feature A feature on our roadmap green 💚 Low complexity or well understood feature api Items related to the Hydra client API labels Mar 12, 2024
@ch1bo ch1bo moved this to Later in Hydra Head Roadmap Mar 12, 2024
@ch1bo ch1bo mentioned this issue Mar 14, 2024
12 tasks
@ffakenz ffakenz self-assigned this Mar 18, 2024
@ch1bo ch1bo moved this from Later to Next in Hydra Head Roadmap Mar 19, 2024
@ch1bo ch1bo added this to the 0.16.0 milestone Mar 22, 2024
@ch1bo ch1bo assigned ghost , locallycompact, AlexandruSofronov and v0d1ch and unassigned ghost , locallycompact and AlexandruSofronov Mar 26, 2024
@ch1bo ch1bo removed this from the 0.16.0 milestone Apr 2, 2024
@ch1bo ch1bo linked a pull request Apr 4, 2024 that will close this issue
4 tasks
@v0d1ch v0d1ch mentioned this issue Apr 9, 2024
4 tasks
@ch1bo ch1bo moved this from Next to Now in Hydra Head Roadmap Apr 10, 2024
@ch1bo ch1bo added this to the 0.17.0 milestone Apr 15, 2024
@github-project-automation github-project-automation bot moved this from Now to Done in Hydra Head Roadmap Apr 24, 2024
@ch1bo ch1bo unassigned v0d1ch and ffakenz Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Items related to the Hydra client API 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.

5 participants