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: Meta Transaction (pallet based version) #4122

Open
wants to merge 6 commits into
base: george/restore-gav-tx-ext
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ members = [
"substrate/frame/membership",
"substrate/frame/merkle-mountain-range",
"substrate/frame/message-queue",
"substrate/frame/meta-tx",
"substrate/frame/migrations",
"substrate/frame/mixnet",
"substrate/frame/multisig",
Expand Down
4 changes: 4 additions & 0 deletions substrate/bin/node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ pallet-identity = { path = "../../../frame/identity", default-features = false }
pallet-lottery = { path = "../../../frame/lottery", default-features = false }
pallet-membership = { path = "../../../frame/membership", default-features = false }
pallet-message-queue = { path = "../../../frame/message-queue", default-features = false }
pallet-meta-tx = { path = "../../../frame/meta-tx", default-features = false }
pallet-mixnet = { path = "../../../frame/mixnet", default-features = false }
pallet-mmr = { path = "../../../frame/merkle-mountain-range", default-features = false }
pallet-multisig = { path = "../../../frame/multisig", default-features = false }
Expand Down Expand Up @@ -199,6 +200,7 @@ std = [
"pallet-lottery/std",
"pallet-membership/std",
"pallet-message-queue/std",
"pallet-meta-tx/std",
"pallet-migrations/std",
"pallet-mixnet/std",
"pallet-mmr/std",
Expand Down Expand Up @@ -305,6 +307,7 @@ runtime-benchmarks = [
"pallet-lottery/runtime-benchmarks",
"pallet-membership/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-meta-tx/runtime-benchmarks",
"pallet-migrations/runtime-benchmarks",
"pallet-mixnet/runtime-benchmarks",
"pallet-mmr/runtime-benchmarks",
Expand Down Expand Up @@ -386,6 +389,7 @@ try-runtime = [
"pallet-lottery/try-runtime",
"pallet-membership/try-runtime",
"pallet-message-queue/try-runtime",
"pallet-meta-tx/try-runtime",
"pallet-migrations/try-runtime",
"pallet-mixnet/try-runtime",
"pallet-mmr/try-runtime",
Expand Down
21 changes: 21 additions & 0 deletions substrate/bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2196,6 +2196,24 @@ impl pallet_parameters::Config for Runtime {
type WeightInfo = ();
}

pub type MetaTxExtension = (
frame_system::CheckNonZeroSender<Runtime>,
frame_system::CheckSpecVersion<Runtime>,
frame_system::CheckTxVersion<Runtime>,
frame_system::CheckGenesis<Runtime>,
frame_system::CheckEra<Runtime>,
frame_system::CheckNonce<Runtime>,
);

impl pallet_meta_tx::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Signature = Signature;
type PublicKey = <Signature as sp_runtime::traits::Verify>::Signer;
type Context = ();
type Extension = MetaTxExtension;
}

#[frame_support::runtime]
mod runtime {
#[runtime::runtime]
Expand Down Expand Up @@ -2449,6 +2467,9 @@ mod runtime {

#[runtime::pallet_index(77)]
pub type SkipFeelessPayment = pallet_skip_feeless_payment;

#[runtime::pallet_index(78)]
pub type MetaTransacion = pallet_meta_tx;
}

/// The address format for describing accounts.
Expand Down
54 changes: 54 additions & 0 deletions substrate/frame/meta-tx/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[package]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole crate is great, and should live in frame/examples if it remains in any form.

name = "pallet-meta-tx"
description = "Dispatch Meta Transaction"
license = "Apache-2.0"
version = "0.0.1"
edition.workspace = true
authors.workspace = true
repository.workspace = true

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["max-encoded-len"] }
docify = "0.2.7"
scale-info = { version = "2.1.2", default-features = false, features = ["derive"] }
serde = { features = ["derive"], optional = true, workspace = true, default-features = true }

frame-support = { path = "../support", default-features = false }
frame-system = { path = "../system", default-features = false }
sp-core = { path = "../../primitives/core", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
sp-std = { path = "../../primitives/std", default-features = false }
frame-benchmarking = { path = "../benchmarking", default-features = false, optional = true }

[dev-dependencies]
pallet-balances = { path = "../balances", features = ["std"] }
sp-io = { path = "../../primitives/io", features = ["std"] }
keyring = { package = "sp-keyring", path = "../../primitives/keyring" }
pallet-transaction-payment = { path = "../../frame/transaction-payment" }

[features]
default = ["std"]
std = [
"codec/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
"serde",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
]
runtime-benchmarks = [
"pallet-balances/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
try-runtime = [
"pallet-balances/try-runtime",
"frame-support/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime",
]
Loading
Loading