-
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
Implement the LocalStateQueryServer #1507
Conversation
TODO:
|
0554eae
to
5b07c4f
Compare
class QueryLedger blk where | ||
|
||
-- | Different queries supported by the ledger | ||
data family Query blk :: * |
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.
Make this is type class parameter instead so that we can have multiple Query
types for a single blk
. Result
can remain a data family.
ouroboros-consensus/src/Ouroboros/Consensus/LocalStateQueryServer.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/Ouroboros/Consensus/LocalStateQueryServer.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/test-consensus/Test/Consensus/Ledger/Byron.hs
Outdated
Show resolved
Hide resolved
@@ -1101,6 +1108,7 @@ type LimitedApp' m peer blk unused1 unused2 = | |||
(AnyMessage (TxSubmission (GenTxId blk) (GenTx blk))) |
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.
Turn this into a Lazy.ByteString
to be uniform and compatible with the plan to use a single functor (either Const Lazy.ByteString
or AnyMessage
) for NetworkApplication
.
ouroboros-consensus/test-consensus/Test/Consensus/LocalStateQueryServer.hs
Outdated
Show resolved
Hide resolved
602e134
to
3739854
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.
Nice, great to have a typed solution to this :)
Querying the ledger state can only happen for a ledger state corresponding to a block, not to a ledger.
3739854
to
50f3dd1
Compare
@coot @dcoutts Can we merge this without breaking network compatibility if we don't change the |
@coot Edsko already reviewed the consensus side of this PR. You only have to look at the changes in |
50f3dd1
to
f0fa03a
Compare
Answer: "network compatibility" is determined by the |
This new abstraction replaces `getPastLedger` and can, in the future, allow for more efficient rolling forward. For example, when requesting a ledger state 100 blocks after some ledger snapshot we have in memory, we'll need to apply 100 blocks to the ledger. This won't change with the `LedgerCursor` abstraction, but if we then starting rolling forward and requesting the ledger states 101, 102, 103, ... blocks after our in-memory ledger snapshot, we only have to apply one block each time, instead of having to apply 101, 102, 103, ... blocks each time! This optimisation has not yet been implemented, but by introducing the abstraction now, we can later implement it without having to change the API.
It was storing both the last applied point (slot + hash) and hash. We only need to store the former.
This will be used for the LocalStateQuery protocol.
As the `LocalStateQueryServer` will send this over the network in the form of `Result ByronBlock`, we must be careful not to break network compatibility with clients, hence the golden test.
To actually enable it, we still need to add it to `NodeToClientProtocols`. This means we're not breaking "network compatibility" yet.
The protocol will now guarantee that the response to a Query has the right type.
f0fa03a
to
0ec858c
Compare
bors r+ |
1507: Implement the LocalStateQueryServer r=mrBliss a=mrBliss Closes #1366. Co-authored-by: Thomas Winant <[email protected]>
Closes #1366.