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 #6428

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open

FRAME: Meta Transaction #6428

wants to merge 47 commits into from

Conversation

muharem
Copy link
Contributor

@muharem muharem commented Nov 10, 2024

Meta transactions implementation.

The meta transaction follows a layout similar to that of a regular transaction and can leverage the same extensions implementing the TransactionExtension trait. Once signed and shared by the signer, the relayer may submit a regular transaction with the pallet_meta_tx::dispatch call, passing the signed meta transaction as an argument.

To see an example, refer to the mock setup and the sign_and_execute_meta_tx test case in substrate/frame/meta-tx/src/tests.rs file.

RFC: #4123

@muharem muharem marked this pull request as ready for review November 10, 2024 18:43
@muharem muharem requested a review from a team as a code owner November 10, 2024 18:43
@muharem muharem added the T1-FRAME This PR/Issue is related to core FRAME, the framework. label Nov 11, 2024
Info = DispatchInfo,
PostInfo = PostDispatchInfo,
RuntimeOrigin = <Self as Config>::RuntimeOrigin,
> + IsType<<Self as frame_system::Config>::RuntimeCall>;
Copy link
Contributor

@gui1117 gui1117 Nov 14, 2024

Choose a reason for hiding this comment

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

I think we no longer need to copy types like this. We can get rid of RuntimeCall and RuntimeOrigin associated types here and directly bound the frame system config supertrait:

pub trait Config: frame_system::Config<
    RuntimeCall: Parameter
			+ GetDispatchInfo
			+ Dispatchable<
				Info = DispatchInfo,
				PostInfo = PostDispatchInfo,
				RuntimeOrigin = <Self as Config>::RuntimeOrigin,
			>,
    RuntimeOrigin: AsTransactionAuthorizedOrigin
			+ From<SystemOrigin<Self::AccountId>>
>
{
...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these types of bounds are unstable, CI jobs failing, I left them unchanged for now

Copy link
Contributor

Choose a reason for hiding this comment

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

It should be stable since June :-/ https://blog.rust-lang.org/2024/06/13/Rust-1.79.0.html

Copy link
Contributor

Choose a reason for hiding this comment

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

Was there a particular CI jobs failing? I will try to fix it.

For now it seems somewhat green: #6817

@paritytech-review-bot paritytech-review-bot bot requested a review from a team November 25, 2024 14:35
@gui1117
Copy link
Contributor

gui1117 commented Dec 23, 2024

One concern came to mind:
Having multiple transaction type in the runtime, we must ensure they are differentiated, like signing for one transaction can be interpreted as the signature of another transaction.
In the main transaction, we have multiple versions, we differentiated between them by adding the version in the inherited implication (the inherited implication are the data signed). But here I don't know, maybe we can just use a different version for this one but it wasn't the initial design for versionning. Or maybe we should say that in the configuration they must use a transaction extension which implicit is like b"meta transaction context".

Right. The meta ext generally should be always missing weight related extensions (weight check, tx payment), otherwise there is no point for it. In this case only the signing client like wallet can mess this up. Or the meta ext was configured in a wrong way (uses the same ext as for a regular tx) on a runtime level. It already requires very rude mistake, which you also can do with an additional extension for example.

I was more thinking of an attack than a mistake. Like if instead of tx payment there is a witness transaction extension with similar implicit and explicit, or if among all the versions allowed for the general transaction, if somehow one can be decoded both as MetaExt and as the version X, then an attacker could reuse the signed payload to craft the non-intended transaction.

Anyway this is unlikely, I don't think it is a blocker, and we can always require to use a special transaction extension with the implicit b"meta transaction ctxt" at the end of the pipeline for MetaTx.

@muharem
Copy link
Contributor Author

muharem commented Dec 23, 2024

@gui1117 I will add later such extension. Thank you!

@muharem
Copy link
Contributor Author

muharem commented Jan 14, 2025

bot bench polkadot-pallet --pallet=pallet_verify_signature

@command-bot
Copy link

command-bot bot commented Jan 14, 2025

@muharem "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=rococo --target_dir=polkadot --pallet=pallet_verify_signature (https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8012162) was cancelled in #6428 (comment)

@muharem
Copy link
Contributor Author

muharem commented Jan 14, 2025

bot cancel 6-d5526c41-1eee-4b9b-9655-49440b617ecd

@command-bot
Copy link

command-bot bot commented Jan 14, 2025

@muharem Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=rococo --target_dir=polkadot --pallet=pallet_verify_signature has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8012162 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8012162/artifacts/download.

@muharem
Copy link
Contributor Author

muharem commented Jan 14, 2025

bot bench polkadot-pallet --pallet=pallet_verify_signature

@command-bot
Copy link

command-bot bot commented Jan 14, 2025

@muharem https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8012364 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=rococo --target_dir=polkadot --pallet=pallet_verify_signature. Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 7-1aaf0f4d-47c6-4f1e-ae90-2ebbb1e9dd75 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Jan 14, 2025

@muharem Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=rococo --target_dir=polkadot --pallet=pallet_verify_signature has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8012364 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8012364/artifacts/download.

@muharem
Copy link
Contributor Author

muharem commented Jan 14, 2025

bot bench polkadot-pallet --pallet=pallet_verify_signature --runtime westend

@command-bot
Copy link

command-bot bot commented Jan 14, 2025

@muharem https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8013094 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=westend --target_dir=polkadot --pallet=pallet_verify_signature. Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 8-c3ccaaf9-90e0-49dd-8461-58d946ee2a96 to cancel this command or bot cancel to cancel all commands in this pull request.

command-bot added 2 commits January 14, 2025 14:10
@command-bot
Copy link

command-bot bot commented Jan 14, 2025

@muharem Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=westend --target_dir=polkadot --pallet=pallet_verify_signature has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8013094 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8013094/artifacts/download.

@muharem
Copy link
Contributor Author

muharem commented Jan 15, 2025

bot bench substrate-pallet --pallet=pallet_meta_tx --features=runtime-benchmarks

@command-bot
Copy link

command-bot bot commented Jan 15, 2025

@muharem https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8021387 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --features=runtime-benchmarks --pallet=pallet_meta_tx. Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 10-a118287c-fa66-4e7a-99aa-26c15705f4ba to cancel this command or bot cancel to cancel all commands in this pull request.

@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/12780886373
Failed job name: test-linux-stable-no-try-runtime

…=dev --target_dir=substrate --features=runtime-benchmarks --pallet=pallet_meta_tx
@command-bot
Copy link

command-bot bot commented Jan 15, 2025

@muharem Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --features=runtime-benchmarks --pallet=pallet_meta_tx has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8021387 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8021387/artifacts/download.

Copy link
Contributor

@georgepisaltu georgepisaltu left a comment

Choose a reason for hiding this comment

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

Great work!

@muharem muharem self-assigned this Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

4 participants