mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 19:51:05 +00:00
This PR reverts #2280 which introduced `TransactionExtension` to replace `SignedExtension`. As a result of the discussion [here](https://github.com/paritytech/polkadot-sdk/pull/3623#issuecomment-1986789700), the changes will be reverted for now with plans to reintroduce the concept in the future. --------- Signed-off-by: georgepisaltu <george.pisaltu@parity.io>
This commit is contained in:
@@ -73,9 +73,11 @@ pub fn expand_outer_inherent(
|
||||
#(
|
||||
#pallet_attrs
|
||||
if let Some(inherent) = #pallet_names::create_inherent(self) {
|
||||
let inherent = <#unchecked_extrinsic as #scrate::sp_runtime::traits::Extrinsic>::new_inherent(
|
||||
let inherent = <#unchecked_extrinsic as #scrate::sp_runtime::traits::Extrinsic>::new(
|
||||
inherent.into(),
|
||||
);
|
||||
None,
|
||||
).expect("Runtime UncheckedExtrinsic is not Opaque, so it has to return \
|
||||
`Some`; qed");
|
||||
|
||||
inherents.push(inherent);
|
||||
}
|
||||
@@ -121,7 +123,7 @@ pub fn expand_outer_inherent(
|
||||
for xt in block.extrinsics() {
|
||||
// Inherents are before any other extrinsics.
|
||||
// And signed extrinsics are not inherents.
|
||||
if !(#scrate::sp_runtime::traits::Extrinsic::is_bare(xt)) {
|
||||
if #scrate::sp_runtime::traits::Extrinsic::is_signed(xt).unwrap_or(false) {
|
||||
break
|
||||
}
|
||||
|
||||
@@ -159,9 +161,10 @@ pub fn expand_outer_inherent(
|
||||
match #pallet_names::is_inherent_required(self) {
|
||||
Ok(Some(e)) => {
|
||||
let found = block.extrinsics().iter().any(|xt| {
|
||||
let is_bare = #scrate::sp_runtime::traits::Extrinsic::is_bare(xt);
|
||||
let is_signed = #scrate::sp_runtime::traits::Extrinsic::is_signed(xt)
|
||||
.unwrap_or(false);
|
||||
|
||||
if is_bare {
|
||||
if !is_signed {
|
||||
let call = <
|
||||
#unchecked_extrinsic as ExtrinsicCall
|
||||
>::call(xt);
|
||||
@@ -206,9 +209,8 @@ pub fn expand_outer_inherent(
|
||||
use #scrate::inherent::ProvideInherent;
|
||||
use #scrate::traits::{IsSubType, ExtrinsicCall};
|
||||
|
||||
let is_bare = #scrate::sp_runtime::traits::Extrinsic::is_bare(ext);
|
||||
if !is_bare {
|
||||
// Signed extrinsics are not inherents.
|
||||
if #scrate::sp_runtime::traits::Extrinsic::is_signed(ext).unwrap_or(false) {
|
||||
// Signed extrinsics are never inherents.
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -119,13 +119,13 @@ pub fn expand_runtime_metadata(
|
||||
call_ty,
|
||||
signature_ty,
|
||||
extra_ty,
|
||||
extensions: <
|
||||
signed_extensions: <
|
||||
<
|
||||
#extrinsic as #scrate::sp_runtime::traits::ExtrinsicMetadata
|
||||
>::Extra as #scrate::sp_runtime::traits::TransactionExtensionBase
|
||||
>::SignedExtensions as #scrate::sp_runtime::traits::SignedExtension
|
||||
>::metadata()
|
||||
.into_iter()
|
||||
.map(|meta| #scrate::__private::metadata_ir::TransactionExtensionMetadataIR {
|
||||
.map(|meta| #scrate::__private::metadata_ir::SignedExtensionMetadataIR {
|
||||
identifier: meta.identifier,
|
||||
ty: meta.ty,
|
||||
additional_signed: meta.additional_signed,
|
||||
|
||||
@@ -153,10 +153,6 @@ pub fn expand_outer_origin(
|
||||
self.filter = #scrate::__private::sp_std::rc::Rc::new(Box::new(filter));
|
||||
}
|
||||
|
||||
fn set_caller(&mut self, caller: OriginCaller) {
|
||||
self.caller = caller;
|
||||
}
|
||||
|
||||
fn set_caller_from(&mut self, other: impl Into<Self>) {
|
||||
self.caller = other.into().caller;
|
||||
}
|
||||
@@ -305,16 +301,6 @@ pub fn expand_outer_origin(
|
||||
}
|
||||
}
|
||||
|
||||
impl #scrate::__private::AsSystemOriginSigner<<#runtime as #system_path::Config>::AccountId> for RuntimeOrigin {
|
||||
fn as_system_origin_signer(&self) -> Option<&<#runtime as #system_path::Config>::AccountId> {
|
||||
if let OriginCaller::system(#system_path::Origin::<#runtime>::Signed(ref signed)) = &self.caller {
|
||||
Some(signed)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pallet_conversions
|
||||
})
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ use scale_info::TypeInfo;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sp_runtime::{
|
||||
generic::{CheckedExtrinsic, UncheckedExtrinsic},
|
||||
traits::Dispatchable,
|
||||
traits::SignedExtension,
|
||||
DispatchError, RuntimeDebug,
|
||||
};
|
||||
use sp_std::fmt;
|
||||
@@ -268,8 +268,7 @@ pub fn extract_actual_weight(result: &DispatchResultWithPostInfo, info: &Dispatc
|
||||
.calc_actual_weight(info)
|
||||
}
|
||||
|
||||
/// Extract the actual pays_fee from a dispatch result if any or fall back to the default
|
||||
/// weight.
|
||||
/// Extract the actual pays_fee from a dispatch result if any or fall back to the default weight.
|
||||
pub fn extract_actual_pays_fee(result: &DispatchResultWithPostInfo, info: &DispatchInfo) -> Pays {
|
||||
match result {
|
||||
Ok(post_info) => post_info,
|
||||
@@ -369,10 +368,11 @@ where
|
||||
}
|
||||
|
||||
/// Implementation for unchecked extrinsic.
|
||||
impl<Address, Call, Signature, Extension> GetDispatchInfo
|
||||
for UncheckedExtrinsic<Address, Call, Signature, Extension>
|
||||
impl<Address, Call, Signature, Extra> GetDispatchInfo
|
||||
for UncheckedExtrinsic<Address, Call, Signature, Extra>
|
||||
where
|
||||
Call: GetDispatchInfo + Dispatchable,
|
||||
Call: GetDispatchInfo,
|
||||
Extra: SignedExtension,
|
||||
{
|
||||
fn get_dispatch_info(&self) -> DispatchInfo {
|
||||
self.function.get_dispatch_info()
|
||||
@@ -380,7 +380,7 @@ where
|
||||
}
|
||||
|
||||
/// Implementation for checked extrinsic.
|
||||
impl<AccountId, Call, Extension> GetDispatchInfo for CheckedExtrinsic<AccountId, Call, Extension>
|
||||
impl<AccountId, Call, Extra> GetDispatchInfo for CheckedExtrinsic<AccountId, Call, Extra>
|
||||
where
|
||||
Call: GetDispatchInfo,
|
||||
{
|
||||
@@ -389,6 +389,21 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Implementation for test extrinsic.
|
||||
#[cfg(feature = "std")]
|
||||
impl<Call: Encode + GetDispatchInfo, Extra: Encode> GetDispatchInfo
|
||||
for sp_runtime::testing::TestXt<Call, Extra>
|
||||
{
|
||||
fn get_dispatch_info(&self) -> DispatchInfo {
|
||||
// for testing: weight == size.
|
||||
DispatchInfo {
|
||||
weight: Weight::from_parts(self.encode().len() as _, 0),
|
||||
pays_fee: Pays::Yes,
|
||||
class: self.call.get_dispatch_info().class,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A struct holding value for each `DispatchClass`.
|
||||
#[derive(Clone, Eq, PartialEq, Default, Debug, Encode, Decode, TypeInfo, MaxEncodedLen)]
|
||||
pub struct PerDispatchClass<T> {
|
||||
|
||||
@@ -54,8 +54,7 @@ pub mod __private {
|
||||
#[cfg(feature = "std")]
|
||||
pub use sp_runtime::{bounded_btree_map, bounded_vec};
|
||||
pub use sp_runtime::{
|
||||
traits::{AsSystemOriginSigner, Dispatchable},
|
||||
DispatchError, RuntimeDebug, StateVersion, TransactionOutcome,
|
||||
traits::Dispatchable, DispatchError, RuntimeDebug, StateVersion, TransactionOutcome,
|
||||
};
|
||||
#[cfg(feature = "std")]
|
||||
pub use sp_state_machine::BasicExternalities;
|
||||
@@ -76,7 +75,6 @@ pub mod storage;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
pub mod traits;
|
||||
pub mod transaction_extensions;
|
||||
pub mod weights;
|
||||
#[doc(hidden)]
|
||||
pub mod unsigned {
|
||||
@@ -1586,8 +1584,8 @@ pub mod pallet_macros {
|
||||
/// [`ValidateUnsigned`](frame_support::pallet_prelude::ValidateUnsigned) for
|
||||
/// type `Pallet<T>`, and some optional where clause.
|
||||
///
|
||||
/// NOTE: There is also the [`sp_runtime::traits::TransactionExtension`] trait that can be
|
||||
/// used to add some specific logic for transaction validation.
|
||||
/// NOTE: There is also the [`sp_runtime::traits::SignedExtension`] trait that can be used
|
||||
/// to add some specific logic for transaction validation.
|
||||
///
|
||||
/// ## Macro expansion
|
||||
///
|
||||
|
||||
@@ -482,7 +482,7 @@ pub trait OriginTrait: Sized {
|
||||
type Call;
|
||||
|
||||
/// The caller origin, overarching type of all pallets origins.
|
||||
type PalletsOrigin: Send + Sync + Into<Self> + CallerTrait<Self::AccountId> + MaxEncodedLen;
|
||||
type PalletsOrigin: Into<Self> + CallerTrait<Self::AccountId> + MaxEncodedLen;
|
||||
|
||||
/// The AccountId used across the system.
|
||||
type AccountId;
|
||||
@@ -496,14 +496,6 @@ pub trait OriginTrait: Sized {
|
||||
/// Replace the caller with caller from the other origin
|
||||
fn set_caller_from(&mut self, other: impl Into<Self>);
|
||||
|
||||
/// Replace the caller with caller from the other origin
|
||||
fn set_caller(&mut self, caller: Self::PalletsOrigin);
|
||||
|
||||
/// Replace the caller with caller from the other origin
|
||||
fn set_caller_from_signed(&mut self, caller_account: Self::AccountId) {
|
||||
self.set_caller(Self::PalletsOrigin::from(RawOrigin::Signed(caller_account)))
|
||||
}
|
||||
|
||||
/// Filter the call if caller is not root, if false is returned then the call must be filtered
|
||||
/// out.
|
||||
///
|
||||
@@ -552,17 +544,6 @@ pub trait OriginTrait: Sized {
|
||||
fn as_system_ref(&self) -> Option<&RawOrigin<Self::AccountId>> {
|
||||
self.caller().as_system_ref()
|
||||
}
|
||||
|
||||
/// Extract a reference to the sytsem signer, if that's what the caller is.
|
||||
fn as_system_signer(&self) -> Option<&Self::AccountId> {
|
||||
self.caller().as_system_ref().and_then(|s| {
|
||||
if let RawOrigin::Signed(ref who) = s {
|
||||
Some(who)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -919,13 +919,24 @@ pub trait ExtrinsicCall: sp_runtime::traits::Extrinsic {
|
||||
fn call(&self) -> &Self::Call;
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<Call, Extra> ExtrinsicCall for sp_runtime::testing::TestXt<Call, Extra>
|
||||
where
|
||||
Call: codec::Codec + Sync + Send + TypeInfo,
|
||||
Extra: TypeInfo,
|
||||
{
|
||||
fn call(&self) -> &Self::Call {
|
||||
&self.call
|
||||
}
|
||||
}
|
||||
|
||||
impl<Address, Call, Signature, Extra> ExtrinsicCall
|
||||
for sp_runtime::generic::UncheckedExtrinsic<Address, Call, Signature, Extra>
|
||||
where
|
||||
Address: TypeInfo,
|
||||
Call: TypeInfo,
|
||||
Signature: TypeInfo,
|
||||
Extra: TypeInfo,
|
||||
Extra: sp_runtime::traits::SignedExtension + TypeInfo,
|
||||
{
|
||||
fn call(&self) -> &Self::Call {
|
||||
&self.function
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Transaction extensions.
|
||||
|
||||
use crate::{CloneNoBound, EqNoBound, PartialEqNoBound, RuntimeDebugNoBound};
|
||||
use codec::{Decode, Encode};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_io::hashing::blake2_256;
|
||||
use sp_runtime::{
|
||||
impl_tx_ext_default,
|
||||
traits::{
|
||||
transaction_extension::{TransactionExtensionBase, TransactionExtensionInterior},
|
||||
DispatchInfoOf, Dispatchable, IdentifyAccount, TransactionExtension, Verify,
|
||||
},
|
||||
transaction_validity::{InvalidTransaction, TransactionValidityError, ValidTransaction},
|
||||
};
|
||||
|
||||
#[derive(
|
||||
CloneNoBound, EqNoBound, PartialEqNoBound, Encode, Decode, RuntimeDebugNoBound, TypeInfo,
|
||||
)]
|
||||
#[codec(encode_bound())]
|
||||
#[codec(decode_bound())]
|
||||
pub struct VerifyMultiSignature<V: Verify>
|
||||
where
|
||||
V: TransactionExtensionInterior,
|
||||
<V::Signer as IdentifyAccount>::AccountId: TransactionExtensionInterior,
|
||||
{
|
||||
signature: V,
|
||||
account: <V::Signer as IdentifyAccount>::AccountId,
|
||||
}
|
||||
|
||||
impl<V: Verify> TransactionExtensionBase for VerifyMultiSignature<V>
|
||||
where
|
||||
V: TransactionExtensionInterior,
|
||||
<V::Signer as IdentifyAccount>::AccountId: TransactionExtensionInterior,
|
||||
{
|
||||
const IDENTIFIER: &'static str = "VerifyMultiSignature";
|
||||
type Implicit = ();
|
||||
}
|
||||
|
||||
impl<V: Verify, Call: Dispatchable + Encode, Context> TransactionExtension<Call, Context>
|
||||
for VerifyMultiSignature<V>
|
||||
where
|
||||
V: TransactionExtensionInterior,
|
||||
<V::Signer as IdentifyAccount>::AccountId: TransactionExtensionInterior,
|
||||
<Call as Dispatchable>::RuntimeOrigin: From<Option<<V::Signer as IdentifyAccount>::AccountId>>,
|
||||
{
|
||||
type Val = ();
|
||||
type Pre = ();
|
||||
impl_tx_ext_default!(Call; Context; prepare);
|
||||
|
||||
fn validate(
|
||||
&self,
|
||||
_origin: <Call as Dispatchable>::RuntimeOrigin,
|
||||
_call: &Call,
|
||||
_info: &DispatchInfoOf<Call>,
|
||||
_len: usize,
|
||||
_: &mut Context,
|
||||
_: (),
|
||||
inherited_implication: &impl Encode,
|
||||
) -> Result<
|
||||
(ValidTransaction, Self::Val, <Call as Dispatchable>::RuntimeOrigin),
|
||||
TransactionValidityError,
|
||||
> {
|
||||
let msg = inherited_implication.using_encoded(blake2_256);
|
||||
|
||||
if !self.signature.verify(&msg[..], &self.account) {
|
||||
Err(InvalidTransaction::BadProof)?
|
||||
}
|
||||
// We clobber the original origin. Maybe we shuld check that it's none?
|
||||
let origin = Some(self.account.clone()).into();
|
||||
Ok((ValidTransaction::default(), (), origin))
|
||||
}
|
||||
}
|
||||
@@ -15,23 +15,24 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-03-01 (Y/M/D)
|
||||
//! HOSTNAME: `runner-bn-ce5rx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-06-16 (Y/M/D)
|
||||
//! HOSTNAME: `runner-e8ezs4ez-project-145-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||
//!
|
||||
//! SHORT-NAME: `block`, LONG-NAME: `BlockExecution`, RUNTIME: `Development`
|
||||
//! WARMUPS: `10`, REPEAT: `100`
|
||||
//! WEIGHT-PATH: `./substrate/frame/support/src/weights/`
|
||||
//! WEIGHT-PATH: `./frame/support/src/weights/`
|
||||
//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1.0`, WEIGHT-ADD: `0`
|
||||
|
||||
// Executed Command:
|
||||
// ./target/production/substrate-node
|
||||
// ./target/production/substrate
|
||||
// benchmark
|
||||
// overhead
|
||||
// --chain=dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --weight-path=./substrate/frame/support/src/weights/
|
||||
// --header=./substrate/HEADER-APACHE2
|
||||
// --weight-path=./frame/support/src/weights/
|
||||
// --header=./HEADER-APACHE2
|
||||
// --warmup=10
|
||||
// --repeat=100
|
||||
|
||||
@@ -43,17 +44,17 @@ parameter_types! {
|
||||
/// Calculated by multiplying the *Average* with `1.0` and adding `0`.
|
||||
///
|
||||
/// Stats nanoseconds:
|
||||
/// Min, Max: 424_332, 493_017
|
||||
/// Average: 437_118
|
||||
/// Median: 434_920
|
||||
/// Std-Dev: 8798.01
|
||||
/// Min, Max: 376_949, 622_462
|
||||
/// Average: 390_584
|
||||
/// Median: 386_322
|
||||
/// Std-Dev: 24792.0
|
||||
///
|
||||
/// Percentiles nanoseconds:
|
||||
/// 99th: 460_074
|
||||
/// 95th: 451_580
|
||||
/// 75th: 440_307
|
||||
/// 99th: 433_299
|
||||
/// 95th: 402_688
|
||||
/// 75th: 391_645
|
||||
pub const BlockExecutionWeight: Weight =
|
||||
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(437_118), 0);
|
||||
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(390_584), 0);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -15,23 +15,24 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-03-01 (Y/M/D)
|
||||
//! HOSTNAME: `runner-bn-ce5rx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-06-16 (Y/M/D)
|
||||
//! HOSTNAME: `runner-e8ezs4ez-project-145-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||
//!
|
||||
//! SHORT-NAME: `extrinsic`, LONG-NAME: `ExtrinsicBase`, RUNTIME: `Development`
|
||||
//! WARMUPS: `10`, REPEAT: `100`
|
||||
//! WEIGHT-PATH: `./substrate/frame/support/src/weights/`
|
||||
//! WEIGHT-PATH: `./frame/support/src/weights/`
|
||||
//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1.0`, WEIGHT-ADD: `0`
|
||||
|
||||
// Executed Command:
|
||||
// ./target/production/substrate-node
|
||||
// ./target/production/substrate
|
||||
// benchmark
|
||||
// overhead
|
||||
// --chain=dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --weight-path=./substrate/frame/support/src/weights/
|
||||
// --header=./substrate/HEADER-APACHE2
|
||||
// --weight-path=./frame/support/src/weights/
|
||||
// --header=./HEADER-APACHE2
|
||||
// --warmup=10
|
||||
// --repeat=100
|
||||
|
||||
@@ -43,17 +44,17 @@ parameter_types! {
|
||||
/// Calculated by multiplying the *Average* with `1.0` and adding `0`.
|
||||
///
|
||||
/// Stats nanoseconds:
|
||||
/// Min, Max: 106_053, 107_403
|
||||
/// Average: 106_446
|
||||
/// Median: 106_415
|
||||
/// Std-Dev: 216.17
|
||||
/// Min, Max: 123_875, 128_419
|
||||
/// Average: 124_414
|
||||
/// Median: 124_332
|
||||
/// Std-Dev: 497.74
|
||||
///
|
||||
/// Percentiles nanoseconds:
|
||||
/// 99th: 107_042
|
||||
/// 95th: 106_841
|
||||
/// 75th: 106_544
|
||||
/// 99th: 125_245
|
||||
/// 95th: 124_989
|
||||
/// 75th: 124_498
|
||||
pub const ExtrinsicBaseWeight: Weight =
|
||||
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(106_446), 0);
|
||||
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(124_414), 0);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
+2
-2
@@ -477,7 +477,7 @@ note: required because it appears within the type `RuntimeCall`
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
note: required by a bound in `frame_support::sp_runtime::traits::Dispatchable::Config`
|
||||
--> $WORKSPACE/substrate/primitives/runtime/src/traits/mod.rs
|
||||
--> $WORKSPACE/substrate/primitives/runtime/src/traits.rs
|
||||
|
|
||||
| type Config;
|
||||
| ^^^^^^^^^^^^ required by this bound in `Dispatchable::Config`
|
||||
@@ -510,7 +510,7 @@ note: required because it appears within the type `RuntimeCall`
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
note: required by a bound in `frame_support::pallet_prelude::ValidateUnsigned::Call`
|
||||
--> $WORKSPACE/substrate/primitives/runtime/src/traits/mod.rs
|
||||
--> $WORKSPACE/substrate/primitives/runtime/src/traits.rs
|
||||
|
|
||||
| type Call;
|
||||
| ^^^^^^^^^^ required by this bound in `ValidateUnsigned::Call`
|
||||
|
||||
@@ -743,40 +743,10 @@ impl pallet5::Config for Runtime {
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, codec::Encode, codec::Decode, PartialEq, Eq, scale_info::TypeInfo)]
|
||||
pub struct AccountU64(u64);
|
||||
impl sp_runtime::traits::IdentifyAccount for AccountU64 {
|
||||
type AccountId = u64;
|
||||
fn into_account(self) -> u64 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_runtime::traits::Verify for AccountU64 {
|
||||
type Signer = AccountU64;
|
||||
fn verify<L: sp_runtime::traits::Lazy<[u8]>>(
|
||||
&self,
|
||||
_msg: L,
|
||||
_signer: &<Self::Signer as sp_runtime::traits::IdentifyAccount>::AccountId,
|
||||
) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u64> for AccountU64 {
|
||||
fn from(value: u64) -> Self {
|
||||
Self(value)
|
||||
}
|
||||
}
|
||||
|
||||
pub type Header = sp_runtime::generic::Header<u32, sp_runtime::traits::BlakeTwo256>;
|
||||
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<
|
||||
u64,
|
||||
RuntimeCall,
|
||||
AccountU64,
|
||||
frame_system::CheckNonZeroSender<Runtime>,
|
||||
>;
|
||||
pub type UncheckedExtrinsic =
|
||||
sp_runtime::testing::TestXt<RuntimeCall, frame_system::CheckNonZeroSender<Runtime>>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub struct Runtime {
|
||||
@@ -926,8 +896,10 @@ fn inherent_expand() {
|
||||
|
||||
let inherents = InherentData::new().create_extrinsics();
|
||||
|
||||
let expected =
|
||||
vec![UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_no_post_info {}))];
|
||||
let expected = vec![UncheckedExtrinsic {
|
||||
call: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
|
||||
signature: None,
|
||||
}];
|
||||
assert_eq!(expected, inherents);
|
||||
|
||||
let block = Block::new(
|
||||
@@ -939,11 +911,14 @@ fn inherent_expand() {
|
||||
Digest::default(),
|
||||
),
|
||||
vec![
|
||||
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_no_post_info {})),
|
||||
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo {
|
||||
foo: 1,
|
||||
bar: 0,
|
||||
})),
|
||||
UncheckedExtrinsic {
|
||||
call: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
|
||||
signature: None,
|
||||
},
|
||||
UncheckedExtrinsic {
|
||||
call: RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 0 }),
|
||||
signature: None,
|
||||
},
|
||||
],
|
||||
);
|
||||
|
||||
@@ -958,11 +933,14 @@ fn inherent_expand() {
|
||||
Digest::default(),
|
||||
),
|
||||
vec![
|
||||
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_no_post_info {})),
|
||||
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo {
|
||||
foo: 0,
|
||||
bar: 0,
|
||||
})),
|
||||
UncheckedExtrinsic {
|
||||
call: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
|
||||
signature: None,
|
||||
},
|
||||
UncheckedExtrinsic {
|
||||
call: RuntimeCall::Example(pallet::Call::foo { foo: 0, bar: 0 }),
|
||||
signature: None,
|
||||
},
|
||||
],
|
||||
);
|
||||
|
||||
@@ -976,9 +954,10 @@ fn inherent_expand() {
|
||||
BlakeTwo256::hash(b"test"),
|
||||
Digest::default(),
|
||||
),
|
||||
vec![UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_storage_layer {
|
||||
foo: 0,
|
||||
}))],
|
||||
vec![UncheckedExtrinsic {
|
||||
call: RuntimeCall::Example(pallet::Call::foo_storage_layer { foo: 0 }),
|
||||
signature: None,
|
||||
}],
|
||||
);
|
||||
|
||||
let mut inherent = InherentData::new();
|
||||
@@ -993,12 +972,10 @@ fn inherent_expand() {
|
||||
BlakeTwo256::hash(b"test"),
|
||||
Digest::default(),
|
||||
),
|
||||
vec![UncheckedExtrinsic::new_signed(
|
||||
RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
|
||||
1,
|
||||
1.into(),
|
||||
Default::default(),
|
||||
)],
|
||||
vec![UncheckedExtrinsic {
|
||||
call: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
|
||||
signature: Some((1, Default::default())),
|
||||
}],
|
||||
);
|
||||
|
||||
let mut inherent = InherentData::new();
|
||||
@@ -1014,13 +991,14 @@ fn inherent_expand() {
|
||||
Digest::default(),
|
||||
),
|
||||
vec![
|
||||
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo {
|
||||
foo: 1,
|
||||
bar: 1,
|
||||
})),
|
||||
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_storage_layer {
|
||||
foo: 0,
|
||||
})),
|
||||
UncheckedExtrinsic {
|
||||
call: RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 1 }),
|
||||
signature: None,
|
||||
},
|
||||
UncheckedExtrinsic {
|
||||
call: RuntimeCall::Example(pallet::Call::foo_storage_layer { foo: 0 }),
|
||||
signature: None,
|
||||
},
|
||||
],
|
||||
);
|
||||
|
||||
@@ -1035,14 +1013,18 @@ fn inherent_expand() {
|
||||
Digest::default(),
|
||||
),
|
||||
vec![
|
||||
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo {
|
||||
foo: 1,
|
||||
bar: 1,
|
||||
})),
|
||||
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_storage_layer {
|
||||
foo: 0,
|
||||
})),
|
||||
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_no_post_info {})),
|
||||
UncheckedExtrinsic {
|
||||
call: RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 1 }),
|
||||
signature: None,
|
||||
},
|
||||
UncheckedExtrinsic {
|
||||
call: RuntimeCall::Example(pallet::Call::foo_storage_layer { foo: 0 }),
|
||||
signature: None,
|
||||
},
|
||||
UncheckedExtrinsic {
|
||||
call: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
|
||||
signature: None,
|
||||
},
|
||||
],
|
||||
);
|
||||
|
||||
@@ -1057,17 +1039,18 @@ fn inherent_expand() {
|
||||
Digest::default(),
|
||||
),
|
||||
vec![
|
||||
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo {
|
||||
foo: 1,
|
||||
bar: 1,
|
||||
})),
|
||||
UncheckedExtrinsic::new_signed(
|
||||
RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 0 }),
|
||||
1,
|
||||
1.into(),
|
||||
Default::default(),
|
||||
),
|
||||
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_no_post_info {})),
|
||||
UncheckedExtrinsic {
|
||||
call: RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 1 }),
|
||||
signature: None,
|
||||
},
|
||||
UncheckedExtrinsic {
|
||||
call: RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 0 }),
|
||||
signature: Some((1, Default::default())),
|
||||
},
|
||||
UncheckedExtrinsic {
|
||||
call: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
|
||||
signature: None,
|
||||
},
|
||||
],
|
||||
);
|
||||
|
||||
@@ -1950,7 +1933,7 @@ fn extrinsic_metadata_ir_types() {
|
||||
>(),
|
||||
ir.signature_ty
|
||||
);
|
||||
assert_eq!(meta_type::<AccountU64>(), ir.signature_ty);
|
||||
assert_eq!(meta_type::<()>(), ir.signature_ty);
|
||||
|
||||
assert_eq!(meta_type::<<<UncheckedExtrinsic as ExtrinsicT>::SignaturePayload as SignaturePayloadT>::SignatureExtra>(), ir.extra_ty);
|
||||
assert_eq!(meta_type::<frame_system::CheckNonZeroSender<Runtime>>(), ir.extra_ty);
|
||||
|
||||
@@ -943,7 +943,7 @@ fn metadata() {
|
||||
ty: scale_info::meta_type::<UncheckedExtrinsic>(),
|
||||
version: 4,
|
||||
signed_extensions: vec![SignedExtensionMetadata {
|
||||
identifier: "UnitTransactionExtension",
|
||||
identifier: "UnitSignedExtension",
|
||||
ty: scale_info::meta_type::<()>(),
|
||||
additional_signed: scale_info::meta_type::<()>(),
|
||||
}],
|
||||
|
||||
@@ -895,7 +895,7 @@ fn test_metadata() {
|
||||
ty: meta_type::<UncheckedExtrinsic>(),
|
||||
version: 4,
|
||||
signed_extensions: vec![SignedExtensionMetadata {
|
||||
identifier: "UnitTransactionExtension",
|
||||
identifier: "UnitSignedExtension",
|
||||
ty: meta_type::<()>(),
|
||||
additional_signed: meta_type::<()>(),
|
||||
}],
|
||||
|
||||
@@ -752,7 +752,7 @@ fn test_metadata() {
|
||||
name: "Version",
|
||||
ty: meta_type::<RuntimeVersion>(),
|
||||
value: RuntimeVersion::default().encode(),
|
||||
docs: maybe_docs(vec![ " Get the chain's current version."]),
|
||||
docs: maybe_docs(vec![ " Get the chain's in-code version."]),
|
||||
},
|
||||
PalletConstantMetadata {
|
||||
name: "SS58Prefix",
|
||||
@@ -895,7 +895,7 @@ fn test_metadata() {
|
||||
ty: meta_type::<UncheckedExtrinsic>(),
|
||||
version: 4,
|
||||
signed_extensions: vec![SignedExtensionMetadata {
|
||||
identifier: "UnitTransactionExtension",
|
||||
identifier: "UnitSignedExtension",
|
||||
ty: meta_type::<()>(),
|
||||
additional_signed: meta_type::<()>(),
|
||||
}],
|
||||
|
||||
Reference in New Issue
Block a user