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

Enable the LocalStateQuery protocol #1522

Merged
merged 7 commits into from
Apr 15, 2020

Conversation

mrBliss
Copy link
Contributor

@mrBliss mrBliss commented Jan 29, 2020

No description provided.

@mrBliss
Copy link
Contributor Author

mrBliss commented Jan 29, 2020

This includes #1507 until that is merged. This PR is only about the final commit.

The NodeToClientVersion will also need to be bumped.

This should only be merged when we're ready to break "network compatibility".

Copy link
Contributor

@coot coot left a comment

Choose a reason for hiding this comment

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

LGTM - but I only looked under Ouroboros.Network.Protocol.LocalStateQuery. Somebody needs to review the rest.

You'll have a conflict with current master. To resolve it you will need to put Examples,Tests,Direct modules in the private library ouroboros-protocol-tests. If you need to re-use Examples in ouroboros-consensus you can leave it in the public library.

import Ouroboros.Network.Protocol.LocalStateQuery.Type


newtype LocalStateQueryClient block query result m a = LocalStateQueryClient {
Copy link
Contributor

Choose a reason for hiding this comment

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

There's no need for the new type wrapper, but let it be this way. We plan to remove all the top level newtype wrappers from all of the mini-protocols.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I'll leave it there for consistency.

-- It must be prepared to handle either.
--
data ClientStAcquiring block query result m a = ClientStAcquiring {
recvMsgAcquired :: ClientStAcquired block query result m a,
Copy link
Contributor

Choose a reason for hiding this comment

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

could you align the type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Initially, I aligned all state types on their type parameters, even when some had an m (..) around them. Now that I have added so many ms, there's no point in alignment on this line, I'll remove it.

@mrBliss
Copy link
Contributor Author

mrBliss commented Jan 29, 2020

LGTM - but I only looked under Ouroboros.Network.Protocol.LocalStateQuery.

Thanks for giving this a look! BTW, #1507 is the PR that I want to merge now, not this one, which is #1507 + the breaking change that enables it.

Somebody needs to review the rest.

That's what Edsko did in #1507 🙂

You'll have a conflict with current master. To resolve it you will need to put Examples,Tests,Direct modules in the private library ouroboros-protocol-tests. If you need to re-use Examples in ouroboros-consensus you can leave it in the public library.

No, I rebased this morning already. I have moved Tests and Direct to ouroboros-protocol-tests and left Examples in the public library, as I indeed use it in the consensus tests.

mrBliss and others added 3 commits April 14, 2020 10:19
'NodeToClientV_2' version of node-to-client protocol supports
local-state-query mini-protocol.
`maximumMiniProtocolLimits` we are not planning to change
`node-to-client` protocol limits; `node-to-client` protocol is executed
in a trusted environment, so there's no need to introduce tight bounds
for mux ingress queue.
@coot coot force-pushed the mrBliss/enable-local-state-query-protocol branch from 028bb7f to 9ca9de9 Compare April 14, 2020 11:12
@coot coot marked this pull request as ready for review April 14, 2020 11:12
@coot coot requested review from coot and edsko and removed request for coot April 14, 2020 11:13
`Ouroboros.Network.NodeToClient.nodeToClientProtocols` takes now
`NodeToClientVersion` as an argument, which provides the flexibility of
running different set of mini-protocols per `NodeToClientVersion`
version.
Added `ByronNetworkProtocolVersion1_1`.
@coot coot force-pushed the mrBliss/enable-local-state-query-protocol branch from 9ca9de9 to 15d61d0 Compare April 14, 2020 11:43
@coot coot self-requested a review April 14, 2020 12:17
@mrBliss mrBliss linked an issue Apr 14, 2020 that may be closed by this pull request
@edsko
Copy link
Contributor

edsko commented Apr 15, 2020

@karknu , this re-introduces the config parameter for the node-to-client protocols, but it is only a BlockConfig, not a TopLevelConfig. For Byron, that is the Byron genesis config, which the wallet should have access to. See the comment for motivation:

-- We pass the 'BlockConfig' here, even though it is currently unused. If at any
-- point we want to introduce local protocols that for example send Byron blocks
-- or headers across, we will need to have the epoch size, which comes from the
-- Byron config. Unlike the full 'TopLevelConfig', it should not be difficult
-- for a wallet to construct the 'BlockConfig'.
--
-- NOTE: Somewhat confusingly, 'pcChainSyncCodec' currently /does/ send Byron
-- blocks across, but it does not deserialize them (the user of the codec is
-- itself responsible for doing that), which is why it currently does not need
-- the config.

Following Karl's suggestion: we set 16ths bit to distinguish
`NodeToClient` and `NodeToNode` protocols.

This patch includes a round trip tests for `Serialise` class of
`NodeToClientVersion` and `NodeToNodeVersion`, including cross failure
tests which checks that we cannot deserialise `NodeToClientVersion` as
`NodeToNodeVersion` (and vice versa).
@coot coot requested a review from karknu April 15, 2020 09:48
Copy link
Contributor

@karknu karknu left a comment

Choose a reason for hiding this comment

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

LGTM!

, testGroup "NodeToNodeVersion"
[ testCase "NodeToNodeVersion round-trip codec property"
(roundTripPropAll (Proxy :: Proxy NodeToNodeVersion))
-- TODO: enable this test when `NodeToClientV_1` is removed:
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@coot
Copy link
Contributor

coot commented Apr 15, 2020

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Apr 15, 2020

@iohk-bors iohk-bors bot merged commit 1b2a824 into master Apr 15, 2020
@iohk-bors iohk-bors bot deleted the mrBliss/enable-local-state-query-protocol branch April 15, 2020 10:27
@mrBliss mrBliss mentioned this pull request Apr 15, 2020
@coot coot changed the title Enable the LocalStateQuery protocol, breaking network compatibility Enable the LocalStateQuery protocol Apr 16, 2020
@coot coot added the node-to-client Issues & PRs related to node-to-client protocols label Apr 18, 2020
coot added a commit that referenced this pull request May 16, 2022
1522: Enable the LocalStateQuery protocol, breaking network compatibility r=coot a=mrBliss



Co-authored-by: Thomas Winant <thomas@well-typed.com>
Co-authored-by: Marcin Szamotulski <profunctor@pm.me>
Co-authored-by: Edsko de Vries <edsko@well-typed.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node-to-client Issues & PRs related to node-to-client protocols
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable local query node-to-client mini-protocol
4 participants