-
Notifications
You must be signed in to change notification settings - Fork 86
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
Commit vs rollbacks #827
Commit vs rollbacks #827
Conversation
35bfc65
to
550c035
Compare
f367420
to
55dad07
Compare
55dad07
to
7f55988
Compare
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.
|
Test Results304 tests +1 298 ✔️ +1 17m 47s ⏱️ -27s Results for commit c0c14d2. ± Comparison against base commit 586eb27. This pull request removes 7 and adds 8 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
089e8c5
to
1ec9668
Compare
1ec9668
to
4cb08a7
Compare
c250cb8
to
18c761b
Compare
This is using prior work from #827 et al.
f7b2868
to
d0b8df6
Compare
Commit Problems with rollback managemen mainly remove a lot of rollback logic from the head logic. It has an impact on what's been done in #184 This were the requirements from #184: ✅ The hydra-node does not crash when a rollback occursThis is still ensured by the "rolling back & forward" tests from BehaviorSpec: It is also ensured by the ModelSpec and the fact that the MockChain now rollbacks and the tests pass. ❌ A ServerOutput is emitted to the client when a rollback occursWe discovered that the rollback server output is of no use as it is right now. As a client, we get the message rollback but, really, we have no idea what to do with that. We could easily keep that message if we want but we decided to remove it for now as it's a sort of noise the client wouldn't no how to use. #185 ✅ When a not-yet-open head is rolled back, clients can continue opening (i.e. commit, close or abort) the head after the rollback occurred (safety)The property check head opens if all participants commit in Although note that we only exercise rollbacks and forward were all the seen transactions will happen again in the fork, we do not consider situations were a transaction will disappear from the fork. Also, the chainState being rolled back, I could imagine a situation were the head logic would post a collecCom transaction when, from the chainState point of view, not everybody has committed yet. But for some reasons I was not able to reproduce this in the test... maybe I'm missing something here but even if it happens in real life, it should not introduce any security risk for the user. Worst case: a node crashing when trying to open the head? ✅ When an already-open head is rolled back "crossing opening point", it is acceptable that the off-chain communication state is reset and we could continue or contest (no liveliness)I don't see how this requirement would have been impacted by this change. |
d0b8df6
to
89b8ce0
Compare
@pgrange Interesting proposal of not doing rollbacks at all on the HeadState!
This is not tested by the BehaviorSpec as it only covers the business logic and nothing on the chain layer. The ModelSpec with the MockChain including about 80% of the Direct chain should give higher confidence here.
These are the interesting cases and this can certainly happen. I do not think the node will crash though and expect more an error when posting a tx, but this is also happening today when everyone tries to collect after the last commit (which is the behavior on Example scenario:
This will be still true, depending in how we will implement this.
|
644d8ba
to
2bd6fa3
Compare
c502618
to
48a5ead
Compare
We currently have the slot and the chain state in the rollback event. If we only use the chain slot and never use the included chainState, the computation for rolling it back will never be forced and practically the 'rollback' function is not tested that way.
This hides the fact that internally a list of 'ChainStateAt' values is kept and narrows down the interface of getting the latest chain state, pushing a new one and rolling back to a previous one.
This is redundant to the already included ChainStateType as every such chain state needs have a ChainSlot via the IsChainState type class.
- We want to be able to keep the history of chain states.
We may see a rollback by 0 observable blocks, which is okay.
This will correctly allow it to resume from the provided 'ChainStateAt' even in presence of rollbacks.
ConnectToChain -> SimulatedChainNetwork TestHydraNode -> TestHydraClient
This will simplify any further refactoring of the mocked chain and connected nodes are managed internally.
Also refactor flushQueue and inline block creation.
The comment was already saying that this is good practice and indeed in the given context 'm' can be any IO-ish monad, so we keep the 'threads' to clean them up in 'stopTheWorld'.
dc22b76
to
c0c14d2
Compare
Fixes #784
☕ Introduces
rollbackAndForward
on mock chain to simulate rollbacks during model spec executions.☕ Adds ADR23 to provide a rationale for the following changes.
☕ Removes the high-level handling of rollbacks in
HeadLogic
, but keeps aLocalChainState
inChain.Direct
which is rolled back and kept up-to-date to do consistent chain following. This gets rid of the problematic race condition betweensetChainState
andchainCallback
. ThechainState
inheadState
is kept for persistency reasons.☕ Adds tests to
HandlersSpec
which do cover the newly moved-into-chain-layerrollback
logic.☕ Drops the
RolledBack
server output as clients cannot do anything about it.☕ Small refactorings across
MockChain
,BehaviorSpec
,Model
modules.