Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b603f2c
doc
gui1117 Feb 18, 2025
28e0ab3
Merge branch 'master' into gui-improve-doc
gui1117 Feb 18, 2025
e3de76b
Introduce CreateBare and deprecate CreateInherent
gui1117 Feb 19, 2025
2068d7e
Update from gui1117 running command 'prdoc --audience runtime_dev --m…
github-actions[bot] Feb 19, 2025
1565a6a
Update prdoc/pr_7597.prdoc
gui1117 Feb 19, 2025
84a9e90
prdoc
gui1117 Feb 19, 2025
2e14572
Merge branch 'master' into gui-improve-doc
gui1117 Feb 19, 2025
be4e019
Update from gui1117 running command 'fmt'
github-actions[bot] Feb 19, 2025
1a51d59
WIP: automatic create bare implementation
gui1117 Feb 24, 2025
41e0a39
CreatBare usage: non-breaking as possible
gui1117 Feb 24, 2025
2b61876
prdoc + doc
gui1117 Feb 24, 2025
d804858
Update from gui1117 running command 'fmt'
github-actions[bot] Feb 24, 2025
1aa50c0
Merge branch 'master' into gui-improve-doc
gui1117 Feb 24, 2025
9274b16
deprecated create inherent and use create bare
gui1117 Mar 3, 2025
1512357
simply rename trait + new method create_bare + deprecate create_inherent
gui1117 Mar 3, 2025
412b80d
remove warning
gui1117 Mar 3, 2025
ee3836f
missed one
gui1117 Mar 3, 2025
a1afad7
missed some
gui1117 Mar 3, 2025
3f7dbe1
Update from gui1117 running command 'update-ui'
github-actions[bot] Mar 3, 2025
d9da435
revert some change I forgot
gui1117 May 5, 2025
7794fbd
Merge remote-tracking branch 'origin/master' into gui-improve-doc
gui1117 May 5, 2025
f98da0f
better doc
gui1117 May 5, 2025
59b532a
fix merge
gui1117 May 5, 2025
e29ec07
Merge remote-tracking branch 'origin/master' into gui-improve-doc
gui1117 May 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions polkadot/runtime/common/src/assigned_slots/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,11 +676,11 @@ mod tests {
type RuntimeCall = RuntimeCall;
}

impl<C> frame_system::offchain::CreateInherent<C> for Test
impl<C> frame_system::offchain::CreateBare<C> for Test
where
RuntimeCall: From<C>,
{
fn create_inherent(call: Self::RuntimeCall) -> Self::Extrinsic {
fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic {
UncheckedExtrinsic::new_bare(call)
}
}
Expand Down
4 changes: 2 additions & 2 deletions polkadot/runtime/common/src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ where
type RuntimeCall = RuntimeCall;
}

impl<C> frame_system::offchain::CreateInherent<C> for Test
impl<C> frame_system::offchain::CreateBare<C> for Test
where
RuntimeCall: From<C>,
{
fn create_inherent(call: Self::RuntimeCall) -> Self::Extrinsic {
fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic {
UncheckedExtrinsic::new_bare(call)
}
}
Expand Down
4 changes: 2 additions & 2 deletions polkadot/runtime/common/src/paras_registrar/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ where
type RuntimeCall = RuntimeCall;
}

