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

No processing of transactions during a decommit #1540

Merged
merged 5 commits into from
Aug 8, 2024

Conversation

v0d1ch
Copy link
Contributor

@v0d1ch v0d1ch commented Jul 31, 2024

fix #1526

Related specification PR cardano-scaling/hydra-formal-specification#7

Why?

  • New L2 transactions fail when decommit is in flight because we try to re-apply the local decommit tx

What

  • Make sure the new snapshots are created only if the version is matched
  • Any pending decommit needs to match with the decommit in confirmed snapshot thus preserved in the next snapshot/s until it is observed.

  • CHANGELOG updated or not needed
  • Documentation updated or not needed
  • Haddocks updated or not needed
  • No new TODOs introduced or explained herafter

@v0d1ch v0d1ch self-assigned this Jul 31, 2024
@v0d1ch v0d1ch requested a review from a team July 31, 2024 07:25
Copy link

github-actions bot commented Jul 31, 2024

Transaction costs

Sizes and execution budgets for Hydra protocol transactions. Note that unlisted parameters are currently using arbitrary values and results are not fully deterministic and comparable to previous runs.

Metadata
Generated at 2024-08-08 07:21:12.737612851 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial 2fac819a1f4f14e29639d1414220d2a18b6abd6b8e444d88d0dda8ff 3799
νCommit 2043a9f1a685bcf491413a5f139ee42e335157c8c6bc8d9e4018669d 1743
νHead bd9fad235c871fb7f837c767593018a84be3083ff80f9dab5f1c55f9 10194
μHead c8038945816586c4d38926ee63bba67821eb863794220ebbd0bf79ee* 4607
  • The minting policy hash is only usable for comparison. As the script is parameterized, the actual script is unique per head.

Init transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 5186 5.61 2.21 0.44
2 5390 7.31 2.90 0.47
3 5591 8.64 3.42 0.49
5 5994 11.39 4.51 0.54
10 6996 18.06 7.14 0.66
56 16246 81.47 32.22 1.76

Commit transaction costs

This uses ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 557 10.52 4.15 0.29
2 747 13.86 5.65 0.34
3 933 17.33 7.20 0.38
5 1307 24.65 10.44 0.48
10 2252 45.22 19.36 0.75
20 4124 95.99 40.76 1.40

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 549 21.49 8.43 0.41
2 114 659 33.93 13.42 0.55
3 169 773 45.25 18.13 0.68
4 227 883 60.03 24.21 0.85
5 282 989 78.32 31.74 1.06
6 338 1100 98.21 39.96 1.28

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 626 17.96 7.88 0.38
2 824 20.18 9.46 0.42
3 1042 22.60 11.13 0.46
5 1268 25.44 13.69 0.51
10 1975 32.34 19.97 0.64
50 7774 95.85 73.84 1.80

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 640 20.98 9.39 0.42
2 732 22.07 10.47 0.44
3 870 23.54 11.88 0.46
5 1171 26.86 15.00 0.53
10 1941 34.66 22.56 0.68
50 8100 99.04 83.82 1.91

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 670 27.14 11.66 0.48
2 906 29.40 13.58 0.53
3 894 30.22 14.32 0.54
5 1222 34.23 17.71 0.61
10 2106 44.80 26.82 0.80
39 6438 98.90 73.55 1.76

Abort transaction costs

There is some variation due to the random mixture of initial and already committed outputs.

Parties Tx size % max Mem % max CPU Min fee ₳
1 5081 17.43 7.59 0.57
2 5181 28.46 12.48 0.70
3 5314 41.53 18.31 0.85
4 5520 59.69 26.52 1.07
5 5684 79.01 35.23 1.29
6 5679 95.15 42.35 1.47

FanOut transaction costs

Involves spending head output and burning head tokens. Uses ada-only UTxO for better comparability.

