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
Load and save event sourced state #1000
Conversation
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 TransactionThis is using ada-only outputs for better comparability.
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.
End-To-End Benchmark ResultsThis page is intended to collect the latest end-to-end benchmarks results produced by Hydra's Continuous Integration system from the latest Please take those results with a grain of salt as they are currently produced from very limited cloud VMs and not controlled hardware. Instead of focusing on the absolute results, the emphasis should be on relative results, eg. how the timings for a scenario evolve as the code changes. Generated at 2023-08-01 09:44:37.221077823 UTC 3-nodes ScenarioA rather typical setup, with 3 nodes forming a Hydra head.
Baseline ScenarioThis scenario represents a minimal case and as such is a good baseline against which to assess the overhead introduced by more complex setups. There is a single hydra-node d with a single client submitting single input and single output transactions with a constant UTxO set of 1.
|
5dcc44e
to
5281614
Compare
d102200
to
79b67f8
Compare
5281614
to
8e597d0
Compare
4e177d3
to
0367cc3
Compare
0367cc3
to
46138c5
Compare
46138c5
to
146992d
Compare
0a0d93f
to
a6fbe49
Compare
7834ce7
to
1cb2258
Compare
54a138f
to
5d55373
Compare
Test Results339 tests - 11 334 ✔️ - 11 18m 26s ⏱️ - 4m 11s Results for commit 266d837. ± Comparison against base commit d64e9a1. This pull request removes 13 and adds 2 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
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 work guys!
9423141
to
c16766b
Compare
2. Add an `aggregateState` function to manage applying `StateChanged` events on top of the current `HeadState` to keep it updated in-memory. | ||
3. Persist `StateChanged`s in an append-only log using a dedicated [handle](/adr/4). | ||
4. Upon node startup, reread `StateChanged` events log and reapply those to reset the `HeadState`. | ||
3. _(Optional)_: Make `StateChanged` _invertible_. |
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 think we should remove this
- Instead of having the `HeadLogic` emits directly a `ClientEffect`, the latter could be the result of a client-centric _interpretation_ of a `StateChanged`. | ||
- Pushing this a little further, we could maintain a _Query Model_ for clients with a dedicated [Query API](https://github.com/input-output-hk/hydra/discussions/686) to ease implementation of stateless clients. | ||
- Crashing nodes could catch-up with the Head's state by requesting `StateChanged` changes they are missing. | ||
- Calling `StateChanged` an _event_ while treating it in the code alongside _effects_ might introduce some confusion as we already use the word [Event](https://github.com/input-output-hk/hydra/blob/45913954eb18ef550a31017daa443cee6720a00c/hydra-node/src/Hydra/HeadLogic.hs#L64) to designate the inputs to the Head logic state machine. We might want at some later point to unify the terminology. |
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.
This is missing one consequence/drawbacks we have identified throughout executing this:
- Terms from specification are distributed over
update
andaggregate
functions
EventQ -->> Node : event | ||
deactivate EventQ | ||
critical modifyHeadState | ||
Node ->> State : getState |
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.
There is not really a getState
and setState
function. Instead of the critical area, I think we could use a modifyHeadState
call/activation box (using +
in the mermaid arrow)
d4f3015
to
ef8a2ec
Compare
31dd42b
to
d269a03
Compare
It's sufficient to log how many events were loaded now and we avoid a branch in our code this way.
Instead of unit testing loadState and asserting blindly that sometimes we persist something, we formulate a tests which re-instantiates a 'HydraNode' given a 'PersistenceIncremental' and assert it can process a particular NetworkEvent as expected after reload.
We still throw the exception from within this function to avoid having too much logic in the Main.hs (and see this is as an exception of "parse don't validate"). Using a writer makes the code a bit simpler and should not be a performance problem here.
The hydra-node was missing the protocol-parmeters.json and failed for that reason. In the long-term, we should make the setup simpler.
d269a03
to
b84c855
Compare
We used to limit the max number of participants in this branch when generating arbitrary HeadParameters, but this turns out to be not needed.
This is to match current implementation.
b84c855
to
266d837
Compare
Changes persisted state to be a sequence of events according to ADR24. Persistence is now done incrementally after each
StateChanged
outcome.Removes dependency on persistence format from some e2e tests.
Changes log schema of
LoadedState
to contain the number of events loaded.Moves parameter/persistence checking to
Hydra.Node
moduleUpdates ADR24 to reflect current implementation and marks it as accepted.