Skip to content

Commit e50b1c2

Browse files
committed
NODE-161, feat: impl create_inherent (paritytech/polkadot-sdk#3685)
1 parent f7233d6 commit e50b1c2

File tree

3 files changed

+36
-9
lines changed

3 files changed

+36
-9
lines changed

runtime/dev/src/lib.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ pub type Precompiles = BifrostPrecompiles<Runtime>;
9797
/// Block type as expected by this runtime.
9898
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
9999

100-
/// The SignedExtension to the basic transaction logic.
101-
pub type SignedExtra = (
100+
/// The extension to the basic transaction logic.
101+
pub type TxExtension = (
102102
frame_system::CheckNonZeroSender<Runtime>,
103103
frame_system::CheckSpecVersion<Runtime>,
104104
frame_system::CheckTxVersion<Runtime>,
@@ -111,7 +111,7 @@ pub type SignedExtra = (
111111

112112
/// Unchecked extrinsic type as expected by this runtime.
113113
pub type UncheckedExtrinsic =
114-
fp_self_contained::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
114+
fp_self_contained::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
115115

116116
/// All migrations executed on runtime upgrade as a nested tuple of types implementing `OnRuntimeUpgrade`.
117117
type Migrations = ();
@@ -755,6 +755,15 @@ parameter_types! {
755755
pub const DefaultSlashFraction: Perbill = Perbill::from_parts(5_000_000); // 0.5%
756756
}
757757

758+
impl<LocalCall> frame_system::offchain::CreateInherent<LocalCall> for Runtime
759+
where
760+
RuntimeCall: From<LocalCall>,
761+
{
762+
fn create_inherent(call: RuntimeCall) -> UncheckedExtrinsic {
763+
UncheckedExtrinsic::new_bare(call)
764+
}
765+
}
766+
758767
impl<C> frame_system::offchain::CreateTransactionBase<C> for Runtime
759768
where
760769
RuntimeCall: From<C>,

runtime/mainnet/src/lib.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ pub type Precompiles = BifrostPrecompiles<Runtime>;
9797
/// Block type as expected by this runtime.
9898
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
9999

100-
/// The SignedExtension to the basic transaction logic.
101-
pub type SignedExtra = (
100+
/// The extension to the basic transaction logic.
101+
pub type TxExtension = (
102102
frame_system::CheckNonZeroSender<Runtime>,
103103
frame_system::CheckSpecVersion<Runtime>,
104104
frame_system::CheckTxVersion<Runtime>,
@@ -111,7 +111,7 @@ pub type SignedExtra = (
111111

112112
/// Unchecked extrinsic type as expected by this runtime.
113113
pub type UncheckedExtrinsic =
114-
fp_self_contained::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
114+
fp_self_contained::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
115115

116116
/// Executive: handles dispatch to the various modules.
117117
pub type Executive = frame_executive::Executive<
@@ -436,6 +436,15 @@ parameter_types! {
436436
pub const DefaultSlashFraction: Perbill = Perbill::from_parts(1000000);
437437
}
438438

439+
impl<LocalCall> frame_system::offchain::CreateInherent<LocalCall> for Runtime
440+
where
441+
RuntimeCall: From<LocalCall>,
442+
{
443+
fn create_inherent(call: RuntimeCall) -> UncheckedExtrinsic {
444+
UncheckedExtrinsic::new_bare(call)
445+
}
446+
}
447+
439448
impl<C> frame_system::offchain::CreateTransactionBase<C> for Runtime
440449
where
441450
RuntimeCall: From<C>,

runtime/testnet/src/lib.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ pub type Precompiles = BifrostPrecompiles<Runtime>;
9797
/// Block type as expected by this runtime.
9898
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
9999

100-
/// The SignedExtension to the basic transaction logic.
101-
pub type SignedExtra = (
100+
/// The extension to the basic transaction logic.
101+
pub type TxExtension = (
102102
frame_system::CheckNonZeroSender<Runtime>,
103103
frame_system::CheckSpecVersion<Runtime>,
104104
frame_system::CheckTxVersion<Runtime>,
@@ -111,7 +111,7 @@ pub type SignedExtra = (
111111

112112
/// Unchecked extrinsic type as expected by this runtime.
113113
pub type UncheckedExtrinsic =
114-
fp_self_contained::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
114+
fp_self_contained::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
115115

116116
/// All migrations executed on runtime upgrade as a nested tuple of types implementing `OnRuntimeUpgrade`.
117117
type Migrations = ();
@@ -442,6 +442,15 @@ parameter_types! {
442442
pub const DefaultSlashFraction: Perbill = Perbill::from_percent(10);
443443
}
444444

445+
impl<LocalCall> frame_system::offchain::CreateInherent<LocalCall> for Runtime
446+
where
447+
RuntimeCall: From<LocalCall>,
448+
{
449+
fn create_inherent(call: RuntimeCall) -> UncheckedExtrinsic {
450+
UncheckedExtrinsic::new_bare(call)
451+
}
452+
}
453+
445454
impl<C> frame_system::offchain::CreateTransactionBase<C> for Runtime
446455
where
447456
RuntimeCall: From<C>,

0 commit comments

Comments
 (0)