The following changes have been backported into v1.0.0
Moves Block
to frame_system
instead of construct_runtime
and removes Header
and BlockNumber
Why is this important?
Following discussions in #14126, this PR streamlines construct_runtime!
by moving Block
, NodeBlock
and UncheckedExtrinsic
out of it. Now construct_runtime!
is cleaner and simpler with the focus being on the pallets that belong to the runtime.
This PR also removes BlockNumber
and Header
from frame_system::Config
and instead uses Block
to retrieve these using the trait HeaderProvider
.
How does this impact the Polkadot builders?
Before this PR:
type Extrinsic = MockUncheckedExtrinsic<Runtime>;
type Block = MockBlock<Runtime>;
frame_support::construct_runtime!(
pub struct Runtime
where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = Extrinsic,
{
System: frame_system,
Currency: pallet,
}
);
With this PR:
frame_support::construct_runtime!(
pub struct Runtime {
System: frame_system,
Currency: pallet_currency,
}
);
impl frame_system::Config for Runtime {
- type Header = Header;
- type BlockNumber = u32;
+ type Block = generic::Block<Header, UncheckedExtrinsic>;
}
You can reference the companions for a more in-depth example.
Cumulus Companion #2790
Polkadot Companion #7431
GenesisBuild<T,I>
deprecated. BuildGenesisConfig
added.
Why is this important?
In accordance with a native-free runtime world, this PR deprecates BuildGenesis<T,I>
in favour of a non-Generic: BuildGenesisConfig
which includes a build
function which can be used to build your genesis storage.
How to use?
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
_config: sp_std::marker::PhantomData<(T,I)>,
_myfield: u32,
}
#[pallet::genesis_build]
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
fn build(&self) {}
}
You can refer to the companion for more concrete examples.
Cumulus companion: #2757
Polkadot companion: #7397
Replace system config Index
for Nonce
Why is this important?
Prior to this PR, we had a notion of Index
and Nonce
to refer to the same thing which made things confusing. This PR, renames Index
to the more appropriate name: Nonce
.
Before:
impl frame_system::Config for Runtime {
...
type Index = u64;
After:
impl frame_system::Config for Runtime {
...
type Nonce = u64;
How does this impact the Polkadot builders?
You will need to make changes in your runtime to rename Index
to Nonce
. You can reference the Cumuls companion as a good example.
Related Issue: #12649
Cumulus Companion: #2740
Polkadot Companion: #7374
Removal of execution strategies
PR: Removal of execution strategies by bkchr · Pull Request #14387 · paritytech/substrate · GitHub
Why is this important?
As we prepare for a “native free runtime world”, this PR is about the removal of the execution strategies.
The following CLI flags are now deprecated:
--execution-syncing
--execution-import-block
--execution-block-construction
--execution-offchain-worker
--execution-other
--execution
All of these CLI args are still present, but the node will print an error if the user passes them. In the future these will be removed.
Changes in the behaviour of the Runtime API
This PR also includes behaviour changes in the runtime api (sp-api
) specifically around execution extensions. Please read the PR for the full details.
Removal of build_offchain_workers
build_offchain_workers
is removed from sc-service
. This was in an effort to make sc-service
less “God-like”. Moving forward, to spawn an the offchain worker, the following code needs to be added to service.rs file:
if enable_offchain_worker {
task_manager.spawn_handle().spawn(
"offchain-workers-runner",
"offchain-work",
sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions {
runtime_api_provider: client.clone(),
keystore: Some(keystore_container.keystore()),
offchain_db: backend.offchain_storage(),
transaction_pool: Some(OffchainTransactionPoolFactory::new(
transaction_pool.clone(),
)),
network_provider: network.clone(),
is_validator: role.is_authority(),
enable_http_requests: true,
custom_extensions: move |_| {
vec![]
},
})
.run(client.clone(), task_manager.spawn_handle())
.boxed(),
);
}
Changes to the GRANDPA and BABE client crates.
The sc-consensus-grandpa
crate now requires the parameter offchain_tx_pool_factory in GrandpaParams. This will be used by grandpa when there is an equivocation report to submit the transaction from the runtime.
The sc-consensus-babe
crate changes the signature of import_queue to receive the dedicated ImportQueueParams. These parameters have named args to make it more obvious what each of them is doing. It also gets the offchain tx pool factory passed which it will use when sending an equivocation report.
Polkadot companion: #7443
Cumulus companion: #2836
Your friendly neighborhood Polkadot Release Analysis team,
@alejandro @ayush.mishra @bruno