-
Notifications
You must be signed in to change notification settings - Fork 88
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
Refactor HeadLogic with types for each state #725
Conversation
Test Results276 tests - 11 270 ✔️ - 11 14m 19s ⏱️ - 2m 29s Results for commit 237fd61. ± Comparison against base commit 62384c9. This pull request removes 11 tests.
♻️ This comment has been updated with latest results. |
Transactions CostsSizes and execution budgets for Hydra protocol transactions. Note that unlisted parameters are currently using
Script summary
Cost of Init Transaction
Cost of Commit TransactionCurrently only one UTxO per commit allowed (this is about to change soon)
Cost of CollectCom Transaction
Cost of Close Transaction
Cost of Contest Transaction
Cost of Abort TransactionSome variation because of random mixture of still initial and already committed outputs.
Cost of FanOut TransactionInvolves spending head output and burning head tokens. Uses ada-only UTxO for better comparability.
|
8c98b1f
to
cd7b021
Compare
22587e5
to
5595e33
Compare
cd7b021
to
134b12d
Compare
134b12d
to
64d8151
Compare
@@ -1,7 +1,6 @@ | |||
{-# LANGUAGE DuplicateRecordFields #-} | |||
{-# LANGUAGE TypeApplications #-} | |||
{-# LANGUAGE UndecidableInstances #-} | |||
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
NewState closedState $ | ||
notifyClient : | ||
[ OnChainEffect | ||
{ -- REVIEW: Was using "old" chainState before |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is using the newChainState
here correct as we were using the previous one before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure yet, that's why I left this comment 🙂 It might have been an oversight and is more evident now
64d8151
to
762ecd4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the motivation behind this, but I would like to suggest we do not change the API: The additional level of indirection introduced by XXXState
types do not make sense in the JSON schema.
a895946
to
54004cc
Compare
This allows us to define type-safe functions which only act on one of the head states. Idle in this case.
This also fixes an (in-flight of this branch) broken field access. Also, the TODO seems not relevant anymore so I removed it.
This allowed us already to remove incomplete record updates from HeadLogic module.
We could think of encoding the possible previous states for each state type, but this would be a bit too much right now. Instead, this commit is motivated to limit the length of state linked lists we generate.
54004cc
to
6d4024f
Compare
We chose not to manually implement ToJSON/FromJSON instances for HeadState just to keep backward compatibility on the logs JSON schema. A manual instance would mean higher maintainability demands, whereas the logs schema is not so important as for example the api schema.
6d4024f
to
237fd61
Compare
🧹 Address some XXX in
HeadLogic
by creating actual types forOpenState
et al. This make the interface betweenupdate
andon...
functions smaller and could be used to split theupdate
into multiple cases (one for each state) later.