polkadot-parachain simplifications and deduplications#4916
polkadot-parachain simplifications and deduplications#4916serban300 merged 14 commits intoparitytech:masterfrom serban300:polkadot-parachain-refactoring
polkadot-parachain simplifications and deduplications#4916Conversation
polkadot-parachain simplifications and deduplicationspolkadot-parachain simplifications and deduplications
kianenigma
left a comment
There was a problem hiding this comment.
Looks broadly good, would be great to get this in and on top of it build support for manual-seal.
- use traits instead of bounds for `rpc_ext_builder()`, `build_import_queue()`, `start_consensus()` - add a `NodeSpec` trait for defining the specifications of a node - deduplicate the code related to building a node's components / starting a node
skunert
left a comment
There was a problem hiding this comment.
In general the new structure seems reasonable to me.
One use-case I was thinking about during the review is temporary or experimental features. One example is a --experimental-use-slot-based command line flag that will enable a new experimental collator.
Previously I was just adding this flag and based on it choosing the closure to start consensus, here. With the model proposed here stuff like this gets a bit harder, I would need to implement StartConsensus and a new NodeSpec that uses it.
One reasonable addition would be to have some struct like extra_args (name is shitty 😬 ) that gets added to the parameters of the associated types.
| /// A type representing all RPC extensions. | ||
| pub type RpcExtension = jsonrpsee::RpcModule<()>; | ||
|
|
||
| pub trait BuildRpcExtensions<Client, Backend, Pool> { |
There was a problem hiding this comment.
IMO we can move the impls of this trait to this module too. The impls of this trait mostly do nothing and just call the methods of this module. And instantiate the FullDeps struct which I think we can get rid of.
There was a problem hiding this comment.
Yes, looks better. And service.rs is pretty big anyway, so it helps to move some of the logic. Done.
bkchr
left a comment
There was a problem hiding this comment.
Generally the idea of getting rid off the macros is a good idea. However, I think we can simplify stuff even more.
Yes, sounds good. The |
|
@kianenigma @skunert @bkchr thanks for the reviews ! I addressed all your comments. Can you please take another look when you have time ? |
| _backend: Arc<ParachainBackend>, | ||
| _pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi>>>, | ||
| ) -> sc_service::error::Result<RpcExtension> { | ||
| Ok(RpcExtension::new(())) |
There was a problem hiding this comment.
Is this useful in any code path? I can't imagine it being used, although I have not fully looked at the PR.
There was a problem hiding this comment.
Yes, it's used for the shell runtime. Although I don't know. Maybe we could use the BuildParachainRpcExtensions there as well ?
There was a problem hiding this comment.
Nah I think the Shell doesn't have all the runtime apis that are needed. So it makes sense to have this for now. Later on, I hope we can get rid of shell in general :)
btw about RPCs and runtime apis, Bryan and I recently wrote: https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/custom_runtime_api_rpc/index.html
| cmd.run(partial.client) | ||
| } | ||
|
|
||
| #[cfg(any(feature = "runtime-benchmarks"))] |
There was a problem hiding this comment.
I have raised this in another PR as well, high level my understanding is that we should be able to already remove all traces of benchmarking from normal nodes, not to mention the omni-node. @ggwpez any comments from you, re. how far we are from this?
There was a problem hiding this comment.
@ggwpez , can you take a look on the question above please ?
There was a problem hiding this comment.
I would like to merge this PR since it's pretty verbose and I would like to avoid merge conflicts. I will address this point in a future PR.
kianenigma
left a comment
There was a problem hiding this comment.
Looks significantly better! Some comments left, but all are thoughts for the future.
Lets try to merge #4097 first and then integrate here. |
@skunert Done. I integrated #4097 into this PR. PTAL ! For the |
Please make it a struct from the beginning. In the future that will be much easier to forward there stuff if we have a Also, please use |
skunert
left a comment
There was a problem hiding this comment.
I agree that the extra args should be a struct.
Once that is addressed, good to merge from my side, nice!
Done
Done |
bkchr
left a comment
There was a problem hiding this comment.
One last nitpick. Then we are good to go.
| Runtime::Penpal(_) => | ||
| new_aura_node_spec::<AuraRuntimeApi, AuraId>(extra_args.experimental_use_slot_based), | ||
| Runtime::Shell | Runtime::Seedling => Box::new(ShellNode), | ||
| Runtime::Glutton => Box::new(BasicLookaheadNode), |
There was a problem hiding this comment.
| Runtime::Glutton => Box::new(BasicLookaheadNode), |
|
I see that the following tests are failing:
But doesn't seem related to this PR. They are also failing in all latest PRs (https://github.com/paritytech/polkadot-sdk/pulls) with the same errors: |
The BEEFY errors are not related to your changes here. Generally these tests are quite flaky.. |
) `polkadot-parachain` simplifications and deduplications Details in the commit messages. Just copy-pasting the last commit description since it introduces the biggest changes: ``` Implement a more structured way to define a node spec - use traits instead of bounds for `rpc_ext_builder()`, `build_import_queue()`, `start_consensus()` - add a `NodeSpec` trait for defining the specifications of a node - deduplicate the code related to building a node's components / starting a node ``` The other changes are much smaller, most of them trivial and are isolated in separate commits.
* master: (120 commits) network/tx: Ban peers with tx that fail to decode (#5002) Try State Hook for Bounties (#4563) [statement-distribution] Add metrics for distributed statements in V2 (#4554) added sync command (#4818) Bridges V2 refactoring backport and `pallet_bridge_messages` simplifications (#4935) xcm-executor: Improve logging (#4996) Remove usage of `sp-std` on templates (#5001) fixed cmd bot commenting not working (#5000) Explain usage of `<T: Config>` in FRAME storage + Update parachain pallet template (#4941) Expose metadata-hash feature from polkadot crate (#4886) Add `MAX_INSTRUCTIONS_TO_DECODE` to XCMv2 (#4978) add notices to the implementer's guide docs that changed for elastic scaling (#4983) `polkadot-parachain` simplifications and deduplications (#4916) Update Templates README docs (#4980) allow clear_origin in safe xcm builder (#4777) litep2p/peerstore: Fix bump last updated time (#4971) Make `tracing::log` work in the runtime (#4863) sp-core: Improve docs generated by `generate_feature_enabled_macro` (#4968) [Backport] Version bumps and prdocs reordering from 1.14.0 (#4955) Assets: can_decrease/increase for destroying asset is not successful (#3286) ...
) `polkadot-parachain` simplifications and deduplications Details in the commit messages. Just copy-pasting the last commit description since it introduces the biggest changes: ``` Implement a more structured way to define a node spec - use traits instead of bounds for `rpc_ext_builder()`, `build_import_queue()`, `start_consensus()` - add a `NodeSpec` trait for defining the specifications of a node - deduplicate the code related to building a node's components / starting a node ``` The other changes are much smaller, most of them trivial and are isolated in separate commits.
) `polkadot-parachain` simplifications and deduplications Details in the commit messages. Just copy-pasting the last commit description since it introduces the biggest changes: ``` Implement a more structured way to define a node spec - use traits instead of bounds for `rpc_ext_builder()`, `build_import_queue()`, `start_consensus()` - add a `NodeSpec` trait for defining the specifications of a node - deduplicate the code related to building a node's components / starting a node ``` The other changes are much smaller, most of them trivial and are isolated in separate commits.
polkadot-parachainsimplifications and deduplicationsDetails in the commit messages. Just copy-pasting the last commit description since it introduces the biggest changes:
The other changes are much smaller, most of them trivial and are isolated in separate commits.