-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update Scheduler to have a configurable block provider #7434 #7441
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
Conversation
gui1117
left a comment
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.
Direction is good
substrate/frame/scheduler/src/lib.rs
Outdated
| #[pallet::storage] | ||
| pub type IncompleteSince<T: Config> = StorageValue<_, BlockNumberFor<T>>; | ||
|
|
||
| type BlockNumberProvider: BlockNumberProvider; |
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.
We will need a doc comment that explains this type, and warns that it must not be too much out of sync with the local block number. More precisely between every block the increment of this number should be reasonably small otherwise performance degrades will degrade a lot as it reads one storage per block number.
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.
Thanks, I will add it towards the end of the pr for sure, I will look into it. At this moment, I am not entirely sure of the value that needs to be advised, i will get more insights into it, thanks for the reminder :)
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.
We can suggest people to use the system block number or the relay chain block number (this second option, only if they expect their parachain to execute very regularly).
|
note: this is a part of #6297 |
|
This is where I am stuck atm: What I have tried:
Now this, makes me think I have 2 following options going ahead:
Would like to get some opinion/help here on the options, or if there is any another thing to try Note: things I have tried are just a summary of the rabbit hole,if you do leave a comment here, I can try it out and answer if it works for me or not |
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
The type: <<T as frame_system::Config>::Block as sp_runtime::traits::Block>::Header as sp_runtime::traits::Header>::NumberDoesn't implement: EncodeLike<<<T as pallet::Config>::BlockNumberProvider as sp_runtime::traits::BlockNumberProvider>::BlockNumber>Because: <<T as pallet::Config>::BlockNumberProvider as sp_runtime::traits::BlockNumberProvider>::BlockNumberIs a completely different type. I think you are trying somewhere to put the system block number into storage, but the type expect the configured provided block number. |
|
Looking at the current failure it fails when running:
and other similar. I tried:
|
|
Reverted the last commit, as it did not really solve much, bringing it to attention of @gui1117 @ggwpez #7441 (comment) -> read the comment here |
@seemantaggarwal should be your new block number alias instead
|
|
All GitHub workflows were cancelled due to failure one of the required jobs. |
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
ggwpez
left a comment
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.
LGTM, had to push some fixes since we want to get this into the next release.
| use frame_system::pallet_prelude::BlockNumberFor; | ||
|
|
||
| #[cfg(feature = "try-runtime")] | ||
| use sp_runtime::TryRuntimeError; |
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.
We should probably deprecate the migrations. They would not interact so well with changing the BN provider at the same time and it is a lot of legacy code
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.
Yeah, keeping the old migrations around is an aspiration that we gave up on a while ago
paritytech#7441) Follow up from paritytech#6362 (comment) The goal of this PR is to have the scheduler pallet work on a parachain which does not produce blocks on a regular schedule, thus can use the relay chain as a block provider. Because blocks are not produced regularly, we cannot make the assumption that block number increases monotonically, and thus have new logic to handle multiple spend periods passing between blocks. Requirement: instead of using the hard coded system block number. We add an associated type BlockNumberProvider --------- Signed-off-by: Oliver Tale-Yazdi <[email protected]> Co-authored-by: Oliver Tale-Yazdi <[email protected]>
* NODE-161, deps: update to stable2503 * NODE-161, fix: node: Replace TxPool RPC with Frontier implementation #moonbeam-foundation/moonbeam#3218 * NODE-161, fix: runtime: Fix weight limits in evm tracing runtimes (moonbeam-foundation/moonbeam#3210) * NODE-161, deps: update Cargo * NODE-161, fix: Use DecodeWithMemTracking (paritytech/polkadot-sdk#7360) * NODE-161, feat: runtime: upgrade to EIP-7702 new APIs * NODE-161, Introduce a gas-based Storage limit per tx (polkadot-evm/frontier#1142), Support external account provider (polkadot-evm/frontier#1329) * NODE-161, fix: remove sc_transaction_pool * NODE-161, fix: add missing crates * NODE-161, fix: resolve typo * NODE-161, fix: remove Paramter * NODE-161, feat: Allow whitleisting contract deployer (polkadot-evm/frontier#1629) * NODE-161, feat: Update Treasury to Support Relay Chain Block Number Provider (paritytech/polkadot-sdk#3970) * NODE-161, feat: [Identity] Decouple usernames from identities (paritytech/polkadot-sdk#5554) * NODE-161, feat: Collective: dynamic deposit based on number of proposals (paritytech/polkadot-sdk#3151) * NODE-161, fix: add missing DecodeWithMemTracking * NODE-161, feat: Moves disabling logic into pallet-session (paritytech/polkadot-sdk#7581) * NODE-161, feat: Update Scheduler to have a configurable block provider (paritytech/polkadot-sdk#7441) * NODE-161, chore: add WeightInfo to pallet_transaction_payment * NODE-161, fix: add missing authorization_list * NODE-161, fix: replace to new_bare * NODE-161, fix: add missing DecodeWithMemTracking derive * NODE-161, fix: resolve type mismatch * NODE-161, fix: use system_version (paritytech/polkadot-sdk#4257) * NODE-161, fix: use Cow (paritytech/polkadot-sdk#5693) * NODE-161, feat: Generic slashing side-effects (paritytech/polkadot-sdk#5623) * NODE-161, feat: impl create_inherent (paritytech/polkadot-sdk#3685) * NODE-161, fix: remove generic parameter from on_unbalanceds * NODE-161, fix: update storage_at runtime api * NODE-161, fix: node: Remove network starter that is no longer needed (paritytech/polkadot-sdk#6400) * NODE-161, fix: node: update FullNetworkConfiguration params * NODE-161, fix: node: update TransactionPool * NODE-161, fix: node: substrate-offchain: upgrade hyper to v1 (paritytech/polkadot-sdk#5919) * NODE-161, fix: node: update service, rpc * NODE-161, chore: remove unused imports * chore: add cargo feature "metadata-hash" * NODE-161, fix: add cumulus primitives storage proof size HostFunctions * NODE-161, chore: update dependencies branch * NODE-161, chore: update to stable2506 * NODE-161, chore: remove `RuntimeEvent` from pallet::Config * NODE-161, fix: update test code * NODE-161, fix: make node-lts compatible * NODE-161, chore: update `test_btc_registration_pool.ts` * NODE-161, chore: update `test_btc_registration_pool.ts` * NODE-161, chore: update `test_btc_registration_pool.ts` * NODE-161, fix: use node.kill() * NODE-161, fix: resolve test codes * NODE-161, fix: remove console.log * NODE-161, chore: update tools package.json * feat: init blaze * fix: remove unused crate * import precompile-blaze * NODE-161, chore: add mbm migrator into runtimes * NODE-161, chore: add pallet_session migration * NODE-161, fix: new_full_parts -> new_full_parts_record_import * fix: resolve issues * NODE-161, deps: update runtime version (489) --------- Co-authored-by: dnjscksdn98 <[email protected]>
* Node 161 pectra update (#126) * NODE-161, deps: update to stable2503 * NODE-161, fix: node: Replace TxPool RPC with Frontier implementation #moonbeam-foundation/moonbeam#3218 * NODE-161, fix: runtime: Fix weight limits in evm tracing runtimes (moonbeam-foundation/moonbeam#3210) * NODE-161, deps: update Cargo * NODE-161, fix: Use DecodeWithMemTracking (paritytech/polkadot-sdk#7360) * NODE-161, feat: runtime: upgrade to EIP-7702 new APIs * NODE-161, Introduce a gas-based Storage limit per tx (polkadot-evm/frontier#1142), Support external account provider (polkadot-evm/frontier#1329) * NODE-161, fix: remove sc_transaction_pool * NODE-161, fix: add missing crates * NODE-161, fix: resolve typo * NODE-161, fix: remove Paramter * NODE-161, feat: Allow whitleisting contract deployer (polkadot-evm/frontier#1629) * NODE-161, feat: Update Treasury to Support Relay Chain Block Number Provider (paritytech/polkadot-sdk#3970) * NODE-161, feat: [Identity] Decouple usernames from identities (paritytech/polkadot-sdk#5554) * NODE-161, feat: Collective: dynamic deposit based on number of proposals (paritytech/polkadot-sdk#3151) * NODE-161, fix: add missing DecodeWithMemTracking * NODE-161, feat: Moves disabling logic into pallet-session (paritytech/polkadot-sdk#7581) * NODE-161, feat: Update Scheduler to have a configurable block provider (paritytech/polkadot-sdk#7441) * NODE-161, chore: add WeightInfo to pallet_transaction_payment * NODE-161, fix: add missing authorization_list * NODE-161, fix: replace to new_bare * NODE-161, fix: add missing DecodeWithMemTracking derive * NODE-161, fix: resolve type mismatch * NODE-161, fix: use system_version (paritytech/polkadot-sdk#4257) * NODE-161, fix: use Cow (paritytech/polkadot-sdk#5693) * NODE-161, feat: Generic slashing side-effects (paritytech/polkadot-sdk#5623) * NODE-161, feat: impl create_inherent (paritytech/polkadot-sdk#3685) * NODE-161, fix: remove generic parameter from on_unbalanceds * NODE-161, fix: update storage_at runtime api * NODE-161, fix: node: Remove network starter that is no longer needed (paritytech/polkadot-sdk#6400) * NODE-161, fix: node: update FullNetworkConfiguration params * NODE-161, fix: node: update TransactionPool * NODE-161, fix: node: substrate-offchain: upgrade hyper to v1 (paritytech/polkadot-sdk#5919) * NODE-161, fix: node: update service, rpc * NODE-161, chore: remove unused imports * chore: add cargo feature "metadata-hash" * NODE-161, fix: add cumulus primitives storage proof size HostFunctions * NODE-161, chore: update dependencies branch * NODE-161, chore: update to stable2506 * NODE-161, chore: remove `RuntimeEvent` from pallet::Config * NODE-161, fix: update test code * NODE-161, fix: make node-lts compatible * NODE-161, chore: update `test_btc_registration_pool.ts` * NODE-161, chore: update `test_btc_registration_pool.ts` * NODE-161, chore: update `test_btc_registration_pool.ts` * NODE-161, fix: use node.kill() * NODE-161, fix: resolve test codes * NODE-161, fix: remove console.log * NODE-161, chore: update tools package.json * feat: init blaze * fix: remove unused crate * import precompile-blaze * NODE-161, chore: add mbm migrator into runtimes * NODE-161, chore: add pallet_session migration * NODE-161, fix: new_full_parts -> new_full_parts_record_import * fix: resolve issues * NODE-161, deps: update runtime version (489) --------- Co-authored-by: dnjscksdn98 <[email protected]> * NODE-80 branch restructure (#127) * NODE-179, feat: init pallet storages * NODE-179, feat: init pallet extrinsics * NODE-179, chore: add locktime * NODE-179, feat: finalize fee rate * NODE-179, feature: impl coin selections * NODE-179, feat: check blaze activation state * NODE-179, feature: impl `remove_outbound_messages` for legacy mode * NODE-80: implement benchmarking (#121) * NODE-80, feature: impl benchmarking.rs & mock.rs * NODE-80, fix: benchmark * NODE-80, fix: benchmark * NODE-80, chore: update weights * fix: zero out proof size in weights * chore: resolve --------- Co-authored-by: dnjscksdn98 <[email protected]> * fix: correctly use mocha with tsx (#133) --------- Co-authored-by: dnjscksdn98 <[email protected]>
* Node 161 pectra update (#126) * NODE-161, deps: update to stable2503 * NODE-161, fix: node: Replace TxPool RPC with Frontier implementation #moonbeam-foundation/moonbeam#3218 * NODE-161, fix: runtime: Fix weight limits in evm tracing runtimes (moonbeam-foundation/moonbeam#3210) * NODE-161, deps: update Cargo * NODE-161, fix: Use DecodeWithMemTracking (paritytech/polkadot-sdk#7360) * NODE-161, feat: runtime: upgrade to EIP-7702 new APIs * NODE-161, Introduce a gas-based Storage limit per tx (polkadot-evm/frontier#1142), Support external account provider (polkadot-evm/frontier#1329) * NODE-161, fix: remove sc_transaction_pool * NODE-161, fix: add missing crates * NODE-161, fix: resolve typo * NODE-161, fix: remove Paramter * NODE-161, feat: Allow whitleisting contract deployer (polkadot-evm/frontier#1629) * NODE-161, feat: Update Treasury to Support Relay Chain Block Number Provider (paritytech/polkadot-sdk#3970) * NODE-161, feat: [Identity] Decouple usernames from identities (paritytech/polkadot-sdk#5554) * NODE-161, feat: Collective: dynamic deposit based on number of proposals (paritytech/polkadot-sdk#3151) * NODE-161, fix: add missing DecodeWithMemTracking * NODE-161, feat: Moves disabling logic into pallet-session (paritytech/polkadot-sdk#7581) * NODE-161, feat: Update Scheduler to have a configurable block provider (paritytech/polkadot-sdk#7441) * NODE-161, chore: add WeightInfo to pallet_transaction_payment * NODE-161, fix: add missing authorization_list * NODE-161, fix: replace to new_bare * NODE-161, fix: add missing DecodeWithMemTracking derive * NODE-161, fix: resolve type mismatch * NODE-161, fix: use system_version (paritytech/polkadot-sdk#4257) * NODE-161, fix: use Cow (paritytech/polkadot-sdk#5693) * NODE-161, feat: Generic slashing side-effects (paritytech/polkadot-sdk#5623) * NODE-161, feat: impl create_inherent (paritytech/polkadot-sdk#3685) * NODE-161, fix: remove generic parameter from on_unbalanceds * NODE-161, fix: update storage_at runtime api * NODE-161, fix: node: Remove network starter that is no longer needed (paritytech/polkadot-sdk#6400) * NODE-161, fix: node: update FullNetworkConfiguration params * NODE-161, fix: node: update TransactionPool * NODE-161, fix: node: substrate-offchain: upgrade hyper to v1 (paritytech/polkadot-sdk#5919) * NODE-161, fix: node: update service, rpc * NODE-161, chore: remove unused imports * chore: add cargo feature "metadata-hash" * NODE-161, fix: add cumulus primitives storage proof size HostFunctions * NODE-161, chore: update dependencies branch * NODE-161, chore: update to stable2506 * NODE-161, chore: remove `RuntimeEvent` from pallet::Config * NODE-161, fix: update test code * NODE-161, fix: make node-lts compatible * NODE-161, chore: update `test_btc_registration_pool.ts` * NODE-161, chore: update `test_btc_registration_pool.ts` * NODE-161, chore: update `test_btc_registration_pool.ts` * NODE-161, fix: use node.kill() * NODE-161, fix: resolve test codes * NODE-161, fix: remove console.log * NODE-161, chore: update tools package.json * feat: init blaze * fix: remove unused crate * import precompile-blaze * NODE-161, chore: add mbm migrator into runtimes * NODE-161, chore: add pallet_session migration * NODE-161, fix: new_full_parts -> new_full_parts_record_import * fix: resolve issues * NODE-161, deps: update runtime version (489) --------- Co-authored-by: dnjscksdn98 <[email protected]> * NODE-80 branch restructure (#127) * NODE-179, feat: init pallet storages * NODE-179, feat: init pallet extrinsics * NODE-179, chore: add locktime * NODE-179, feat: finalize fee rate * NODE-179, feature: impl coin selections * NODE-179, feat: check blaze activation state * NODE-179, feature: impl `remove_outbound_messages` for legacy mode * NODE-80: implement benchmarking (#121) * NODE-80, feature: impl benchmarking.rs & mock.rs * NODE-80, fix: benchmark * NODE-80, fix: benchmark * NODE-80, chore: update weights * fix: zero out proof size in weights * chore: resolve --------- Co-authored-by: dnjscksdn98 <[email protected]> * fix: correctly use mocha with tsx (#133) * chore: version (#134) --------- Co-authored-by: dnjscksdn98 <[email protected]>
Follow up from #6362 (comment)
The goal of this PR is to have the scheduler pallet work on a parachain which does not produce blocks on a regular schedule, thus can use the relay chain as a block provider.
Because blocks are not produced regularly, we cannot make the assumption that block number increases monotonically, and thus have new logic to handle multiple spend periods passing between blocks.
Requirement:
instead of using the hard coded system block number. We add an associated type BlockNumberProvider