backport changes from polkadot-sdk (#2872)

This commit is contained in:
Svyatoslav Nikolsky
2024-03-12 14:53:52 +03:00
committed by Bastian Köcher
parent 4bfd7807e7
commit 8bb0bfa524
53 changed files with 364 additions and 588 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ workspace = true
[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive", "bit-vec"] }
scale-info = { version = "2.10.0", default-features = false, features = ["bit-vec", "derive"] }
serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] }
serde = { default-features = false, features = ["alloc", "derive"], workspace = true }
# Bridge Dependencies
@@ -26,7 +26,7 @@ pub use bp_polkadot_core::{
};
use bp_messages::*;
use bp_polkadot_core::SuffixedCommonSignedExtension;
use bp_polkadot_core::SuffixedCommonTransactionExtension;
use bp_runtime::extensions::{
BridgeRejectObsoleteHeadersAndMessages, RefundBridgedParachainMessagesSchema,
};
@@ -164,7 +164,7 @@ pub const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce = 1024;
pub const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce = 4096;
/// Signed extension that is used by all bridge hubs.
pub type SignedExtension = SuffixedCommonSignedExtension<(
pub type TransactionExtension = SuffixedCommonTransactionExtension<(
BridgeRejectObsoleteHeadersAndMessages,
RefundBridgedParachainMessagesSchema,
)>;
@@ -107,5 +107,5 @@ frame_support::parameter_types! {
/// Transaction fee that is paid at the Rococo BridgeHub for delivering single outbound message confirmation.
/// (initially was calculated by test `BridgeHubRococo::can_calculate_fee_for_complex_message_confirmation_transaction` + `33%`)
pub const BridgeHubRococoBaseConfirmationFeeInRocs: u128 = 5_380_829_647;
pub const BridgeHubRococoBaseConfirmationFeeInRocs: u128 = 5_380_904_835;
}
+2 -2
View File
@@ -59,8 +59,8 @@ impl ChainWithGrandpa for Kusama {
const AVERAGE_HEADER_SIZE: u32 = AVERAGE_HEADER_SIZE;
}
// The SignedExtension used by Kusama.
pub use bp_polkadot_core::CommonSignedExtension as SignedExtension;
// The TransactionExtension used by Kusama.
pub use bp_polkadot_core::CommonTransactionExtension as TransactionExtension;
/// Name of the parachains pallet in the Kusama runtime.
pub const PARAS_PALLET_NAME: &str = "Paras";
@@ -25,7 +25,7 @@ use bp_runtime::{
decl_bridge_finality_runtime_apis, decl_bridge_messages_runtime_apis,
extensions::{
CheckEra, CheckGenesis, CheckNonZeroSender, CheckNonce, CheckSpecVersion, CheckTxVersion,
CheckWeight, GenericSignedExtension, GenericSignedExtensionSchema,
CheckWeight, GenericTransactionExtension, GenericTransactionExtensionSchema,
},
Chain, ChainId, TransactionEra,
};
@@ -37,7 +37,12 @@ use frame_support::{
};
use frame_system::limits;
use scale_info::TypeInfo;
use sp_runtime::{traits::DispatchInfoOf, transaction_validity::TransactionValidityError, Perbill};
use sp_runtime::{
impl_tx_ext_default,
traits::{Dispatchable, TransactionExtensionBase},
transaction_validity::TransactionValidityError,
Perbill,
};
// This chain reuses most of Polkadot primitives.
pub use bp_polkadot_core::{
@@ -71,10 +76,10 @@ pub const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce = 1024;
pub const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce = 4096;
/// This signed extension is used to ensure that the chain transactions are signed by proper
pub type ValidateSigned = GenericSignedExtensionSchema<(), ()>;
pub type ValidateSigned = GenericTransactionExtensionSchema<(), ()>;
/// Signed extension schema, used by Polkadot Bulletin.
pub type SignedExtensionSchema = GenericSignedExtension<(
pub type TransactionExtensionSchema = GenericTransactionExtension<(
(
CheckNonZeroSender,
CheckSpecVersion,
@@ -87,34 +92,30 @@ pub type SignedExtensionSchema = GenericSignedExtension<(
ValidateSigned,
)>;
/// Signed extension, used by Polkadot Bulletin.
/// Transaction extension, used by Polkadot Bulletin.
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
pub struct SignedExtension(SignedExtensionSchema);
pub struct TransactionExtension(TransactionExtensionSchema);
impl sp_runtime::traits::SignedExtension for SignedExtension {
impl TransactionExtensionBase for TransactionExtension {
const IDENTIFIER: &'static str = "Not needed.";
type AccountId = ();
type Call = ();
type AdditionalSigned =
<SignedExtensionSchema as sp_runtime::traits::SignedExtension>::AdditionalSigned;
type Pre = ();
type Implicit = <TransactionExtensionSchema as TransactionExtensionBase>::Implicit;
fn additional_signed(&self) -> Result<Self::AdditionalSigned, TransactionValidityError> {
self.0.additional_signed()
}
fn pre_dispatch(
self,
_who: &Self::AccountId,
_call: &Self::Call,
_info: &DispatchInfoOf<Self::Call>,
_len: usize,
) -> Result<Self::Pre, TransactionValidityError> {
Ok(())
fn implicit(&self) -> Result<Self::Implicit, TransactionValidityError> {
<TransactionExtensionSchema as TransactionExtensionBase>::implicit(&self.0)
}
}
impl SignedExtension {
impl<C, Context> sp_runtime::traits::TransactionExtension<C, Context> for TransactionExtension
where
C: Dispatchable,
{
type Pre = ();
type Val = ();
impl_tx_ext_default!(C; Context; validate prepare);
}
impl TransactionExtension {
/// Create signed extension from its components.
pub fn from_params(
spec_version: u32,
@@ -123,7 +124,7 @@ impl SignedExtension {
genesis_hash: Hash,
nonce: Nonce,
) -> Self {
Self(GenericSignedExtension::new(
Self(GenericTransactionExtension::new(
(
(
(), // non-zero sender
+2 -2
View File
@@ -61,8 +61,8 @@ impl ChainWithGrandpa for Polkadot {
const AVERAGE_HEADER_SIZE: u32 = AVERAGE_HEADER_SIZE;
}
/// The SignedExtension used by Polkadot.
pub type SignedExtension = SuffixedCommonSignedExtension<PrevalidateAttests>;
/// The TransactionExtension used by Polkadot.
pub type TransactionExtension = SuffixedCommonTransactionExtension<PrevalidateAttests>;
/// Name of the parachains pallet in the Polkadot runtime.
pub const PARAS_PALLET_NAME: &str = "Paras";
+2 -2
View File
@@ -59,8 +59,8 @@ impl ChainWithGrandpa for Rococo {
const AVERAGE_HEADER_SIZE: u32 = AVERAGE_HEADER_SIZE;
}
// The SignedExtension used by Rococo.
pub use bp_polkadot_core::CommonSignedExtension as SignedExtension;
// The TransactionExtension used by Rococo.
pub use bp_polkadot_core::CommonTransactionExtension as TransactionExtension;
/// Name of the parachains pallet in the Rococo runtime.
pub const PARAS_PALLET_NAME: &str = "Paras";
+2 -2
View File
@@ -59,8 +59,8 @@ impl ChainWithGrandpa for Westend {
const AVERAGE_HEADER_SIZE: u32 = AVERAGE_HEADER_SIZE;
}
// The SignedExtension used by Westend.
pub use bp_polkadot_core::CommonSignedExtension as SignedExtension;
// The TransactionExtension used by Westend.
pub use bp_polkadot_core::CommonTransactionExtension as TransactionExtension;
/// Name of the parachains pallet in the Rococo runtime.
pub const PARAS_PALLET_NAME: &str = "Paras";
+1 -1
View File
@@ -13,7 +13,7 @@ workspace = true
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
finality-grandpa = { version = "0.16.2", default-features = false }
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] }
serde = { features = ["alloc", "derive"], workspace = true }
# Bridge dependencies
+1 -1
View File
@@ -12,7 +12,7 @@ workspace = true
[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["bit-vec", "derive"] }
scale-info = { version = "2.10.0", default-features = false, features = ["bit-vec", "derive"] }
serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] }
serde = { features = ["alloc", "derive"], workspace = true }
# Bridge dependencies
+1 -1
View File
@@ -13,7 +13,7 @@ workspace = true
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] }
parity-util-mem = { version = "0.12.0", optional = true }
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
serde = { version = "1.0", optional = true, features = ["derive"] }
serde = { default-features = false, features = ["derive"], optional = true, workspace = true }
# Bridge Dependencies
+21 -16
View File
@@ -24,8 +24,8 @@ use bp_runtime::{
self,
extensions::{
ChargeTransactionPayment, CheckEra, CheckGenesis, CheckNonZeroSender, CheckNonce,
CheckSpecVersion, CheckTxVersion, CheckWeight, GenericSignedExtension,
SignedExtensionSchema,
CheckSpecVersion, CheckTxVersion, CheckWeight, GenericTransactionExtension,
TransactionExtensionSchema,
},
EncodedOrDecodedCall, StorageMapKeyProvider, TransactionEra,
};
@@ -229,8 +229,12 @@ pub type SignedBlock = generic::SignedBlock<Block>;
pub type Balance = u128;
/// Unchecked Extrinsic type.
pub type UncheckedExtrinsic<Call, SignedExt> =
generic::UncheckedExtrinsic<AccountAddress, EncodedOrDecodedCall<Call>, Signature, SignedExt>;
pub type UncheckedExtrinsic<Call, TransactionExt> = generic::UncheckedExtrinsic<
AccountAddress,
EncodedOrDecodedCall<Call>,
Signature,
TransactionExt,
>;
/// Account address, used by the Polkadot-like chain.
pub type Address = MultiAddress<AccountId, ()>;
@@ -275,7 +279,7 @@ impl AccountInfoStorageMapKeyProvider {
}
/// Extra signed extension data that is used by most chains.
pub type CommonSignedExtra = (
pub type CommonTransactionExtra = (
CheckNonZeroSender,
CheckSpecVersion,
CheckTxVersion,
@@ -286,12 +290,12 @@ pub type CommonSignedExtra = (
ChargeTransactionPayment<Balance>,
);
/// Extra signed extension data that starts with `CommonSignedExtra`.
pub type SuffixedCommonSignedExtension<Suffix> =
GenericSignedExtension<(CommonSignedExtra, Suffix)>;
/// Extra transaction extension data that starts with `CommonTransactionExtra`.
pub type SuffixedCommonTransactionExtension<Suffix> =
GenericTransactionExtension<(CommonTransactionExtra, Suffix)>;
/// Helper trait to define some extra methods on `SuffixedCommonSignedExtension`.
pub trait SuffixedCommonSignedExtensionExt<Suffix: SignedExtensionSchema> {
/// Helper trait to define some extra methods on `SuffixedCommonTransactionExtension`.
pub trait SuffixedCommonTransactionExtensionExt<Suffix: TransactionExtensionSchema> {
/// Create signed extension from its components.
fn from_params(
spec_version: u32,
@@ -300,7 +304,7 @@ pub trait SuffixedCommonSignedExtensionExt<Suffix: SignedExtensionSchema> {
genesis_hash: Hash,
nonce: Nonce,
tip: Balance,
extra: (Suffix::Payload, Suffix::AdditionalSigned),
extra: (Suffix::Payload, Suffix::Implicit),
) -> Self;
/// Return transaction nonce.
@@ -310,9 +314,10 @@ pub trait SuffixedCommonSignedExtensionExt<Suffix: SignedExtensionSchema> {
fn tip(&self) -> Balance;
}
impl<Suffix> SuffixedCommonSignedExtensionExt<Suffix> for SuffixedCommonSignedExtension<Suffix>
impl<Suffix> SuffixedCommonTransactionExtensionExt<Suffix>
for SuffixedCommonTransactionExtension<Suffix>
where
Suffix: SignedExtensionSchema,
Suffix: TransactionExtensionSchema,
{
fn from_params(
spec_version: u32,
@@ -321,9 +326,9 @@ where
genesis_hash: Hash,
nonce: Nonce,
tip: Balance,
extra: (Suffix::Payload, Suffix::AdditionalSigned),
extra: (Suffix::Payload, Suffix::Implicit),
) -> Self {
GenericSignedExtension::new(
GenericTransactionExtension::new(
(
(
(), // non-zero sender
@@ -365,7 +370,7 @@ where
}
/// Signed extension that is used by most chains.
pub type CommonSignedExtension = SuffixedCommonSignedExtension<()>;
pub type CommonTransactionExtension = SuffixedCommonTransactionExtension<()>;
#[cfg(test)]
mod tests {
+2 -2
View File
@@ -13,10 +13,10 @@ workspace = true
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
hash-db = { version = "0.16.0", default-features = false }
impl-trait-for-tuples = "0.2.2"
log = { version = "0.4.21", default-features = false }
log = { workspace = true }
num-traits = { version = "0.2", default-features = false }
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] }
serde = { features = ["alloc", "derive"], workspace = true }
# Substrate Dependencies
+11
View File
@@ -98,6 +98,17 @@ impl<ChainCall: Encode> Encode for EncodedOrDecodedCall<ChainCall> {
}
}
// dummy implementation to satisfy `SignedPayload` requirements
impl<ChainCall> sp_runtime::traits::Dispatchable for EncodedOrDecodedCall<ChainCall> {
type RuntimeOrigin = ();
type Config = ();
type Info = ();
type PostInfo = ();
fn dispatch(self, _origin: ()) -> sp_runtime::DispatchResultWithInfo<()> {
unreachable!("never used by relayer; qed")
}
}
/// Minimal Substrate-based chain representation that may be used from no_std environment.
pub trait Chain: Send + Sync + 'static {
/// Chain id.
+70 -67
View File
@@ -20,135 +20,138 @@ use codec::{Compact, Decode, Encode};
use impl_trait_for_tuples::impl_for_tuples;
use scale_info::{StaticTypeInfo, TypeInfo};
use sp_runtime::{
traits::{DispatchInfoOf, SignedExtension},
impl_tx_ext_default,
traits::{Dispatchable, TransactionExtension, TransactionExtensionBase},
transaction_validity::TransactionValidityError,
};
use sp_std::{fmt::Debug, marker::PhantomData};
/// Trait that describes some properties of a `SignedExtension` that are needed in order to send a
/// transaction to the chain.
pub trait SignedExtensionSchema: Encode + Decode + Debug + Eq + Clone + StaticTypeInfo {
/// Trait that describes some properties of a `TransactionExtension` that are needed in order to
/// send a transaction to the chain.
pub trait TransactionExtensionSchema:
Encode + Decode + Debug + Eq + Clone + StaticTypeInfo
{
/// A type of the data encoded as part of the transaction.
type Payload: Encode + Decode + Debug + Eq + Clone + StaticTypeInfo;
/// Parameters which are part of the payload used to produce transaction signature,
/// but don't end up in the transaction itself (i.e. inherent part of the runtime).
type AdditionalSigned: Encode + Debug + Eq + Clone + StaticTypeInfo;
type Implicit: Encode + Decode + Debug + Eq + Clone + StaticTypeInfo;
}
impl SignedExtensionSchema for () {
impl TransactionExtensionSchema for () {
type Payload = ();
type AdditionalSigned = ();
type Implicit = ();
}
/// An implementation of `SignedExtensionSchema` using generic params.
/// An implementation of `TransactionExtensionSchema` using generic params.
#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, TypeInfo)]
pub struct GenericSignedExtensionSchema<P, S>(PhantomData<(P, S)>);
pub struct GenericTransactionExtensionSchema<P, S>(PhantomData<(P, S)>);
impl<P, S> SignedExtensionSchema for GenericSignedExtensionSchema<P, S>
impl<P, S> TransactionExtensionSchema for GenericTransactionExtensionSchema<P, S>
where
P: Encode + Decode + Debug + Eq + Clone + StaticTypeInfo,
S: Encode + Debug + Eq + Clone + StaticTypeInfo,
S: Encode + Decode + Debug + Eq + Clone + StaticTypeInfo,
{
type Payload = P;
type AdditionalSigned = S;
type Implicit = S;
}
/// The `SignedExtensionSchema` for `frame_system::CheckNonZeroSender`.
pub type CheckNonZeroSender = GenericSignedExtensionSchema<(), ()>;
/// The `TransactionExtensionSchema` for `frame_system::CheckNonZeroSender`.
pub type CheckNonZeroSender = GenericTransactionExtensionSchema<(), ()>;
/// The `SignedExtensionSchema` for `frame_system::CheckSpecVersion`.
pub type CheckSpecVersion = GenericSignedExtensionSchema<(), u32>;
/// The `TransactionExtensionSchema` for `frame_system::CheckSpecVersion`.
pub type CheckSpecVersion = GenericTransactionExtensionSchema<(), u32>;
/// The `SignedExtensionSchema` for `frame_system::CheckTxVersion`.
pub type CheckTxVersion = GenericSignedExtensionSchema<(), u32>;
/// The `TransactionExtensionSchema` for `frame_system::CheckTxVersion`.
pub type CheckTxVersion = GenericTransactionExtensionSchema<(), u32>;
/// The `SignedExtensionSchema` for `frame_system::CheckGenesis`.
pub type CheckGenesis<Hash> = GenericSignedExtensionSchema<(), Hash>;
/// The `TransactionExtensionSchema` for `frame_system::CheckGenesis`.
pub type CheckGenesis<Hash> = GenericTransactionExtensionSchema<(), Hash>;
/// The `SignedExtensionSchema` for `frame_system::CheckEra`.
pub type CheckEra<Hash> = GenericSignedExtensionSchema<sp_runtime::generic::Era, Hash>;
/// The `TransactionExtensionSchema` for `frame_system::CheckEra`.
pub type CheckEra<Hash> = GenericTransactionExtensionSchema<sp_runtime::generic::Era, Hash>;
/// The `SignedExtensionSchema` for `frame_system::CheckNonce`.
pub type CheckNonce<TxNonce> = GenericSignedExtensionSchema<Compact<TxNonce>, ()>;
/// The `TransactionExtensionSchema` for `frame_system::CheckNonce`.
pub type CheckNonce<TxNonce> = GenericTransactionExtensionSchema<Compact<TxNonce>, ()>;
/// The `SignedExtensionSchema` for `frame_system::CheckWeight`.
pub type CheckWeight = GenericSignedExtensionSchema<(), ()>;
/// The `TransactionExtensionSchema` for `frame_system::CheckWeight`.
pub type CheckWeight = GenericTransactionExtensionSchema<(), ()>;
/// The `SignedExtensionSchema` for `pallet_transaction_payment::ChargeTransactionPayment`.
pub type ChargeTransactionPayment<Balance> = GenericSignedExtensionSchema<Compact<Balance>, ()>;
/// The `TransactionExtensionSchema` for `pallet_transaction_payment::ChargeTransactionPayment`.
pub type ChargeTransactionPayment<Balance> =
GenericTransactionExtensionSchema<Compact<Balance>, ()>;
/// The `SignedExtensionSchema` for `polkadot-runtime-common::PrevalidateAttests`.
pub type PrevalidateAttests = GenericSignedExtensionSchema<(), ()>;
/// The `TransactionExtensionSchema` for `polkadot-runtime-common::PrevalidateAttests`.
pub type PrevalidateAttests = GenericTransactionExtensionSchema<(), ()>;
/// The `SignedExtensionSchema` for `BridgeRejectObsoleteHeadersAndMessages`.
pub type BridgeRejectObsoleteHeadersAndMessages = GenericSignedExtensionSchema<(), ()>;
/// The `TransactionExtensionSchema` for `BridgeRejectObsoleteHeadersAndMessages`.
pub type BridgeRejectObsoleteHeadersAndMessages = GenericTransactionExtensionSchema<(), ()>;
/// The `SignedExtensionSchema` for `RefundBridgedParachainMessages`.
/// The `TransactionExtensionSchema` for `RefundBridgedParachainMessages`.
/// This schema is dedicated for `RefundBridgedParachainMessages` signed extension as
/// wildcard/placeholder, which relies on the scale encoding for `()` or `((), ())`, or `((), (),
/// ())` is the same. So runtime can contains any kind of tuple:
/// `(BridgeRefundBridgeHubRococoMessages)`
/// `(BridgeRefundBridgeHubRococoMessages, BridgeRefundBridgeHubWestendMessages)`
/// `(BridgeRefundParachainMessages1, ..., BridgeRefundParachainMessagesN)`
pub type RefundBridgedParachainMessagesSchema = GenericSignedExtensionSchema<(), ()>;
pub type RefundBridgedParachainMessagesSchema = GenericTransactionExtensionSchema<(), ()>;
#[impl_for_tuples(1, 12)]
impl SignedExtensionSchema for Tuple {
impl TransactionExtensionSchema for Tuple {
for_tuples!( type Payload = ( #( Tuple::Payload ),* ); );
for_tuples!( type AdditionalSigned = ( #( Tuple::AdditionalSigned ),* ); );
for_tuples!( type Implicit = ( #( Tuple::Implicit ),* ); );
}
/// A simplified version of signed extensions meant for producing signed transactions
/// and signed payloads in the client code.
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
pub struct GenericSignedExtension<S: SignedExtensionSchema> {
pub struct GenericTransactionExtension<S: TransactionExtensionSchema> {
/// A payload that is included in the transaction.
pub payload: S::Payload,
#[codec(skip)]
// It may be set to `None` if extensions are decoded. We are never reconstructing transactions
// (and it makes no sense to do that) => decoded version of `SignedExtensions` is only used to
// read fields of the `payload`. And when resigning transaction, we're reconstructing
// `SignedExtensions` from scratch.
additional_signed: Option<S::AdditionalSigned>,
// (and it makes no sense to do that) => decoded version of `TransactionExtensions` is only
// used to read fields of the `payload`. And when resigning transaction, we're reconstructing
// `TransactionExtensions` from scratch.
implicit: Option<S::Implicit>,
}
impl<S: SignedExtensionSchema> GenericSignedExtension<S> {
/// Create new `GenericSignedExtension` object.
pub fn new(payload: S::Payload, additional_signed: Option<S::AdditionalSigned>) -> Self {
Self { payload, additional_signed }
impl<S: TransactionExtensionSchema> GenericTransactionExtension<S> {
/// Create new `GenericTransactionExtension` object.
pub fn new(payload: S::Payload, implicit: Option<S::Implicit>) -> Self {
Self { payload, implicit }
}
}
impl<S> SignedExtension for GenericSignedExtension<S>
impl<S> TransactionExtensionBase for GenericTransactionExtension<S>
where
S: SignedExtensionSchema,
S: TransactionExtensionSchema,
S::Payload: Send + Sync,
S::AdditionalSigned: Send + Sync,
S::Implicit: Send + Sync,
{
const IDENTIFIER: &'static str = "Not needed.";
type AccountId = ();
type Call = ();
type AdditionalSigned = S::AdditionalSigned;
type Pre = ();
type Implicit = S::Implicit;
fn additional_signed(&self) -> Result<Self::AdditionalSigned, TransactionValidityError> {
fn implicit(&self) -> Result<Self::Implicit, TransactionValidityError> {
// we shall not ever see this error in relay, because we are never signing decoded
// transactions. Instead we're constructing and signing new transactions. So the error code
// is kinda random here
self.additional_signed.clone().ok_or(
frame_support::unsigned::TransactionValidityError::Unknown(
self.implicit
.clone()
.ok_or(frame_support::unsigned::TransactionValidityError::Unknown(
frame_support::unsigned::UnknownTransaction::Custom(0xFF),
),
)
}
fn pre_dispatch(
self,
_who: &Self::AccountId,
_call: &Self::Call,
_info: &DispatchInfoOf<Self::Call>,
_len: usize,
) -> Result<Self::Pre, TransactionValidityError> {
Ok(())
))
}
}
impl<S, C, Context> TransactionExtension<C, Context> for GenericTransactionExtension<S>
where
C: Dispatchable,
S: TransactionExtensionSchema,
S::Payload: Send + Sync,
S::Implicit: Send + Sync,
{
type Pre = ();
type Val = ();
impl_tx_ext_default!(C; Context; validate prepare);
}
+1 -1
View File
@@ -129,7 +129,7 @@ pub fn make_justification_for_header<H: HeaderT>(
votes_ancestries.push(child.clone());
}
// The header we need to use when pre-commiting is the one at the highest height
// The header we need to use when pre-committing is the one at the highest height
// on our chain.
let precommit_candidate = chain.last().map(|h| (h.hash(), *h.number())).unwrap();
unsigned_precommits.push(precommit_candidate);