Parties UTxO UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
5 0 0 5022 7.95 3.36 0.46
5 1 56 5055 8.88 3.99 0.47
5 5 285 5192 13.60 6.92 0.54
5 10 568 5361 19.06 10.39 0.62
5 20 1135 5698 30.38 17.51 0.77
5 30 1708 6042 42.10 24.80 0.94
5 40 2277 6382 53.43 31.93 1.09
5 50 2847 6721 64.37 38.89 1.25
5 81 4611 7773 99.53 61.01 1.74

End-to-end benchmark results

This page is intended to collect the latest end-to-end benchmark results produced by Hydra's continuous integration (CI) system from the latest master code.

Please note that these results are approximate as they are currently produced from limited cloud VMs and not controlled hardware. Rather than focusing on the absolute results, the emphasis should be on relative results, such as how the timings for a scenario evolve as the code changes.

Generated at 2024-08-08 07:23:50.149991122 UTC

Baseline Scenario

Number of nodes 1
Number of txs 3000
Avg. Confirmation Time (ms) 5.201270347
P99 8.308878819999995ms
P95 6.903310199999998ms
P50 5.004944999999999ms
Number of Invalid txs 0

Three local nodes

Number of nodes 3
Number of txs 9000
Avg. Confirmation Time (ms) 23.628713598
P99 47.552444290000075ms
P95 31.92053799999999ms
P50 21.761108999999998ms
Number of Invalid txs 0

@v0d1ch v0d1ch added this to the 0.18.0 milestone Jul 31, 2024
@v0d1ch v0d1ch force-pushed the no-processing-of-transactions-during-decommit branch 2 times, most recently from cb51ca8 to ef7c99b Compare July 31, 2024 18:43
hydra-node/test/Hydra/BehaviorSpec.hs Outdated Show resolved Hide resolved
hydra-node/src/Hydra/HeadLogic.hs Outdated Show resolved Hide resolved
@v0d1ch v0d1ch force-pushed the no-processing-of-transactions-during-decommit branch 2 times, most recently from 3dd31a6 to bee2a35 Compare August 1, 2024 09:51
Copy link

github-actions bot commented Aug 1, 2024

Test Results

466 tests  +2   459 ✅ +2   17m 30s ⏱️ + 1m 9s
149 suites ±0     7 💤 ±0 
  5 files   ±0     0 ❌ ±0 

Results for commit 5753598. ± Comparison against base commit 7e5730b.

♻️ This comment has been updated with latest results.

@ch1bo ch1bo removed this from the 0.18.0 milestone Aug 5, 2024
@v0d1ch v0d1ch force-pushed the no-processing-of-transactions-during-decommit branch 5 times, most recently from d1b24f2 to e479f1b Compare August 6, 2024 13:38
@v0d1ch v0d1ch requested a review from ch1bo August 6, 2024 13:47
@v0d1ch v0d1ch force-pushed the no-processing-of-transactions-during-decommit branch from e479f1b to 90e433c Compare August 7, 2024 07:05
Copy link
Collaborator

@ch1bo ch1bo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only bug I found was the require/wait mix

Could align it more with the spec though.

Also, the spec is now in another repo so we need two PRs. This PR then should point to the new, updated spec in its flake inputs.

hydra-node/json-schemas/logs.yaml Outdated Show resolved Hide resolved
hydra-node/json-schemas/logs.yaml Outdated Show resolved Hide resolved
hydra-node/src/Hydra/HeadLogic.hs Show resolved Hide resolved
hydra-node/src/Hydra/HeadLogic.hs Outdated Show resolved Hide resolved
hydra-node/src/Hydra/HeadLogic.hs Outdated Show resolved Hide resolved
hydra-node/test/Hydra/BehaviorSpec.hs Show resolved Hide resolved
hydra-node/test/Hydra/BehaviorSpec.hs Show resolved Hide resolved
hydra-node/test/Hydra/HeadLogicSpec.hs Outdated Show resolved Hide resolved
hydra-node/json-schemas/logs.yaml Outdated Show resolved Hide resolved
hydra-node/test/Hydra/BehaviorSpec.hs Show resolved Hide resolved
hydra-node/test/Hydra/BehaviorSpec.hs Show resolved Hide resolved
hydra-node/test/Hydra/BehaviorSpec.hs Outdated Show resolved Hide resolved
hydra-node/test/Hydra/BehaviorSpec.hs Show resolved Hide resolved
hydra-node/test/Hydra/BehaviorSpec.hs Show resolved Hide resolved
ch1bo and others added 2 commits August 7, 2024 15:47
On every ReqSn we wait to see the local version being the same as
the requested one before we request a new snapshot.