impl<C> frame_system::offchain::CreateInherent<C> for Test
impl<C> frame_system::offchain::CreateBare<C> for Test
where
RuntimeCall: From<C>,
{
fn create_inherent(call: Self::RuntimeCall) -> Self::Extrinsic {
fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic {
UncheckedExtrinsic::new_bare(call)
}
}
Expand Down
6 changes: 3 additions & 3 deletions polkadot/runtime/parachains/src/disputes/slashing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ impl<I, R, L> Default for SlashingReportHandler<I, R, L> {

impl<T, R, L> HandleReports<T> for SlashingReportHandler<T::KeyOwnerIdentification, R, L>
where
T: Config + frame_system::offchain::CreateInherent<Call<T>>,
T: Config + frame_system::offchain::CreateBare<Call<T>>,
R: ReportOffence<
T::AccountId,
T::KeyOwnerIdentification,
Expand Down Expand Up @@ -685,7 +685,7 @@ where
dispute_proof: DisputeProof,
key_owner_proof: <T as Config>::KeyOwnerProof,
) -> Result<(), sp_runtime::TryRuntimeError> {
use frame_system::offchain::{CreateInherent, SubmitTransaction};
use frame_system::offchain::{CreateBare, SubmitTransaction};

let session_index = dispute_proof.time_slot.session_index;
let validator_index = dispute_proof.validator_index.0;
Expand All @@ -696,7 +696,7 @@ where
key_owner_proof,
};

let xt = <T as CreateInherent<Call<T>>>::create_inherent(call.into());
let xt = <T as CreateBare<Call<T>>>::create_bare(call.into());
match SubmitTransaction::<T, Call<T>>::submit_transaction(xt) {
Ok(()) => {
log::info!(
Expand Down
4 changes: 2 additions & 2 deletions polkadot/runtime/parachains/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ where
type RuntimeCall = RuntimeCall;
}

impl<C> frame_system::offchain::CreateInherent<C> for Test
impl<C> frame_system::offchain::CreateBare<C> for Test
where
RuntimeCall: From<C>,
{
fn create_inherent(call: Self::RuntimeCall) -> Self::Extrinsic {
fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic {
UncheckedExtrinsic::new_bare(call)
}
}
Expand Down
4 changes: 2 additions & 2 deletions polkadot/runtime/parachains/src/paras/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ pub mod pallet {
frame_system::Config
+ configuration::Config
+ shared::Config
+ frame_system::offchain::CreateInherent<Call<Self>>
+ frame_system::offchain::CreateBare<Call<Self>>
{
#[allow(deprecated)]
type RuntimeEvent: From<Event> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
Expand Down Expand Up @@ -2279,7 +2279,7 @@ impl<T: Config> Pallet<T> {
) {
use frame_system::offchain::SubmitTransaction;

let xt = T::create_inherent(Call::include_pvf_check_statement { stmt, signature }.into());
let xt = T::create_bare(Call::include_pvf_check_statement { stmt, signature }.into());
if let Err(e) = SubmitTransaction::<T, Call<T>>::submit_transaction(xt) {
log::error!(target: LOG_TARGET, "Error submitting pvf check statement: {:?}", e,);
}
Expand Down
4 changes: 2 additions & 2 deletions polkadot/runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,11 +707,11 @@ where
}
}

impl<LocalCall> frame_system::offchain::CreateInherent<LocalCall> for Runtime
impl<LocalCall> frame_system::offchain::CreateBare<LocalCall> for Runtime
where
RuntimeCall: From<LocalCall>,
{
fn create_inherent(call: RuntimeCall) -> UncheckedExtrinsic {
fn create_bare(call: RuntimeCall) -> UncheckedExtrinsic {
UncheckedExtrinsic::new_bare(call)
}
}
Expand Down
4 changes: 2 additions & 2 deletions polkadot/runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ where
type Extrinsic = UncheckedExtrinsic;
}

impl<C> frame_system::offchain::CreateInherent<C> for Runtime
impl<C> frame_system::offchain::CreateBare<C> for Runtime
where
RuntimeCall: From<C>,
{
fn create_inherent(call: Self::RuntimeCall) -> Self::Extrinsic {
fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic {
UncheckedExtrinsic::new_bare(call)
}
}
Expand Down
4 changes: 2 additions & 2 deletions polkadot/runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,11 +1065,11 @@ where
}
}

impl<LocalCall> frame_system::offchain::CreateInherent<LocalCall> for Runtime
impl<LocalCall> frame_system::offchain::CreateBare<LocalCall> for Runtime
where
RuntimeCall: From<LocalCall>,
{
fn create_inherent(call: RuntimeCall) -> UncheckedExtrinsic {
fn create_bare(call: RuntimeCall) -> UncheckedExtrinsic {
UncheckedExtrinsic::new_bare(call)
}
}
Expand Down
40 changes: 40 additions & 0 deletions prdoc/pr_7597.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
title: 'Introduce CreateBare, deprecated CreateInherent'
doc:
- audience: Runtime Dev
description: |
Rename `CreateInherent` to `CreateBare`, add method `create_bare` and deprecate `create_inherent`.

Both unsigned transaction and inherent use the extrinsic type `Bare`.
Before this PR `CreateInherent` trait was use to generate unsigned transaction, now unsigned transaction can be generated using a proper trait `CreateBare`.

How to upgrade:
* Change usage of `CreateInherent` to `CreateBare` and `create_inherent` to `create_bare`.
* Implement `CreateBare` for the runtime, the method `create_bare` is usually implemented using `Extrinsic::new_bare`.

crates:
- name: frame-system
bump: major
- name: polkadot-runtime-common
bump: major
- name: polkadot-runtime-parachains
bump: major
- name: rococo-runtime
bump: major
- name: westend-runtime
bump: major
- name: pallet-babe
bump: major
- name: pallet-beefy
bump: major
- name: pallet-election-provider-multi-block
bump: major
- name: pallet-election-provider-multi-phase
bump: major
- name: pallet-grandpa
bump: major
- name: pallet-im-online
bump: major
- name: pallet-mixnet
bump: major
- name: pallet-offences-benchmarking
bump: major
4 changes: 2 additions & 2 deletions substrate/bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1571,11 +1571,11 @@ where
}
}

impl<LocalCall> frame_system::offchain::CreateInherent<LocalCall> for Runtime
impl<LocalCall> frame_system::offchain::CreateBare<LocalCall> for Runtime
where
RuntimeCall: From<LocalCall>,
{
fn create_inherent(call: RuntimeCall) -> UncheckedExtrinsic {
fn create_bare(call: RuntimeCall) -> UncheckedExtrinsic {
generic::UncheckedExtrinsic::new_bare(call).into()
}
}
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/babe/src/equivocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl<T, R, P, L>
OffenceReportSystem<Option<T::AccountId>, (EquivocationProof<HeaderFor<T>>, T::KeyOwnerProof)>
for EquivocationReportSystem<T, R, P, L>
where
T: Config + pallet_authorship::Config + frame_system::offchain::CreateInherent<Call<T>>,
T: Config + pallet_authorship::Config + frame_system::offchain::CreateBare<Call<T>>,
R: ReportOffence<
T::AccountId,
P::IdentificationTuple,
Expand All @@ -132,7 +132,7 @@ where
equivocation_proof: Box::new(equivocation_proof),
key_owner_proof,
};
let xt = T::create_inherent(call.into());
let xt = T::create_bare(call.into());
let res = SubmitTransaction::<T, Call<T>>::submit_transaction(xt);
match res {
Ok(_) => info!(target: LOG_TARGET, "Submitted equivocation report"),
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/babe/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ where
type Extrinsic = TestXt<RuntimeCall, ()>;
}

impl<C> frame_system::offchain::CreateInherent<C> for Test
impl<C> frame_system::offchain::CreateBare<C> for Test
where
RuntimeCall: From<C>,
{
fn create_inherent(call: Self::RuntimeCall) -> Self::Extrinsic {
fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic {
TestXt::new_bare(call)
}
}
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/beefy/src/equivocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl<T: Config> EquivocationEvidenceFor<T> {
impl<T, R, P, L> OffenceReportSystem<Option<T::AccountId>, EquivocationEvidenceFor<T>>
for EquivocationReportSystem<T, R, P, L>
where
T: Config + pallet_authorship::Config + frame_system::offchain::CreateInherent<Call<T>>,
T: Config + pallet_authorship::Config + frame_system::offchain::CreateBare<Call<T>>,
R: ReportOffence<
T::AccountId,
P::IdentificationTuple,
Expand All @@ -298,7 +298,7 @@ where
use frame_system::offchain::SubmitTransaction;

let call: Call<T> = evidence.into();
let xt = T::create_inherent(call.into());
let xt = T::create_bare(call.into());
let res = SubmitTransaction::<T, Call<T>>::submit_transaction(xt);
match res {
Ok(_) => info!(target: LOG_TARGET, "Submitted equivocation report."),
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/beefy/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ where
type Extrinsic = TestXt<RuntimeCall, ()>;
}

impl<C> frame_system::offchain::CreateInherent<C> for Test
impl<C> frame_system::offchain::CreateBare<C> for Test
where
RuntimeCall: From<C>,
{
fn create_inherent(call: Self::RuntimeCall) -> Self::Extrinsic {
fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic {
TestXt::new_bare(call)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,11 @@ where
type Extrinsic = Extrinsic;
}

impl<LocalCall> frame_system::offchain::CreateInherent<LocalCall> for Runtime
impl<LocalCall> frame_system::offchain::CreateBare<LocalCall> for Runtime
where
RuntimeCall: From<LocalCall>,
{
fn create_inherent(call: Self::RuntimeCall) -> Self::Extrinsic {
fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic {
Extrinsic::new_bare(call)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ impl<T: Config> OffchainWorkerMiner<T> {
"unsigned::ocw-miner",
"miner submitting a solution as an unsigned transaction"
);
let xt = T::create_inherent(call.into());
let xt = T::create_bare(call.into());
frame_system::offchain::SubmitTransaction::<T, Call<T>>::submit_transaction(xt)
.map(|_| {
sublog!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ mod pallet {
CommonError,
};
use frame_support::pallet_prelude::*;
use frame_system::{offchain::CreateInherent, pallet_prelude::*};
use frame_system::{offchain::CreateBare, pallet_prelude::*};
use sp_runtime::traits::SaturatedConversion;
use sp_std::prelude::*;

Expand All @@ -104,7 +104,7 @@ mod pallet {

#[pallet::config]
#[pallet::disable_frame_system_supertrait_check]
pub trait Config: crate::Config + CreateInherent<Call<Self>> {
pub trait Config: crate::Config + CreateBare<Call<Self>> {
/// The repeat threshold of the offchain worker.
///
/// For example, if it is 5, that means that at least 5 blocks will elapse between attempts
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/election-provider-multi-phase/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ use frame_support::{
weights::Weight,
DefaultNoBound, EqNoBound, PartialEqNoBound,
};
use frame_system::{ensure_none, offchain::CreateInherent, pallet_prelude::BlockNumberFor};
use frame_system::{ensure_none, offchain::CreateBare, pallet_prelude::BlockNumberFor};
use scale_info::TypeInfo;
use sp_arithmetic::{
traits::{CheckedAdd, Zero},
Expand Down Expand Up @@ -615,7 +615,7 @@ pub mod pallet {
use sp_runtime::traits::Convert;

#[pallet::config]
pub trait Config: frame_system::Config + CreateInherent<Call<Self>> {
pub trait Config: frame_system::Config + CreateBare<Call<Self>> {
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/election-provider-multi-phase/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,11 @@ where
type Extrinsic = Extrinsic;
}

impl<LocalCall> frame_system::offchain::CreateInherent<LocalCall> for Runtime
impl<LocalCall> frame_system::offchain::CreateBare<LocalCall> for Runtime
where
RuntimeCall: From<LocalCall>,
{
fn create_inherent(call: Self::RuntimeCall) -> Self::Extrinsic {
fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic {
Extrinsic::new_bare(call)
}
}
Expand Down
6 changes: 3 additions & 3 deletions substrate/frame/election-provider-multi-phase/src/unsigned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use frame_support::{
BoundedVec,
};
use frame_system::{
offchain::{CreateInherent, SubmitTransaction},
offchain::{CreateBare, SubmitTransaction},
pallet_prelude::BlockNumberFor,
};
use scale_info::TypeInfo;
Expand Down Expand Up @@ -192,7 +192,7 @@ fn ocw_solution_exists<T: Config>() -> bool {
matches!(StorageValueRef::persistent(OFFCHAIN_CACHED_CALL).get::<Call<T>>(), Ok(Some(_)))
}

impl<T: Config + CreateInherent<Call<T>>> Pallet<T> {
impl<T: Config + CreateBare<Call<T>>> Pallet<T> {
/// Mine a new npos solution.
///
/// The Npos Solver type, `S`, must have the same AccountId and Error type as the
Expand Down Expand Up @@ -292,7 +292,7 @@ impl<T: Config + CreateInherent<Call<T>>> Pallet<T> {
fn submit_call(call: Call<T>) -> Result<(), MinerError> {
log!(debug, "miner submitting a solution as an unsigned transaction");

let xt = T::create_inherent(call.into());
let xt = T::create_bare(call.into());
SubmitTransaction::<T, Call<T>>::submit_transaction(xt)
.map_err(|_| MinerError::PoolSubmissionFailed)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,11 @@ where
type Extrinsic = Extrinsic;
}

impl<LocalCall> frame_system::offchain::CreateInherent<LocalCall> for Runtime
impl<LocalCall> frame_system::offchain::CreateBare<LocalCall> for Runtime
where
RuntimeCall: From<LocalCall>,
{
fn create_inherent(call: Self::RuntimeCall) -> Self::Extrinsic {
fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic {
Extrinsic::new_bare(call)
}
}
Expand Down
Loading
Loading