diff --git a/CHANGELOG.md b/CHANGELOG.md index 38352480f18..bed2daef510 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,17 @@ changes. ## Unreleased +- **IMPORTANT - Do not release this version** + - Incremental commits - off-chain changes to make the incremental commits possible. + Important to note is that on-chain security is not implemented and hydra-node in this + state is not releasable! + Missing off-chain items to implement as a series of next PR's: + - Use the observed UTxO to construct increment/recover + - Add documentation to explain the feature + - Implement tests scenarios outlined in the [incremental-commit] (https://github.com/cardano-scaling/hydra/issues/199) issue + - Remove Commit client input since it is unused + - Revisit types related to observations/posting transactions and make sure the fields are named appropriatelly + - Tested with `cardano-node 9.2.0` and `cardano-cli 9.4.1.0`. ## [0.19.0] - 2024-09-13 diff --git a/hydra-cluster/src/Hydra/Cluster/Scenarios.hs b/hydra-cluster/src/Hydra/Cluster/Scenarios.hs index 8e4af71d2f5..a8236f4b805 100644 --- a/hydra-cluster/src/Hydra/Cluster/Scenarios.hs +++ b/hydra-cluster/src/Hydra/Cluster/Scenarios.hs @@ -50,7 +50,6 @@ import Hydra.Cardano.Api ( mkScriptAddress, mkScriptDatum, mkScriptWitness, - mkTxIn, mkTxOutDatumHash, mkVkAddress, scriptWitnessInCtx, @@ -439,7 +438,7 @@ singlePartyCommitsScriptBlueprint tracer workDir node hydraScriptsTxId = waitFor hydraTracer 10 [n1] $ output "CommitApproved" ["headId" .= headId, "utxoToCommit" .= scriptUTxO'] waitFor hydraTracer 10 [n1] $ - output "CommitFinalized" ["headId" .= headId, "utxo" .= scriptUTxO', "theDeposit" .= mkTxIn tx 0] + output "CommitFinalized" ["headId" .= headId, "utxo" .= scriptUTxO', "theDeposit" .= getTxId (getTxBody tx)] send n1 $ input "GetUTxO" [] diff --git a/hydra-node/golden/StateChanged/CommitRecovered.json b/hydra-node/golden/StateChanged/CommitRecovered.json index fb936556cc3..bc0f061accc 100644 --- a/hydra-node/golden/StateChanged/CommitRecovered.json +++ b/hydra-node/golden/StateChanged/CommitRecovered.json @@ -2,185 +2,47 @@ "samples": [ { "newLocalUTxO": { - "06ff29fe2b76764c941c38945006dd0ef13f64f4584e78e9df6f7412fd06a047#28": { - "address": "addr1xxtl5s57p59394n93v45ye2whhe5ve4hpppfhn8ejjxkfahglv884s2426cd222kskryz5r8lf4dnz87lq48l5gyfncqzjynss", + "13ef1eec6c6a049d78e24db1042e973d31fb2a4f2d161adb0ca3484b96399d7b#51": { + "address": "addr1xx9gepmu83lzx5a6xnmcmvp3359aylh7v709xvv65hg2yue9srcr65jxchw0v8t3u0n3nrhk0qcvl8a92aum5g44mm2qjfd652", "datum": null, - "datumhash": "ecf099e3a15e66c525cb2d1f050c93aee978bcf821c605bc377f71f488f632f8", + "datumhash": "43848d94b20fe3f9a2663468d047225375382fa4b10b652ad41dbf8bc1920db0", "inlineDatum": null, - "referenceScript": { - "script": { - "cborHex": "820183830301828200581cd24e59c2f7fdf4354c375e29b5da613547180ca6a9c7e8f701c8b1818201848200581c7a6f087fc861b8addf3742b4a2add75707d1d3fa33210f9169082c778200581cfb2eac9efb78eea70cf37b4f9948b7abdd5d4e9c4d17724a85d67bb38200581cbade791bcb8055397e17c2b48fd4ea3454efc442250b24cd93e350138200581c8f0d3dc2f1205f3756749d2b88859ad1a439872c78dda2556be408708200581c3e5bd5fc1625a58eed409a6b882422edfc1ba79feda696a0b5b993898202848202838200581c63307a4e2fc6508c1bfc00030613ae3d03dd39882a9df67d2c12066f8200581c15abf12df0add856e257069de0bc74338797c20660bef5a5c4e614ac8200581cb60ff12b048e9ac60e1f8937f631749b2d5127b6f4d6e5b71bb058e98200581cafefd6ae782610c8196efffd9c0b2887fa6ce745c56c72747b200fda8202818200581c34189c1c344d2158fc60d8e2e05091dedd90949ccd74bff17cb7df228200581cfb6bc2558fb2f992e74ca1993c22abd8443089e9af26b3226f766199", - "description": "", - "type": "SimpleScript" - }, - "scriptLanguage": "SimpleScriptLanguage" - }, - "value": { - "8f461954fe2f18fee1dca233f358907e643ff839ed1f995e4bf325e3": { - "31": 2, - "4e27": 886367012431791901 - }, - "e091fb97087388b331ac558f76383df62817679d29512eac0f23ff67": { - "30": 1334723611476567699 - }, - "lovelace": 2 - } - }, - "0c94f10c3a576f9f2a2243a0f59b9579e391ce59e92b269bf5547e824700aa3d#49": { - "address": "addr_test1xqvhmgzcc9frv3ykygkjzqhjkwhxsr5d6djhhaq3hzu78wkaa9v20e4t4uupfem9rrp0mglq53p99rgx528e9nd5e97qlj06xq", - "datum": null, - "datumhash": null, - "inlineDatum": null, - "referenceScript": { - "script": { - "cborHex": "820180", - "description": "", - "type": "SimpleScript" - }, - "scriptLanguage": "SimpleScriptLanguage" - }, - "value": { - "2db8410d969b6ad6b6969703c77ebf6c44061aa51c5d6ceba46557e2": { - "6d92f6470d8aec679f846825b727682c98d28b": 5073345480762908204, - "8030a266f7d770c103e6aeea3d876b4d7ea1": 5925347642764162480 - }, - "b0c53e2bf180858da4b64eb5598c5615bba7d723d2b604a83b7f9165": { - "ae86": 2 - }, - "lovelace": 2 - } - }, - "0d88e474013fb488188333965923855b6ad33be799e70ff05153a82dca820ebd#55": { - "address": "EqGAuA8vHnNnDSmH7HpJT5gPc8P9cZ8sXhh2VQoLxVGGBsCTjmCS54YwTyjEMoQKoJu5UsPxJ1C4paooxb9wQDRdKvkMLKW2B4cTMGM4Dsws6U3QHcVuxwQ", - "datum": null, - "datumhash": "2abfe1c256ad009494b5d41410c88586acca37c1c073d37244d63ab07aaa9f3d", - "inlineDatum": null, - "referenceScript": { - "script": { - "cborHex": "8200581c7faf7c7d4fe5df2ec519581ff340c3ff3d7d1a518d098e035cfe247c", - "description": "", - "type": "SimpleScript" - }, - "scriptLanguage": "SimpleScriptLanguage" - }, - "value": { - "2d725128406dc832eb74c4709aca0512499b3c7b17e00d7cb2e6d1b1": { - "32": 2 - }, - "cc9d8dcd9ce84c2cb1e29a11a4e1b6e63f8c9f64fbab8d7bb67584e5": { - "33": 7612144212050836753, - "34": 3115418856683118096 - }, - "lovelace": 2 - } - }, - "11fe4e867d3b80a364266e9203c2699f4ccf62e27fba5fb24b7c8d7f76e8a36e#43": { - "address": "addr_test1qrzhmms8p9estnwnd95mf9hms9yunqawmyy22taggr2z260ze2jg70m6tsazjh2mrmmxth6n8epvlwt2a8q88n28wdxsjzqnr3", - "datum": null, - "inlineDatum": { - "map": [] - }, - "inlineDatumhash": "d36a2619a672494604e11bb447cbcf5231e9f2ba25c2169177edc941bd50ad6c", "referenceScript": null, "value": { - "245d5a7a06fe18358242e81281cd5ba9e6abe4efc54e7b659f25abae": { - "bc12a5ec57ef30f4": 7787468282051283406 - }, - "lovelace": 1 - } - }, - "1c004fdcf5e4ca6a2afec4603f536f95105a1a54e8b3c166e7f1a65e59d09e6c#54": { - "address": "addr_test1qr4sh9dy7w3xhr6nykhxqum7zkkhy8hlj20f6yk9sxm54pfntyspp2zy8hgakhhp33yw4e8l8rk9crn3jzkk8mp8ay2q3s0x3j", - "datum": null, - "inlineDatum": { - "int": -2 - }, - "inlineDatumhash": "0268be9dbd0446eaa217e1dec8f399249305e551d7fc1437dd84521f74aa621c", - "referenceScript": { - "script": { - "cborHex": "8202848200581c334f4f8dc2106a57a23c3cf271891da0567fbaada6fc0c6b39e9b8838200581cd30318892a54be9d575f9da93f6b477d749d06e095d0139da60c70c08202838201838200581c3d01bd1dd73a5f4e041ef18538b6f6a42b8f52c52afc78ad489a312f8200581ccb903a8da3c33e2ff81994ace97a3a510283ce4cb46cfbe1ba68664b8200581cf0105318fe4fc75cf951747d4a83286b12b8b85c3631b6dd968f44448202848200581c9abee0273490c2c0e184ea50284d3da7121b312c4fe220202db836398200581c35298e14b1c406c531ecd58881cafe1f1653f95cb19a2ffa05f898dd8200581cbdce9fbd29c8792a892d0e5aba083611620dbad1e5b590e63cb9420f8200581c7f42d6e4771748f676a4147998a3d2021654da41d67f7554d61aaf278202818200581c1efc82279d60973411b06c3e54e934ab871fdfed3f01c6c905ced00b820181830303848200581c422d3aa6d960d928396619c257d55494b53fa753c2868fe292fbbb048200581c7b993d651baebf911c2707f8425e4647b21b59970daadeeee7cb59648200581ca8e3141a46a00ab14fa883b5295b8b8ad5ee49ee5240a86a1bf8a09d8200581c6ec04ecc4a203605a43ce96e55a04a1fd059f13e0fd8cc49401bc048", - "description": "", - "type": "SimpleScript" + "4d50a11e297e7783383bf06dd6e4e481230323bd96cd8b8d9ee3888d": { + "31": 2 }, - "scriptLanguage": "SimpleScriptLanguage" - }, - "value": { - "2e12c5e499e0521b13837391beed1248a2e36117370662ee75918b56": { - "4ddb5215f863bd26187a5b1ad572c89c6d8b565108a423a0253af8": 2171306889146928025 - } - } - }, - "224d12a45887bbc236b9ed07362e8e9b5f187a49ea7f55d999443e60f1d8c805#14": { - "address": "addr_test1vznkwf2ffg5jn62qrh4yft9hg2jdwywcsfztuhu3knn9d8qtla4nx", - "datum": null, - "inlineDatum": { - "bytes": "ac24" - }, - "inlineDatumhash": "3ce336a95b49a57618ad5eff8895bb06abb1ff11c8c05111066d6b24333fb85a", - "referenceScript": { - "script": { - "cborHex": "8200581c84dea95c378549b5d889fb9da81b89caed0e7f9e9e0d4524ba6ffff2", - "description": "", - "type": "SimpleScript" + "b9ca878c7325e2a3a6fde59a2891c50d1993c178d58842b6c88b7ee3": { + "0f668eb33c43adee49bcbef0dfc179047c600d921deb7b019dd9428f209f": 1 }, - "scriptLanguage": "SimpleScriptLanguage" - }, - "value": { - "467f58932b54910584a0e8ea25a225e06a14530b2e96e938c53a3f22": { - "3622ae": 1693793897106477834 - } + "lovelace": 2043140577134189929 } }, - "26b48368df8575c976ac4913d0ae88eccf96cde35150c4a1cdd6f67afc34c86c#15": { - "address": "addr1v90agl7djdpy3zgfcfn3u0thas7pshz7nmun0spxan97pvg8wmu96", + "88fc0bbc502a90044657741ab7bc4dc76a7f608a546e94bcab9dccb6c34e42b3#65": { + "address": "addr1vyc4mtk9grs56tmqvqszn7dpddagx25s8n22u3e6h3gv54sdll6dy", "datum": null, - "datumhash": null, + "datumhash": "4be0461daa81aeaffe228753f3a41e320f2176fc174158bfec080bd8d2dbbcaa", "inlineDatum": null, "referenceScript": { "script": { - "cborHex": "820280", + "cborHex": "8200581c931024de07156a8ff35cfdd103e39302c71a54ed779da376dcdaea05", "description": "", "type": "SimpleScript" }, "scriptLanguage": "SimpleScriptLanguage" }, "value": { - "7b169c317bb025812c1851742f285227842b593b437683ee920aa76e": { - "35": 1 + "245d5a7a06fe18358242e81281cd5ba9e6abe4efc54e7b659f25abae": { + "2f2a1be93d1ad27cc5e9e955653d95f868d9f9c695fc55a930c7217de3": 1 }, - "lovelace": 2 + "lovelace": 7340769224894966011 } }, - "38377a93c28921315f91d19dc56bf1ba2d26a4d94242a6dbd21a49a8a3274885#26": { - "address": "addr_test1wr4ruppkmx7mnfs7fkhf9s2n2hfqcv9n8tcga52w3zsknzs7v0mua", + "bb5013e3608bccd9782ffbc9efdfb69118d517ac884c96983491104160899cb2#80": { + "address": "addr_test1xql6w8p5hkq9v4zv3u6j9ga7xu8902x5txvjaxq6fp8te0g0nr4wtu7amnazdrhxp3cdud95q4a985ntcazz9q6ft9us830kjh", "datum": null, "datumhash": null, "inlineDatum": null, - "referenceScript": { - "script": { - "cborHex": "484701000022220011", - "description": "", - "type": "PlutusScriptV1" - }, - "scriptLanguage": "PlutusScriptLanguage PlutusScriptV1" - }, - "value": { - "105a8f1bb56444cacc86378c95421aceeb326b0fb7743e493eb82fd5": { - "6b77cd082c4982": 1, - "a99e3c5f6065cf57f62f934b349af5": 2300656884495018937 - }, - "31d2be2f1c345d8e02a3d389e05fb0fa3b1d8bf30b2075f750dda70c": { - "7617bef1bcbf92205c0394523e8aee4a80fa4df982698edb": 2, - "d744faba7bc7630b3f21f58cf6722b5126bafcb4a4": 2 - }, - "lovelace": 3955408357072313485 - } - }, - "49d90deb69f21637f0ebcb4dd138982775b75725d74f798e2270b6f2826fd903#71": { - "address": "2RhQhCGqYPDn7Ndzzdw1NmyNSKHy4hhPRWhHWdcS7Yku8GdcYCN3R3Bwg1oGdvHUk7dsuzuB9iwbAfPtCdLdM7utnT2qcAPMD8GtbrCG4TnWXQ", - "datum": null, - "datumhash": "222fbbc44816d860202c0efa03fb3f19e45b0ecc643cefc2b8434ffa2e75916c", - "inlineDatum": null, "referenceScript": { "script": { "cborHex": "83030080", @@ -190,337 +52,57 @@ "scriptLanguage": "SimpleScriptLanguage" }, "value": { - "d201d08276106b737dea28f6175d8564075a289b8afbeb5e602a116e": { - "304f": 7042585879834811805 - }, - "lovelace": 7640410800880966542 - } - }, - "541fa51cd958873816bfaf75b239d91a369984b44653e4d6928ae6fb8147dbd5#18": { - "address": "addr1yx6r52fn2wdqru6ysaur66l2jm3ywk7gs75y9mgrp8s9fceag0m69mlld7vfr8jw6543wu0zd6l2kl7y43tgggqf0m9q6s9nj5", - "datum": null, - "datumhash": "c3fb9c77693bbf58de7e2ea4c6b20d14d109b03c5ee00a17b097c623620a27b9", - "inlineDatum": null, - "referenceScript": null, - "value": { - "b0c53e2bf180858da4b64eb5598c5615bba7d723d2b604a83b7f9165": { - "02fe8b653eb5ec126b02b23b6dff9f9afe8d3677324167": 8514306743356479562 - }, - "d531de61ca615f2ef789c7388560ccd528e5beb5e91e14bee62dfe07": { - "0033a64ae321e1e400901e0d4ec80a1d3f": 2, - "37": 2091412507686318020 - }, - "lovelace": 2 - } - }, - "5a6a541326625860acf69dc60e4845911da4e57c69c46b6900b63296c3c13a6f#95": { - "address": "addr12ya373vmm4znpn3vzhdq4u34zfjy9nqu9pz2vjmy9vmtdja58jqaynup795sx6xl9a", - "datum": null, - "inlineDatum": { - "int": -1 - }, - "inlineDatumhash": "ae85d245a3d00bfde01f59f3c4fe0b4bfae1cb37e9cf91929eadcea4985711de", - "referenceScript": { - "script": { - "cborHex": "82041a00196e15", - "description": "", - "type": "SimpleScript" - }, - "scriptLanguage": "SimpleScriptLanguage" - }, - "value": { - "2db8410d969b6ad6b6969703c77ebf6c44061aa51c5d6ceba46557e2": { - "e185b7fb22ab0d71dfc940f89cdd5bd266d4bde759387d8e3f": 4332458151991342456 - }, - "df2fb4c2583bf43d7d3e8c1186e9bcf22ac72e260a92094867948b4c": { - "32": 1 - }, - "lovelace": 8878433864389277303 - } - }, - "5cf5bd754fbee2aaf65150d8c91409c32139e1ab5638f3912aaa530326f55d2e#39": { - "address": "addr1g9z85jytthmz0ldc0t52has2xam65zt4yf87gs4t8tpqhdyvvzqe2xvpmqqq5e5v0r", - "datum": null, - "datumhash": null, - "inlineDatum": null, - "referenceScript": null, - "value": { - "2db8410d969b6ad6b6969703c77ebf6c44061aa51c5d6ceba46557e2": { - "33": 1, - "36": 8147579955038057501 - }, - "lovelace": 1 - } - }, - "5d473d5da83d145c1d3c8688ea50939897ca48da9c8cc2c93d14ed55d0a8a0fc#43": { - "address": "addr_test1wzgwp88ejg3ayz6s7gm4xxjqd6hjs97qx6cgtk7hk3xxwaqrfruv4", - "datum": null, - "inlineDatum": { - "map": [ - { - "k": { - "bytes": "fe" - }, - "v": { - "list": [ - { - "bytes": "579fc636" - }, - { - "constructor": 4, - "fields": [ - { - "bytes": "ae" - }, - { - "bytes": "0515" - }, - { - "bytes": "64c800fc" - } - ] - }, - { - "list": [] - }, - { - "bytes": "" - } - ] - } - }, - { - "k": { - "bytes": "fd75c0b0" - }, - "v": { - "int": 4 - } - } - ] - }, - "inlineDatumhash": "cb0c21d7c662ec9dfdfe012948e3043e191374d1a5c69be429aac566672b1110", - "referenceScript": { - "script": { - "cborHex": "83030282830302838201808202828200581ca33953cb8c88477856b715ce224dedf776edf97c5c2cfc18c981149d8200581c48007520de95ddf09235356b2d7e4f68da78b48e284d48c533c79df08200581ce7ed90bc4b43f3c633c2ab532c2bd52b868481426e2a96e397a9adbb820181830302838200581c601a621ce90b36bc2dc14183f53287cccc807526dce88bc434bfd4828200581c4954f73e9b11e4bc45b8514717dd48b06f3c05014b80cc00c44fe28f8200581cdf3b08ec8923977e1ddbc456874cb6540d8120edb9e030d8957c2923", - "description": "", - "type": "SimpleScript" - }, - "scriptLanguage": "SimpleScriptLanguage" - }, - "value": { - "b0c53e2bf180858da4b64eb5598c5615bba7d723d2b604a83b7f9165": { - "32": 5410017557655435170 + "95c51b6bdb9540146a729544e3f053a7cbc0cd544028c40f7d987ce8": { + "6ad280333c38c594b532e9e98993481c083b1e275b44a13eb8": 2 } } }, - "6091eeff3fa58be045b637d95f7ff29a182d38edae60619378a3c95859a9d66b#46": { - "address": "addr_test1vz6hyt7a5cytzvrh4jzl04uf9hxfl8265r8w4tl73t0e9ycgjpyf6", - "datum": null, - "datumhash": null, - "inlineDatum": null, - "referenceScript": null, - "value": { - "e69814850dbbe92f13e8e6d236fd1ca933331cc09bd328e4ccf8b810": { - "34": 1, - "5f0e534dd94f2eaefcd2fe992d8fa8bab267c0b762e14d7609c834": 3 - }, - "lovelace": 8849831192842545900 - } - }, - "663ae95e549a99f6a8c439838f9853f65443b9b0c899ec7c25d3d09ebe12c348#94": { - "address": "addr_test1xzxf66m3vesj9ggu37l5tapqp5eh36383z4jvkzggpmn2e39hh4sc7cwtka76du9vvmy6850vqdmdw8ddg8sv7e947jqwft2n6", - "datum": null, - "datumhash": "c463c917df062512cd7448826898560299027ec8b24824eddcecc4d6e9c2c84f", - "inlineDatum": null, - "referenceScript": { - "script": { - "cborHex": "820180", - "description": "", - "type": "SimpleScript" - }, - "scriptLanguage": "SimpleScriptLanguage" - }, - "value": { - "2e12c5e499e0521b13837391beed1248a2e36117370662ee75918b56": { - "9541375f65cf56": 1 - }, - "467f58932b54910584a0e8ea25a225e06a14530b2e96e938c53a3f22": { - "c904ff2743b1bea5634cc2baa8d069b896647c6b79bd38": 1 - }, - "lovelace": 66449967528434176 - } - }, - "68d007d55f28c1e72debdf7b815339a49537fe25b6ab41b11779e5dca023372e#97": { - "address": "addr_test1qz9vs5ar437ctaswq8eawvpv3j2pxmntweyzdwhzp44anqvrm0ref87ljw0lvefas4x3w0zyu5rmrjv4lexuvryrssksrk8pft", + "bbdfbd44c8d052cc08e548552d60bcdd848086214df874da4bdfbc873eb2663a#61": { + "address": "addr_test1qq4tlzrt7e6ks7ezqljd030mtf4nec87shuuwk339qkek5d0t6rlmda6zgzerulg0zqquly9wxe887vhuk26qc6srcgs3g2wla", "datum": null, "inlineDatum": { - "bytes": "cb" + "bytes": "39" }, - "inlineDatumhash": "db2b25e30737b0a56db5c1df9272903124472ff7c23ad1daa65757b2cf381073", + "inlineDatumhash": "96b23a356c80ba706dbf08c0c2b205576a6affd6f43b43ba8b7dc53d03555938", "referenceScript": { "script": { - "cborHex": "820280", + "cborHex": "83030080", "description": "", "type": "SimpleScript" }, "scriptLanguage": "SimpleScriptLanguage" }, "value": { - "7faff18e67ea6899b4f2fe2e5865512046934d6921356a4a0ae2563c": { - "32": 2 - }, - "9ac45ec96f0983d62525033854c8aa124d77ce4bd965c6ebe39d8731": { - "93": 4272806204979938038 - }, - "lovelace": 1 + "701301e03863797288b94b41a687e5d4a02d1b1ae803b66566b0d9cd": { + "37": 1, + "99e3451b9b220c3a68f984cd1fd8294c1a2f5a9932dc2230ee9675da5bf3": 8624952251565156719 + } } }, - "6cedcfb5ea2fef6f8d4461b5e87a04a7f612ff919e16edd1edc13dfa46170cd3#23": { - "address": "addr_test1zp7reqcnucfsxhf4depwumvh92yddjf4r58th7qsjz53fdzha7f0rzke0escxdnvmaj7wen0f7uy95np6tl2un3u8mgqsmtdrg", + "ceea7dca5eded4c182b4ce7e8e9a81ef4bbdd4f4a2601dced1cfb24371150506#74": { + "address": "addr1qytcngk6ejj8z3pjyay4radz0ycy77qgxxyqxg0dfeal4zlvm7sj9n48apnw44lqk5cra90t0l6uukf55a3jrjkdn53qdckh4f", "datum": null, "datumhash": null, "inlineDatum": null, "referenceScript": null, - "value": { - "2d725128406dc832eb74c4709aca0512499b3c7b17e00d7cb2e6d1b1": { - "2b7c82c75361fc5f42ff": 6313803577013887241 - }, - "b3633c8805f2561419f52942179d8c24321dbe10ddd51713cfefb5a9": { - "35": 6301377306614258962 - }, - "lovelace": 5623255101342044625 - } - }, - "8f175f7da0f617bded9aa5e6de7c8e089b942a2ebd5766b280348057d44c793b#28": { - "address": "addr_test1yruz7qg8x8q9uden0jkdk3f3f04yu4j2p9dsxhxpuy53x827emt5z8f94jnj4uszmtvlqc6pctyvpua48fdtwrp585as63d2fu", - "datum": null, - "inlineDatum": { - "list": [ - { - "list": [ - { - "bytes": "13e5" - } - ] - }, - { - "map": [ - { - "k": { - "list": [ - { - "bytes": "f391b5bc" - }, - { - "bytes": "5f8a70" - }, - { - "bytes": "0053b5" - }, - { - "bytes": "d1337e" - } - ] - }, - "v": { - "list": [ - { - "int": 5 - }, - { - "int": -5 - }, - { - "bytes": "8e8b4a" - } - ] - } - } - ] - } - ] - }, - "inlineDatumhash": "1d53c4b04589dc7c836845c2e88dd5dd043896a63f10f560ad04374585fbc158", - "referenceScript": { - "script": { - "cborHex": "82051a00427b50", - "description": "", - "type": "SimpleScript" - }, - "scriptLanguage": "SimpleScriptLanguage" - }, "value": { "2db8410d969b6ad6b6969703c77ebf6c44061aa51c5d6ceba46557e2": { - "ed4e2a8b169ff481a716dd9cf6717bf61e9ed5669cd3c9bc7cacb6": 5982800406012181715 - }, - "e63afe1fe56cde0e52ca1ae178b1969e192239f0c56347837ec5bc85": { - "39827497b06ba5c5d7cd5d3d3c6a08471f63464322": 3065730717280717707 - }, - "lovelace": 2 - } - }, - "9413d729e24b689cf455ed581ee05ccb3df256fe626b48e17cb973e812d20cb6#22": { - "address": "2cWKMJemoBahFeFVmZ7orpTXb1EHWYvEbL83uKJjFeDBhb6eSmEHXqQ3v6xPeFFzicgqw", - "datum": null, - "datumhash": "3fc20550f8715c6e2b8f02c104c939f48fb4fb26f421de2c4b02b513ed84b65f", - "inlineDatum": null, - "referenceScript": { - "script": { - "cborHex": "820181820280", - "description": "", - "type": "SimpleScript" + "35": 398286243212795050 }, - "scriptLanguage": "SimpleScriptLanguage" - }, - "value": { - "8f461954fe2f18fee1dca233f358907e643ff839ed1f995e4bf325e3": { - "03553d4492d3564df6ddb1e8d4596d0c": 6066850408847363484 + "6cdd130572d64fe2fdf60ccae073cadda00abe894af472b24bcf0510": { + "49fe106384b85c78005756ef5663ebe843df": 5915357064438993326 }, "lovelace": 1 } }, - "a6853852c0e21b2c7cb07f61be678aef0e279f0b151c55e05578dd24d41684ac#33": { - "address": "addr1y8h7ef4qdctdrfwnmywd4ykdfnlzgr3pvsswp8u7yw0unygwhnfrml9ld8agjvkuavpdpv3rf9ce8xdnzcfxgadldqysvneqk4", - "datum": null, - "datumhash": null, - "inlineDatum": null, - "referenceScript": { - "script": { - "cborHex": "8200581cc415a414c290527c5c55db2ec1cf1a05b019955b09d88e4a0cc65945", - "description": "", - "type": "SimpleScript" - }, - "scriptLanguage": "SimpleScriptLanguage" - }, - "value": { - "4d50a11e297e7783383bf06dd6e4e481230323bd96cd8b8d9ee3888d": { - "117d6cf6a5c2c5": 2 - }, - "lovelace": 3401109114681334338 - } - }, - "b4623889261ce430c803ff863d28f5d02b933565dc2f2ed38d512a0f857b9ace#26": { - "address": "addr1x8rz7lyxdemmsht5jp7npxnjzlqffu96svk28tfpglk92ey7vyxj6ztpprgtjc9d9k4rdmjk9ayvh32uww30m7ad5yysnhkk5w", - "datum": null, - "datumhash": null, - "inlineDatum": null, - "referenceScript": null, - "value": { - "8fc02da0763952ade83b9cc198672b11f7fb30ee6cdb374c2abeb2f4": { - "613a06c5c5a766c82dfaaca734c14545f3ef967ef782c828d8ab15": 1 - }, - "lovelace": 7094413255433815641 - } - }, - "b4c0ccda5f5642b2185aa41c14dfd8e08aa7c28b47b4df89d3a32bba28f1bf79#88": { - "address": "addr_test1wrylzqpdzps7kp4hklq7j44ncdaxk6gkfjer488u8pehs8c4g8a8s", + "dbc10b6bffa6f8ed857db9139fcdd92a77e19b206cb11226d9ba7d44e88497fb#68": { + "address": "addr_test1qzaem2lrzufyctp4aknnmz2kl2894ttzgzpdd5y8s8funzp90nhnnn8909rv336rg0pgr6nqmncgrxf2zzrqxwm43d2s4huje4", "datum": null, "datumhash": null, "inlineDatum": null, "referenceScript": { "script": { - "cborHex": "820180", + "cborHex": "830300818202838202808200581c7bb0149ec584a574e694c2bd40fc31412eb96fbff7a957d40b126d66830300838200581c129e5c1cab4e2073b7d4234c754b4fb77320a0ba945852b9b15152e98200581c3fb8320bde4148ea79750a675d3fbe920b8d1c0b03440d5af5d4815a8200581c7295c5272471f9c1023cf662d3b3da784c0263d23555038f8f55e7a4", "description": "", "type": "SimpleScript" }, @@ -528,177 +110,46 @@ }, "value": { "2d725128406dc832eb74c4709aca0512499b3c7b17e00d7cb2e6d1b1": { - "6f5592d1358040": 2 + "910f790716664a2be91220dea4157fa944": 1 }, - "8a960590cdb3d3dde567db45554eb2d0b3770ad60e511842848f6837": { - "cd822db3042570a82704e59c11227636b7cc71779192990a7503bf": 2 + "2e12c5e499e0521b13837391beed1248a2e36117370662ee75918b56": { + "32": 7643027927503669719, + "67c84c8a2c87c77f59b12696e683a4fee8": 7606139820363101951 }, - "lovelace": 2 + "lovelace": 6245124212329449893 } }, - "c5c55f32cf6a47492013a74a0d4ff35d3373e8dcc83b2b258d405055a534d60b#33": { - "address": "addr_test1qzw20869ur0f4qls8c4umsvrdjjlf6agtg7yu377cgmyqu6n3grfg6a99vl6p5jztcyzrv7qglkpv6ew22arjqw39svs27543v", + "f2bf4e62f510091bd98deaa55049bac8adb3dd0563b2dc47638503c3a3df79f0#50": { + "address": "addr_test1zp4hl6dt2v3fku2xpyqxhhr98zvq5a8g2utjw3d4ujjnl9r7xcm9jknry9eyn7yzk7jc5vn8gmrgv5e5kkpdt7a44adqt0n6mq", "datum": null, - "datumhash": null, + "datumhash": "eca38840b6238a82a6e342646dc235b7856783fffd86133c8c3aadfacaec2b38", "inlineDatum": null, "referenceScript": null, "value": { - "2ecc0e51bf289139bbd0d7c9f43af476bb4af0331e386b174396af08": { - "d1402b9e": 1246757260248537822 - }, - "8f461954fe2f18fee1dca233f358907e643ff839ed1f995e4bf325e3": { - "d8900f21bfebadc45250": 8053242471327646886 - }, - "lovelace": 2 - } - }, - "c61a58840489a3a27685f4b36eb51ba2589f48aaaccc833fe839297756511415#18": { - "address": "EqGAuA8vHnNoSWvHQh4sbFm2GQobAi6gpamTh49knGYqbqCpLVAsiBWQ82FRZcRGPKiMnNoaJRRmR6wZcdKaWYrZaD6euN465T9QQS9rwt1zgHKeJMhdYoh", - "datum": null, - "datumhash": null, - "inlineDatum": null, - "referenceScript": { - "script": { - "cborHex": "46450100002601", - "description": "", - "type": "PlutusScriptV1" - }, - "scriptLanguage": "PlutusScriptLanguage PlutusScriptV1" - }, - "value": { - "4a1c412d8e2b3015a7fb7d382808fb7cb721bf93a56e8bb6661cdebe": { - "425e86d5601f4e4a15b68d9c4c126a79d87280816d113a": 5926275459022330637 - }, - "lovelace": 4254655844372958482 - } - }, - "cc3bc52cfd362776392fa0e9c4c5db7cffaba979b250e84c4bcd7b881cfd9217#3": { - "address": "addr_test1wz5nqjxswt2f529ma0x0609jdyxxd5fa22csy0e2spc4lqg5d8j80", - "datum": null, - "datumhash": "b91a97bcbf8d2d3466ee3a65f259a4136316fe3794c751d5f1e3aa06b43b6813", - "inlineDatum": null, - "referenceScript": { - "script": { - "cborHex": "8201828202808200581c3644c20aa173b9e424a21bb61384249429bd30a46cc37f99079799a7", - "description": "", - "type": "SimpleScript" + "2db8410d969b6ad6b6969703c77ebf6c44061aa51c5d6ceba46557e2": { + "d85a7d0c21a12876b8c5aa720aca52de7e252aca6b756862d4169cdf": 1 }, - "scriptLanguage": "SimpleScriptLanguage" - }, - "value": { - "467f58932b54910584a0e8ea25a225e06a14530b2e96e938c53a3f22": { - "ef": 4319622565427611732 + "8845fe5a38571bc51cc0a1abc7b1cd79374d3cff20c0160fd803257a": { + "a7fa3effa61a9ba0c84b3984071db8": 1 }, "lovelace": 1 } }, - "cfa632e83e98e9ccfe0493818c354bf4badffced66cf13e9d46eb02763b0dc2e#96": { - "address": "addr1vx9vszv48l38gken7pw94zm2xq78fdz68vzm9pperprwumgfxwe39", - "datum": null, - "datumhash": "9d6736e30ea0f9aa532d21bda42a8852de7b608d961c723693bf35dcff510639", - "inlineDatum": null, - "referenceScript": { - "script": { - "cborHex": "82041a00d81869", - "description": "", - "type": "SimpleScript" - }, - "scriptLanguage": "SimpleScriptLanguage" - }, - "value": { - "3d2829dd958f0da02eb548bd2acdbf2064c48c9ce7b9caaab926968c": { - "3cfcc6cfbe71f5ce5b41d2f55314bc85f47c695fe9bdea1676": 5606510372046385370 - }, - "lovelace": 2 - } - }, - "ea1095692f4af33da06f4251edef173292a1c0ead7b711812e2bc856a26a4ab5#35": { - "address": "addr_test1xrygaw6l5k2068vzwm9vjwd5qjkmrw78849th88eqsmv8r5w8h4c4qygngysvh4aql5555830njdkm2aept9vtnxuggqylvpm5", + "f8fd1a0c22878222db02e216774d5002d9a36f634b1bafa0699237b889235c36#25": { + "address": "addr_test1qqzdtwd72hw6rzdpv2jnh2g9fp0putx4rn64ak2dncgn2d9kr72uv7qrlagwfe7x4amxr5eeelv355gv84kle3ae7llq7489nx", "datum": null, - "datumhash": null, + "datumhash": "c41e5e49d0f1b0f9c20b8cae003399ba196f10164b11b7c705870e08c77d06be", "inlineDatum": null, "referenceScript": null, "value": { - "3f921dd56619a70c7e611fb1b0afdb80d7c7020705f7046e928c83d0": { - "6c0ff1b00bd1021800f50d50ca038afe4f7d": 1, - "8c6f596c421901b4fbda37563cbd22e3398f8fc6070d62810a53456b624c0f": 3432931227223553449 + "64a5afe2016c0ae7a01578932e4c47aa1581d4246b6aa71fae7cfdbd": { + "34": 1 }, - "8de1946877d4f69fd0494fe0a75acab46fb307adac6fa86b1fb38d80": { - "36": 1, - "4a8219": 5062052180182544150 - }, - "lovelace": 1 - } - }, - "edae5a78fae939501d5cde8d2f0ee091d312ff6f9f27a598558450c551239359#93": { - "address": "addr1y8z9c473vgecedfff0hm35nr82kx6pg5r06cj45zxecluchhhq75ypgzvm2lynf2pjjtk7me04kul2klw6xufzuw3g3sdzewas", - "datum": null, - "inlineDatum": { - "bytes": "" - }, - "inlineDatumhash": "39df024ac52722fe8ae4c1a8740e4c5624a38c3820e504a059aae8728421f8bd", - "referenceScript": { - "script": { - "cborHex": "820280", - "description": "", - "type": "SimpleScript" - }, - "scriptLanguage": "SimpleScriptLanguage" - }, - "value": { - "4a1c412d8e2b3015a7fb7d382808fb7cb721bf93a56e8bb6661cdebe": { - "17": 2334008558392594045 - }, - "a2c9e42cdec33e6942200fb4dfe2d07b7141bfe2a9085bb2deaca38d": { - "38": 6166243752568383186 - }, - "lovelace": 2 - } - }, - "ee0e7ea072b9ec37857528bf6ed417e53692c33584fa013db5d1890d0dafa1af#41": { - "address": "EqGAuA8vHnNr4rFd2ta4EBELdzf5RpJYNVTYRsS1oQiSBsZfGAp63whSDcohWhPvbVjjhmmWoiyceWuiFQwtmbsbYFir6o8GcoC6RSZtHrVKzfxkaA5LEt2", - "datum": null, - "datumhash": null, - "inlineDatum": null, - "referenceScript": { - "script": { - "cborHex": "4746010000220011", - "description": "", - "type": "PlutusScriptV1" - }, - "scriptLanguage": "PlutusScriptLanguage PlutusScriptV1" - }, - "value": { - "9fa0f5dbf70407654b8e1202046ae110e1bf7357fe52e2ed568382b8": { - "7a5c2c": 2 - }, - "be82ad5658cd3a2d193f12e5b6270d276e33694752689df8fddd64f1": { - "9527d2395f0c1ace446b0a0a5a8b4c7d89929f222f03e13a2a93d46e27": 2 - }, - "lovelace": 2 - } - }, - "fa17a3f551e375b228f9ae44a3e9ae8fdab16a61ddc30f3746b9aa17a3be81ad#80": { - "address": "addr_test1qrqcn92quzfk3tqdjfgkedm38ltcqje6e4xczhrta7e0vtxu8hxhw9pddr4w49jmpxlsjmkr256e5td0fju0wfczrfcqxng3xs", - "datum": null, - "datumhash": null, - "inlineDatum": null, - "referenceScript": { - "script": { - "cborHex": "484701000022200101", - "description": "", - "type": "PlutusScriptV2" - }, - "scriptLanguage": "PlutusScriptLanguage PlutusScriptV2" - }, - "value": { - "8394fed448db0c176683492bf3d325d8ea5afa65accb331670e9bdec": { - "37": 2 - }, - "lovelace": 1 + "lovelace": 6463924100636283534 } } }, + "recoveredTxId": "a772e18558edd474a0c7c073652d6ef03f8c873211187ceb977d35f0a008d598", "recoveredUTxO": { "24bfbd53b1718fc9085ee6699eebe67b306c58ace8114ceeac34eb7df741e3c4#49": { "address": "addr1zyg73m628rgul9r8w35hrjtg29t25v3ayuy0vzg3axu0rn6lsty309u7pmu8s5jux0yscskhd7c8qe3qdhej6xalxlqqc797z4", diff --git a/hydra-node/json-schemas/api.yaml b/hydra-node/json-schemas/api.yaml index 1fb8b06ddfc..f66c82d0899 100644 --- a/hydra-node/json-schemas/api.yaml +++ b/hydra-node/json-schemas/api.yaml @@ -92,10 +92,10 @@ channels: - $ref: "api.yaml#/components/messages/DecommitRequested" - $ref: "api.yaml#/components/messages/DecommitApproved" - $ref: "api.yaml#/components/messages/DecommitFinalized" - - $ref: "api.yaml#/components/schemas/CommitRecorded" - - $ref: "api.yaml#/components/schemas/CommitApproved" - - $ref: "api.yaml#/components/schemas/CommitFinalized" - - $ref: "api.yaml#/components/schemas/CommitRecovered" + - $ref: "api.yaml#/components/messages/CommitRecorded" + - $ref: "api.yaml#/components/messages/CommitApproved" + - $ref: "api.yaml#/components/messages/CommitFinalized" + - $ref: "api.yaml#/components/messages/CommitRecovered" publish: summary: Commands sent to the Hydra node. @@ -141,6 +141,66 @@ channels: method: POST bindingVersion: '0.1.0' + /commits: + servers: + - localhost-http + publish: + description: Obtain a list of pending deposit transaction ID's. + operationId: pendingDepositsRequest + message: + payload: + type: "null" + bindings: + http: + type: request + method: GET + bindingVersion: '0.1.0' + subscribe: + operationId: pendingDepositsResponse + description: | + Possible responses of this endpoint are: + * 200 OK + message: + payload: + type: array + items: + type: string + + bindings: + http: + type: response + method: GET + bindingVersion: '0.1.0' + + /commits/tx-id: + servers: + - localhost-http + publish: + description: Recover deposited UTxO by providing a TxId of a deposit transaction in the request path. + operationId: recoverDepositRequest + message: + payload: + type: "null" + bindings: + http: + type: request + method: DELETE + bindingVersion: '0.1.0' + subscribe: + operationId: recoverDepositResponse + description: | + Possible responses of this endpoint are: + * 200 OK + * 400 Bad Request + message: + payload: + type: string + bindings: + http: + type: response + method: DELETE + bindingVersion: '0.1.0' + /snapshot/utxo: servers: - localhost-http @@ -186,7 +246,7 @@ channels: * String - 400 bad request message: payload: - type: string + $ref: "api.yaml#/components/messages/DecommitResponse" bindings: http: type: response @@ -585,6 +645,13 @@ components: payload: $ref: "api.yaml#/components/schemas/DecommitFinalized" + CommitRecorded: + title: CommitRecorded + description: | + Deposit is detected and recorded in the local state. + payload: + $ref: "api.yaml#/components/schemas/CommitRecorded" + CommitApproved: title: CommitApproved description: | @@ -624,6 +691,13 @@ components: payload: $ref: "api.yaml#/components/schemas/Transaction" + DecommitResponse: + title: DecommitResponse + description: | + Emitted by the server after drafting a decommit transaction. + payload: + type: string + ProtocolParameters: title: ProtocolParameters payload: @@ -1306,7 +1380,7 @@ components: utxoToCommit: $ref: "api.yaml#/components/schemas/UTxO" pendingDeposit: - $ref: "api.yaml#/components/schemas/TxId" + type: string seq: $ref: "api.yaml#/components/schemas/SequenceNumber" timestamp: @@ -1333,7 +1407,7 @@ components: utxo: $ref: "api.yaml#/components/schemas/UTxO" theDeposit: - $ref: "api.yaml#/components/schemas/TxId" + type: string seq: $ref: "api.yaml#/components/schemas/SequenceNumber" timestamp: diff --git a/hydra-node/json-schemas/logs.yaml b/hydra-node/json-schemas/logs.yaml index 1bbe3fcb04d..e73926785d4 100644 --- a/hydra-node/json-schemas/logs.yaml +++ b/hydra-node/json-schemas/logs.yaml @@ -1610,7 +1610,6 @@ definitions: - allTxs - confirmedSnapshot - seenSnapshot - - commitUTxO - pendingDeposits - decommitTx - version @@ -1633,11 +1632,6 @@ definitions: $ref: "logs.yaml#/definitions/SeenSnapshot" pendingDeposits: type: object - commitUTxO: - oneOf: - - type: "null" - - type: object - $ref: "api.yaml#/components/schemas/UTxO" decommitTx: oneOf: - type: "null" diff --git a/hydra-node/src/Hydra/API/HTTPServer.hs b/hydra-node/src/Hydra/API/HTTPServer.hs index aa0186eb76e..6a91703708b 100644 --- a/hydra-node/src/Hydra/API/HTTPServer.hs +++ b/hydra-node/src/Hydra/API/HTTPServer.hs @@ -37,7 +37,6 @@ import Network.Wai ( rawPathInfo, responseLBS, ) -import Test.QuickCheck (oneof) newtype DraftCommitTxResponse tx = DraftCommitTxResponse { commitTx :: tx @@ -92,11 +91,7 @@ instance (FromJSON tx, FromJSON (UTxOType tx)) => FromJSON (DraftCommitTxRequest simpleVariant val = SimpleCommitRequest <$> parseJSON val instance (Arbitrary tx, Arbitrary (UTxOType tx)) => Arbitrary (DraftCommitTxRequest tx) where - arbitrary = - oneof - [ FullCommitRequest <$> arbitrary <*> arbitrary - , SimpleCommitRequest <$> arbitrary - ] + arbitrary = genericArbitrary shrink = \case SimpleCommitRequest u -> SimpleCommitRequest <$> shrink u @@ -220,7 +215,7 @@ handleDraftCommitUtxo directChain getCommitInfo body = do -- TODO: How to make this configurable for testing? Right now this is just -- set to current time in order to have easier time testing the recover. -- Perhaps use contestation deadline to come up with a meaningful value? - deadline <- getCurrentTime -- <&> addUTCTime 60 + deadline <- getCurrentTime draftDepositTx headId commitBlueprint deadline <&> \case Left e -> responseLBS status400 [] (Aeson.encode $ toJSON e) Right depositTx -> okJSON $ DraftCommitTxResponse depositTx