Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Conversation

@tomaka
Copy link
Contributor

@tomaka tomaka commented Dec 10, 2019

paritytech/substrate#4284

Changes:

  • RegisteredGossipValidator now implements the NetworkService trait, rather than sc_network::NetworkService.
  • Consequently, AvailabilityNetworkShim and ValidationNetwork now use only a RegisteredGossipValidator rather than sc_network::NetworkService.
  • Added an executor parameter when creating a RegisteredGossipValidator.

@tomaka tomaka added the A0-please_review Pull request needs code review. label Dec 10, 2019
@tomaka tomaka requested review from montekki and rphmeier December 10, 2019 14:10
inner: Arc<MessageValidator<dyn ChainContext>>,
// Note: this is always `Some` in real code and `None` in tests.
service: Option<Arc<PolkadotNetworkService>>,
// Note: this is always `Some` in real code and `None` in tests.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This really isn't great, but I couldn't come up with a better solution.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hide it under a #[cfg(not(test))] flag perhaps?

@tomaka
Copy link
Contributor Author

tomaka commented Dec 10, 2019

I'm having trouble compiling this branch after the last master merge. Would need to wait for Polkadot to be up-to-date with Substrate master to try again. In the meanwhile, I think this branch compiles but I'm not 100% sure.

use futures::prelude::*;
<<<<<<< HEAD
use futures03::{compat::Stream01CompatExt, FutureExt, StreamExt, TryFutureExt};
=======
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably not be here..

service.clone(),
executor,
POLKADOT_ENGINE_ID,
gossip_side
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
gossip_side
gossip_side,

service.clone(),
executor,
POLKADOT_ENGINE_ID,
gossip_side
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
gossip_side
gossip_side,

service.clone(),
executor,
POLKADOT_ENGINE_ID,
gossip_side
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
gossip_side
gossip_side,

service.clone(),
executor,
POLKADOT_ENGINE_ID,
gossip_side
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
gossip_side
gossip_side,

// NOTE: since RegisteredMessageValidator is meant to be a type-safe proof
// that we've actually done the registration, this should be the only way
// to construct it outside of tests.
pub fn register_validator<C: ChainContext + 'static>(
Copy link
Contributor

Choose a reason for hiding this comment

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

This function was always a bit awkward; I'd guess that we'd want to refactor things so that the network crate isn't responsible for instantiating all of these gossip validators. That would fix your "always Some in practice, None in tests" issue from below.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not a blocker for this PR, but probably how we want to do things in the future

@rphmeier
Copy link
Contributor

Closed in favor of #695

@rphmeier rphmeier closed this Dec 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants