polkadot-omni-node-lib: enable tx storage inherent data provider setup#10494
polkadot-omni-node-lib: enable tx storage inherent data provider setup#10494iulianbarbu wants to merge 15 commits intoparitytech:masterfrom
Conversation
Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
|
/cmd prdoc --audience "Node Dev" |
| if enable_tx_storage_idp { | ||
| let storage_proof = | ||
| sp_transaction_storage_proof::registration::new_data_provider( | ||
| &*client_clone, |
There was a problem hiding this comment.
@iulianbarbu is it possible to call runtime api exposed by the runtime (sp_api::decl_runtime_apis! / sp_api::impl_runtime_apis) at this moment? With client_clone? Would it be expensive? Do we have similar call here around?
Something like:
client.runtime_api().get_storage_period()
runtime.new_instance()?.call("get_storage_period", [])
There was a problem hiding this comment.
Why is the storage period runtime API call relevant? Not sure how expensive it gets from a block building standpoint, it is something we need to measure. But what is this get_storage_period? Can't really find it in the codebase.
There was a problem hiding this comment.
But what is this
get_storage_period? Can't really find it in the codebase.
Yes, you cannot, because it is not implemented yet: paritytech/polkadot-bulletin-chain#60
The problem is that the new_data_provider uses a hard-coded pub const DEFAULT_STORAGE_PERIOD: u32 = 100800;, which forces the runtime to use the same value. This value corresponds to 7 days for 6-second blocks. I want to make this constant configurable and driven by the runtime — exposed via a runtime API. For example, if we switch to 2-second blocks but still want to keep the 7-day period, we won’t need to coordinate and restart the collators with a new hard-coded constant and so on. Basically, I want to have possibility to set this constant with arbitrary value without affecting the collators or anything.
I think new_data_provider is doing already two calls, the client.number and client.block_indexed_body, so it shouldn't be a problem to add another call to get the constant from the runtime. I will try this Monday on the top of this PR, which is looking good so far.
Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Relates to: paritytech/polkadot-bulletin-chain#74 This PR adds the required support and features for running Bulletin as a parachain. It is a top-level PR that merges three partial features/PRs, which can also be reviewed/merged separately: 1. Add `transaction_index::HostFunctions` with NO-OP impl to the cumulus ParachainSystem `validate_block` for polkadot-prepare/execute-worker - #10370 2. Add custom inherent provider for pallet-transaction-storage to omni node - #10494 3. Configurable StoragePeriod feeded to the inherent provider over runtime API - #10656 --------- Signed-off-by: Iulian Barbu <iulian.barbu@parity.io> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Iulian Barbu <iulian.barbu@parity.io> Co-authored-by: Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com> Co-authored-by: EgorPopelyaev <egor@parity.io> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Bastian Köcher <info@kchr.de>
|
@iulianbarbu merged as a part of #10662 |
Relates to: paritytech/polkadot-bulletin-chain#74 This PR adds the required support and features for running Bulletin as a parachain. It is a top-level PR that merges three partial features/PRs, which can also be reviewed/merged separately: 1. Add `transaction_index::HostFunctions` with NO-OP impl to the cumulus ParachainSystem `validate_block` for polkadot-prepare/execute-worker - #10370 2. Add custom inherent provider for pallet-transaction-storage to omni node - #10494 3. Configurable StoragePeriod feeded to the inherent provider over runtime API - #10656 --------- Signed-off-by: Iulian Barbu <iulian.barbu@parity.io> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Iulian Barbu <iulian.barbu@parity.io> Co-authored-by: Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com> Co-authored-by: EgorPopelyaev <egor@parity.io> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Bastian Köcher <info@kchr.de>
Relates to: paritytech/polkadot-bulletin-chain#74 This PR adds the required support and features for running Bulletin as a parachain. It is a top-level PR that merges three partial features/PRs, which can also be reviewed/merged separately: 1. Add `transaction_index::HostFunctions` with NO-OP impl to the cumulus ParachainSystem `validate_block` for polkadot-prepare/execute-worker - #10370 2. Add custom inherent provider for pallet-transaction-storage to omni node - #10494 3. Configurable StoragePeriod feeded to the inherent provider over runtime API - #10656 --------- Signed-off-by: Iulian Barbu <iulian.barbu@parity.io> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Iulian Barbu <iulian.barbu@parity.io> Co-authored-by: Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com> Co-authored-by: EgorPopelyaev <egor@parity.io> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Bastian Köcher <info@kchr.de>
Description
Closes paritytech/polkadot-bulletin-chain#82.
Integration
--enable-tx-storage-idpflag. This is especially useful in the context of bulletin chain.--ipfs-serverflag, again, useful in the context of bulleting chain.Review Notes
Implementation notes
A con of this work is that the current setup exposes bulletin node specific logic in polkadot-omni-node-lib (the
--enable-tx-storage-idpflags, which isn't necessarily useful for every instantiation of polkadot-omni-node-lib). Ideally this logic would be implemented via a generic abstraction.paritytech/polkadot-bulletin-chain#82 covers a few ways of doing it in the comments:
The discussions converged towards exposing the flags through
polkadot-omni-node-lib, used by polkadot-parachain, which will eventually be used to run the bulletin node. It is mostly because it is the simplest implementation that unblocks the testing of bulletin based on polkadot-parachain.Blockers (with any of the implementations)Huh, a very simple fix, I overcomplicate it for a day: aea846e.
the blocker
A blocker of this PR to be actually useful is the following error:
It indicates to an error where if we need the client, for being able to construct an inherent data provider,,the created closure here will be constrained to a
FnOnce, which is incompatible with the type requested by slot based or lookahead collators, which is aFn. The fix for this isn't straight forward based on my trials. I am still trying to figure out a way forward.