mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 13:57:58 +00:00
Pass transaction source to validate_transaction (#5366)
* WiP * Support source in the runtime API. * Finish implementation in txpool. * Fix warning. * Fix tests. * Apply suggestions from code review Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-Authored-By: Nikolay Volf <nikvolf@gmail.com> * Extra changes. * Fix test and benches. * fix test * Fix test & benches again. * Fix tests. * Update bumpalo * Fix doc test. * Fix doctest. * Fix doctest. Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
pub use crate::sp_runtime::traits::ValidateUnsigned;
|
||||
#[doc(hidden)]
|
||||
pub use crate::sp_runtime::transaction_validity::{
|
||||
TransactionValidity, UnknownTransaction, TransactionValidityError,
|
||||
TransactionValidity, UnknownTransaction, TransactionValidityError, TransactionSource,
|
||||
};
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@ pub use crate::sp_runtime::transaction_validity::{
|
||||
/// # impl frame_support::unsigned::ValidateUnsigned for Module {
|
||||
/// # type Call = Call;
|
||||
/// #
|
||||
/// # fn validate_unsigned(call: &Self::Call) -> frame_support::unsigned::TransactionValidity {
|
||||
/// # fn validate_unsigned(_source: frame_support::unsigned::TransactionSource, _call: &Self::Call)
|
||||
/// -> frame_support::unsigned::TransactionValidity {
|
||||
/// # unimplemented!();
|
||||
/// # }
|
||||
/// # }
|
||||
@@ -78,10 +79,14 @@ macro_rules! impl_outer_validate_unsigned {
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_unsigned(call: &Self::Call) -> $crate::unsigned::TransactionValidity {
|
||||
fn validate_unsigned(
|
||||
#[allow(unused_variables)]
|
||||
source: $crate::unsigned::TransactionSource,
|
||||
call: &Self::Call,
|
||||
) -> $crate::unsigned::TransactionValidity {
|
||||
#[allow(unreachable_patterns)]
|
||||
match call {
|
||||
$( Call::$module(inner_call) => $module::validate_unsigned(inner_call), )*
|
||||
$( Call::$module(inner_call) => $module::validate_unsigned(source, inner_call), )*
|
||||
_ => $crate::unsigned::UnknownTransaction::NoUnsignedValidator.into(),
|
||||
}
|
||||
}
|
||||
@@ -110,7 +115,10 @@ mod test_partial_and_full_call {
|
||||
impl super::super::ValidateUnsigned for Module {
|
||||
type Call = Call;
|
||||
|
||||
fn validate_unsigned(_call: &Self::Call) -> super::super::TransactionValidity {
|
||||
fn validate_unsigned(
|
||||
_source: super::super::TransactionSource,
|
||||
_call: &Self::Call
|
||||
) -> super::super::TransactionValidity {
|
||||
unimplemented!();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user