Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FRAME: Create TransactionExtension as a replacement for SignedExtension #2280

Merged
merged 103 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
c220976
Create TransactionExtension and replace SignedExtension with it.
gavofyork Nov 11, 2023
cc315b8
Fixes macro issue
gupnik Nov 11, 2023
4b4e31f
Fixes and extract AdditionalSigned.
gavofyork Nov 11, 2023
c951a14
Final bits
gavofyork Nov 17, 2023
9c9bf85
Merge remote-tracking branch 'origin/master' into gav-tx-ext
gavofyork Nov 17, 2023
bf93801
Merge branch 'gav-tx-ext' of github.com:paritytech/polkadot-sdk into …
gavofyork Nov 17, 2023
0410dec
Merge remote-tracking branch 'origin/master' into gav-tx-ext
gavofyork Nov 17, 2023
549c285
It builds.
gavofyork Nov 20, 2023
dab1499
Builds with all features
gavofyork Nov 20, 2023
399962f
Migrate some Extensions.
gavofyork Nov 20, 2023
52c2d83
Merge branch 'master' into gav-tx-ext
gavofyork Nov 20, 2023
16c20c4
Merge branch 'gav-tx-ext' of github.com:paritytech/polkadot-sdk into …
gavofyork Nov 20, 2023
acd1be4
AdditionalSigned integrated as implicit
gavofyork Nov 21, 2023
25353dd
Make Verifysignature TxExt work,
gavofyork Nov 21, 2023
9aa7028
TransactionExtension has Call as a type param
gavofyork Nov 21, 2023
3d89109
Cleanups
gavofyork Nov 21, 2023
d229571
Remove unneeded code
gavofyork Nov 21, 2023
149e118
Impl TE for DisallowSigned
gavofyork Nov 21, 2023
2e80e78
Remove noop test
gavofyork Nov 21, 2023
0bce1be
Move over CheckIfFeeless
gavofyork Nov 21, 2023
a1e81c1
Port CheckSpecVersion
gavofyork Nov 21, 2023
5012612
Port CheckTxVersion
gavofyork Nov 21, 2023
cb708e5
Port CheckNonZeroSender
gavofyork Nov 21, 2023
5f3fa2c
Port CheckGenesis
gavofyork Nov 21, 2023
db26883
Repot
gavofyork Nov 22, 2023
a11adab
Add some utilities to origintrait
gavofyork Nov 22, 2023
3d7ac90
Everything builds again
gavofyork Nov 22, 2023
a37619e
Avoid unneeded cloning
gavofyork Nov 22, 2023
627951c
Docs
gavofyork Nov 22, 2023
fcda5bd
Merge remote-tracking branch 'origin/master' into gav-tx-ext
gavofyork Nov 22, 2023
2646792
Merge
gavofyork Nov 22, 2023
4e9fd7e
Split traits, introduce context
gavofyork Nov 23, 2023
6e17a83
Weight function
gavofyork Nov 23, 2023
b077f9e
Merge branch 'master' into gav-tx-ext
gavofyork Nov 23, 2023
7c835ac
Merge branch 'master' into gav-tx-ext
gavofyork Nov 26, 2023
91d9e81
[WIP] Migrate from `SignedExtension` to `TransactionExtension` (#2454)
georgepisaltu Nov 27, 2023
443d0e9
Bring `TransactionExtension` branch up-to-date (#2717)
georgepisaltu Dec 15, 2023
452095f
Revert "Bring `TransactionExtension` branch up-to-date (#2717)"
georgepisaltu Dec 15, 2023
a571aeb
Merge remote-tracking branch 'upstream/master' into merge-branch
georgepisaltu Dec 15, 2023
24babe4
Fix reference docs
georgepisaltu Dec 13, 2023
57b7ea6
Merge remote-tracking branch 'upstream/master' into merge-branch
georgepisaltu Dec 15, 2023
c87fdcb
Merge branch 'master' of github.com:paritytech/polkadot-sdk into gav-…
gupnik Dec 27, 2023
e8bbdeb
Fixes conflict in Cargo.lock
gupnik Dec 27, 2023
e48d039
Merge remote-tracking branch 'upstream/master' into gav-tx-ext
georgepisaltu Jan 10, 2024
b18c199
Add benchmarks to transaction extensions (#2726)
georgepisaltu Jan 11, 2024
f5b8d1f
Merge remote-tracking branch 'origin' into gav-tx-ext
georgepisaltu Jan 12, 2024
cbf8f29
Merge remote-tracking branch 'origin' into gav-tx-ext
georgepisaltu Jan 19, 2024
9dc38ef
Fix asset hub runtime compilation after merge
georgepisaltu Jan 19, 2024
54f1446
Merge remote-tracking branch 'origin' into gav-tx-ext
georgepisaltu Jan 22, 2024
00bf609
Merge remote-tracking branch 'origin/master' into gav-tx-ext
georgepisaltu Jan 29, 2024
450e8db
Minor fixes
georgepisaltu Jan 29, 2024
ad5eca8
Leverage default config for tx payment weights
georgepisaltu Jan 29, 2024
edaf851
Add issue number for todos
georgepisaltu Jan 30, 2024
b221355
Merge remote-tracking branch 'origin/master' into gav-tx-ext
georgepisaltu Jan 30, 2024
b194f01
Fix omitted tx ext in merge
georgepisaltu Jan 30, 2024
76559a5
Merge remote-tracking branch 'origin/master' into gav-tx-ext
georgepisaltu Jan 30, 2024
905be73
Tests for new unchecked xt encode/decode
georgepisaltu Feb 1, 2024
3ddd706
Remove `TestXt` use `UncheckedExtrinsic` instead
georgepisaltu Feb 5, 2024
4b7bc35
Merge remote-tracking branch 'origin/master' into gav-tx-ext
georgepisaltu Feb 5, 2024
a0fcba6
Remove remnants of `ExtrinsicWrapper`
georgepisaltu Feb 5, 2024
d29f8f9
Small refactoring and renames
georgepisaltu Feb 5, 2024
01bc7f5
Minor clippy fix
georgepisaltu Feb 5, 2024
2d12e41
Fix test pallet
georgepisaltu Feb 5, 2024
231d4d0
Another small fix
georgepisaltu Feb 5, 2024
1b1d95a
Another small fix
georgepisaltu Feb 5, 2024
c43b605
Final small fixes
georgepisaltu Feb 5, 2024
4e088cd
Some doc updates
georgepisaltu Feb 6, 2024
7e21e06
Merge remote-tracking branch 'origin/master' into gav-tx-ext
georgepisaltu Feb 6, 2024
ea2ab10
Fix `construct-runtime-ui` test
georgepisaltu Feb 6, 2024
abd150f
Small refactoring
georgepisaltu Feb 13, 2024
0116bcb
Fix `SkipCheckIfFeeless` tx ext base weight
georgepisaltu Feb 13, 2024
7d27e36
Merge remote-tracking branch 'origin/master' into gav-tx-ext
georgepisaltu Feb 14, 2024
416c819
Fix missed `implicit` default impl removal
georgepisaltu Feb 14, 2024
3da8891
Minor refactoring
georgepisaltu Feb 19, 2024
1c1fc4b
Merge remote-tracking branch 'origin/master' into gav-tx-ext
georgepisaltu Feb 19, 2024
d97d587
More minor refactoring
georgepisaltu Feb 19, 2024
dc2584a
Add test for unsigned non-zero sender
georgepisaltu Feb 19, 2024
506714b
Make `CheckNonce` work for unsigned origins
georgepisaltu Feb 19, 2024
b7c52b0
Avoid double compute of tx fee
georgepisaltu Feb 19, 2024
d94ba6b
Merge remote-tracking branch 'origin/master' into gav-tx-ext
georgepisaltu Feb 20, 2024
d6ea7c8
Minor refactoring
georgepisaltu Feb 27, 2024
9909554
Merge remote-tracking branch 'origin/master' into gav-tx-ext
georgepisaltu Feb 27, 2024
b5c9744
Migrate `StorageWeightReclaim` to tx ext
georgepisaltu Feb 27, 2024
bae070f
Minor fixes
georgepisaltu Feb 27, 2024
42c5643
Start benchmark work for `StorageWeightReclaim`
georgepisaltu Feb 28, 2024
3661781
Merge remote-tracking branch 'origin/master' into gav-tx-ext
georgepisaltu Feb 28, 2024
b7ca899
run zepter
georgepisaltu Feb 28, 2024
c91d6e3
Update reference docs for tx ext
georgepisaltu Feb 28, 2024
1f9c00b
Fix toml formatting
georgepisaltu Feb 28, 2024
2df8a01
Merge remote-tracking branch 'origin/master' into gav-tx-ext
georgepisaltu Feb 29, 2024
85174dd
Add PrDoc
georgepisaltu Feb 29, 2024
87e2155
Merge remote-tracking branch 'origin/master' into gav-tx-ext
georgepisaltu Feb 29, 2024
b816313
Fix syntax in PrDoc
georgepisaltu Feb 29, 2024
cb3bb81
Fix substrate benchmarks script
georgepisaltu Feb 29, 2024
f5d795f
Enable elastic scaling node feature in local testnets genesis (#3509)
sandreim Feb 29, 2024
ab5a762
".git/.scripts/commands/bench-all/bench-all.sh" --runtime=rococo --ta…
Feb 29, 2024
05f9637
Merge remote-tracking branch 'origin/master' into gav-tx-ext
georgepisaltu Mar 1, 2024
d820583
Merge branch 'master' of https://github.com/paritytech/polkadot-sdk i…
Mar 1, 2024
368b008
".git/.scripts/commands/bench-all/bench-all.sh" --target_dir=substrate
Mar 1, 2024
61a05de
Merge remote-tracking branch 'origin' into gav-tx-ext
georgepisaltu Mar 4, 2024
955f6ea
Minor renames
georgepisaltu Mar 4, 2024
321dcfc
Format toml
georgepisaltu Mar 4, 2024
8322f59
Adjust `BridgeHubRococoBaseConfirmationFeeInRocs`
georgepisaltu Mar 4, 2024
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
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 40 additions & 30 deletions bridges/bin/runtime-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,43 +104,48 @@ macro_rules! generate_bridge_reject_obsolete_headers_and_messages {
($call:ty, $account_id:ty, $($filter_call:ty),*) => {
#[derive(Clone, codec::Decode, Default, codec::Encode, Eq, PartialEq, sp_runtime::RuntimeDebug, scale_info::TypeInfo)]
pub struct BridgeRejectObsoleteHeadersAndMessages;
impl sp_runtime::traits::SignedExtension for BridgeRejectObsoleteHeadersAndMessages {
impl sp_runtime::traits::TransactionExtensionBase for BridgeRejectObsoleteHeadersAndMessages {
const IDENTIFIER: &'static str = "BridgeRejectObsoleteHeadersAndMessages";
type AccountId = $account_id;
type Call = $call;
type AdditionalSigned = ();
type Implicit = ();
}
impl<Context> sp_runtime::traits::TransactionExtension<$call, Context> for BridgeRejectObsoleteHeadersAndMessages {
type Pre = ();

fn additional_signed(&self) -> sp_std::result::Result<
(),
sp_runtime::transaction_validity::TransactionValidityError,
> {
Ok(())
}
type Val = ();

fn validate(
&self,
_who: &Self::AccountId,
call: &Self::Call,
_info: &sp_runtime::traits::DispatchInfoOf<Self::Call>,
origin: <$call as sp_runtime::traits::Dispatchable>::RuntimeOrigin,
call: &$call,
_info: &sp_runtime::traits::DispatchInfoOf<$call>,
_len: usize,
) -> sp_runtime::transaction_validity::TransactionValidity {
_context: &mut Context,
_self_implicit: Self::Implicit,
_inherited_implication: &impl codec::Encode,
) -> Result<
(
sp_runtime::transaction_validity::ValidTransaction,
Self::Val,
<$call as sp_runtime::traits::Dispatchable>::RuntimeOrigin,
), sp_runtime::transaction_validity::TransactionValidityError
> {
let valid = sp_runtime::transaction_validity::ValidTransaction::default();
$(
let valid = valid
.combine_with(<$filter_call as $crate::BridgeRuntimeFilterCall<$call>>::validate(call)?);
let v = <$filter_call as $crate::BridgeRuntimeFilterCall<$call>>::validate(call)?;
georgepisaltu marked this conversation as resolved.
Show resolved Hide resolved
let valid = valid.combine_with(v);
)*
Ok(valid)
Ok((valid, (), origin))
}

fn pre_dispatch(
fn prepare(
self,
who: &Self::AccountId,
call: &Self::Call,
info: &sp_runtime::traits::DispatchInfoOf<Self::Call>,
len: usize,
_val: Self::Val,
_origin: &<$call as sp_runtime::traits::Dispatchable>::RuntimeOrigin,
_call: &$call,
_info: &sp_runtime::traits::DispatchInfoOf<$call>,
_len: usize,
_context: &Context,
) -> Result<Self::Pre, sp_runtime::transaction_validity::TransactionValidityError> {
self.validate(who, call, info, len).map(drop)
Ok(())
}
}
};
Expand All @@ -149,12 +154,14 @@ macro_rules! generate_bridge_reject_obsolete_headers_and_messages {
#[cfg(test)]
mod tests {
use crate::BridgeRuntimeFilterCall;
use frame_support::{assert_err, assert_ok};
use codec::Encode;
use frame_support::assert_err;
use sp_runtime::{
traits::SignedExtension,
traits::DispatchTransaction,
transaction_validity::{InvalidTransaction, TransactionValidity, ValidTransaction},
};

#[derive(Encode)]
pub struct MockCall {
data: u32,
}
Expand Down Expand Up @@ -205,17 +212,20 @@ mod tests {
);

assert_err!(
BridgeRejectObsoleteHeadersAndMessages.validate(&(), &MockCall { data: 1 }, &(), 0),
BridgeRejectObsoleteHeadersAndMessages.validate_only((), &MockCall { data: 1 }, &(), 0),
InvalidTransaction::Custom(1)
);

assert_err!(
BridgeRejectObsoleteHeadersAndMessages.validate(&(), &MockCall { data: 2 }, &(), 0),
BridgeRejectObsoleteHeadersAndMessages.validate_only((), &MockCall { data: 2 }, &(), 0),
InvalidTransaction::Custom(2)
);

assert_ok!(
BridgeRejectObsoleteHeadersAndMessages.validate(&(), &MockCall { data: 3 }, &(), 0),
assert_eq!(
BridgeRejectObsoleteHeadersAndMessages
.validate_only((), &MockCall { data: 3 }, &(), 0)
.unwrap()
.0,
ValidTransaction { priority: 3, ..Default::default() }
)
}
Expand Down
Loading