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

Propose time handling ADR #450

Merged
merged 2 commits into from
Aug 22, 2022
Merged

Propose time handling ADR #450

merged 2 commits into from
Aug 22, 2022

Conversation

ch1bo
Copy link
Collaborator

@ch1bo ch1bo commented Aug 3, 2022

This is basically two decisions, but benefiting from the same context
and them depending on each other made me propose a single ADR.

@ch1bo ch1bo requested review from KtorZ, ffakenz and a user August 3, 2022 09:06
@github-actions
Copy link

github-actions bot commented Aug 3, 2022

Transactions 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 2022-08-22 13:53:01.03555156 UTC
Max. memory units 14000000.00
Max. CPU units 10000000000.00
Max. tx size (kB) 16384

Cost of Init Transaction

Parties Tx size % max Mem % max CPU
1 4833 9.52 3.75
2 5038 13.74 5.45
3 5243 15.36 6.06
5 5652 16.90 6.58
10 6682 27.10 10.52
46 14059 98.85 38.18

Cost of Commit Transaction

Currently only one UTxO per commit allowed (this is about to change soon)

UTxO Tx size % max Mem % max CPU
1 5768 19.92 8.05

Cost of CollectCom Transaction

Parties Tx size % max Mem % max CPU
1 13065 20.68 8.29
2 13379 36.51 14.78
3 13772 56.26 22.96
4 14164 78.93 32.38

Cost of Close Transaction

Parties Tx size % max Mem % max CPU
1 9327 8.19 3.36
2 9488 8.97 3.81
3 9725 10.58 4.59
5 10023 11.70 5.32
10 10881 16.27 7.84
30 14229 32.95 17.29
61 15315 37.36 14.16

Cost of Contest Transaction

Parties Tx size % max Mem % max CPU
1 9364 8.56 3.49
2 9487 8.94 3.79
3 9660 9.72 4.24
5 9988 11.28 5.15
10 10882 16.20 7.80
30 14223 32.42 17.07
43 16369 42.64 22.97

Cost of Abort Transaction

Parties Tx size % max Mem % max CPU
1 13494 22.50 9.35
2 14175 45.65 20.31
3 13926 52.63 22.47
4 14607 86.78 39.16

Cost of FanOut Transaction

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

UTxO Tx size % max Mem % max CPU
1 13546 10.64 4.61
2 13457 11.40 5.19
3 13557 13.30 6.22
5 13695 17.27 8.35
10 13807 24.25 12.49
50 15249 84.88 47.60
59 15571 98.60 55.53

@github-actions
Copy link

github-actions bot commented Aug 3, 2022

Unit Test Results

238 tests  ±0   236 ✔️ ±0   12m 51s ⏱️ + 1m 53s
  87 suites ±0       2 💤 ±0 
    5 files   ±0       0 ±0 

Results for commit 89cfbc7. ± Comparison against base commit ab728f0.

♻️ This comment has been updated with latest results.

@ch1bo ch1bo force-pushed the ch1bo/adr-20-handling-time branch 3 times, most recently from f392227 to 89cfbc7 Compare August 5, 2022 11:42
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Minor comments that can be addressed later on


* Cardano is our layer 1 and its consensus layer separates time into discrete steps, where each step is called a `Slot`. The network is expected to evolve strictly monotonically on this time scale and so slot numbers (`SlotNo`) are always increasing.

* The Cardano mainnet has a block scheduled every 20 seconds, although it may take longer.
Copy link

Choose a reason for hiding this comment

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

seconds -> slots ?

* Cardano is our layer 1 and its consensus layer separates time into discrete steps, where each step is called a `Slot`. The network is expected to evolve strictly monotonically on this time scale and so slot numbers (`SlotNo`) are always increasing.

* The Cardano mainnet has a block scheduled every 20 seconds, although it may take longer.
- This is because it has `f = 0.02` and slot length is one second.
Copy link

Choose a reason for hiding this comment

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

I see, my comment is perhaps not relevant. I would intuitively have framed things the other way round as we start introducing the concept of Slot first.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But this is even wrong.. it should say 0.05, so thanks for pointing out 😅

Copy link

Choose a reason for hiding this comment

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

😂

- Trying to convert wall-clock time to slots of the Head protocol deadline led to `PastHorizonException` (when using very low security parameter `k`)
- Trying to `fanout` after the deadline, but before another block has been seen by the L1 ledger led to `OutsideValidityIntervalUTxO`.

* The second problem scenarion and solution ideas are roughly visible on this whiteboard:
Copy link

Choose a reason for hiding this comment

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

typo: scenarion -> scenario

- Ensures clients only see `ReadyToFanout` when a following `Fanout` would be really possible.
- Makes the `Delay` effect redundant and we can remove it (only delay via reenqueue on the `Wait` outcome)

* We get a first, rough notion of time for free in our L2 and can support "timed transactions" with same resolution as the L1.
Copy link

Choose a reason for hiding this comment

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

This would require converting back wall-clock time to slots in the L2 which is dependent on the L2 slot length.
suggestion: Add a note saying this can be made configurable by changing the config files for the L2 ledger

This is basically two decisions, but benefiting from the same context
and them depending on each other made me propose a single ADR.
@ch1bo ch1bo force-pushed the ch1bo/adr-20-handling-time branch from 89cfbc7 to 597fedc Compare August 22, 2022 13:41
@ch1bo ch1bo merged commit 769f769 into master Aug 22, 2022
@ch1bo ch1bo deleted the ch1bo/adr-20-handling-time branch August 22, 2022 13:42
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.

2 participants