Signed-off-by: Sasha Bogicevic <[email protected]>
Signed-off-by: Sasha Bogicevic <[email protected]>
Signed-off-by: Sasha Bogicevic <[email protected]>
@v0d1ch v0d1ch force-pushed the no-processing-of-transactions-during-decommit branch from 14c1842 to 85edad1 Compare August 7, 2024 13:56
Copy link
Collaborator

@ch1bo ch1bo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must refer to an updated formal spec flake input. I'll review it again in more detail tomorrow

Signed-off-by: Sasha Bogicevic <[email protected]>
@ch1bo ch1bo self-requested a review August 8, 2024 07:49
Copy link
Collaborator

@ch1bo ch1bo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this manually on a slow local devnet and can't reproduce the behavior from the bug - fixed! 💪

Side note though: If we have multiple snapshots with a utxoToDecommit, the hydra-node seems to submit it on each snapshot confirmation, resulting eventually to a race of multiple decrementTxs and errors reported like:

TxValidationErrorInCardanoMode (ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError (UtxowFailure (AlonzoInBabbageUtxowPredFailure (ExtraRedeemers [Alonz
oSpending (AsIx {unAsIx = 0})])) :| [UtxowFailure (AlonzoInBabbageUtxowPredFailure (PPViewHashesDontMatch (SJust (SafeHash \"10f0625aedbf7ada32774b7574fb8223808451d22806d3693f31b76cbbc6c3fa\")) (SJust (SafeHash \"5e13ca4c11ff1467512cde99f5e300f7dc19f39099fd83b8b3e35b80427914f8\")))),UtxowFailure (UtxoFailure (AlonzoInBabbageUtxoPredFailure (ValueNotConservedUTxO (MaryValue (Coin 0) (MultiAsset (fromList []))) (MaryValue (Coin 86182523) (MultiAsset (fromList [(PolicyID {policyID = ScriptHash \"3bc4890827e9784f22ee115016d5dcaf073b407175398b04f8f23ae0\"},fromList [(\"4879647261486561645631\",1),(\"f8a68cd18e59a6ace848155a0e967af64f4d00cf8acee8adc95a6b0d\",1)])])))))),UtxowFailure (UtxoFailure (AlonzoInBabbageUtxoPredFailure (BadInputsUTxO (fromList [TxIn (TxId {unTxId = SafeHash \"9762190e385ad32de7eafd14044748d98cb6cbfc9ea59ab4e11faa7fedf450c4\"}) (TxIx {unTxIx = 0}),TxIn (TxId {unTxId = SafeHash \"9762190e385ad32de7eafd14044748d98cb6cbfc9ea59ab4e11faa7fedf450c4\"}) (TxIx {unTxIx = 2})])))),UtxowFailure (UtxoFailure (AlonzoInBabbageUtxoPredFailure NoCollateralInputs)),UtxowFailure (UtxoFailure (AlonzoInBabbageUtxoPredFailure (InsufficientCollateral (DeltaCoin 0) (Coin 2586266))))])))

hydra-node/src/Hydra/HeadLogic.hs Show resolved Hide resolved
hydra-node/test/Hydra/BehaviorSpec.hs Show resolved Hide resolved
@ch1bo ch1bo enabled auto-merge August 8, 2024 10:21
@ch1bo ch1bo merged commit 70843d8 into master Aug 8, 2024
21 checks passed
@ch1bo ch1bo deleted the no-processing-of-transactions-during-decommit branch August 8, 2024 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No processing of transactions during a decommit
3 participants