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

[pallet-revive] implement tx origin API #6105

Merged
merged 22 commits into from
Oct 29, 2024
Merged

[pallet-revive] implement tx origin API #6105

merged 22 commits into from
Oct 29, 2024

Conversation

xermicus
Copy link
Member

Implement a syscall to retreive the transaction origin.

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
@xermicus
Copy link
Member Author

bot bench substrate-pallet --pallet=pallet_revive

@command-bot
Copy link

command-bot bot commented Oct 17, 2024

@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7592845 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --features=riscv --pallet=pallet_revive. 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 16-5fff8fbf-fbc7-47db-a8b7-5c6accb5fb5d to cancel this command or bot cancel to cancel all commands in this pull request.

@xermicus xermicus added R0-silent Changes should not be mentioned in any release notes T7-smart_contracts This PR/Issue is related to smart contracts. labels Oct 17, 2024
@command-bot
Copy link

command-bot bot commented Oct 17, 2024

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

@xermicus
Copy link
Member Author

/cmd prdoc --audience runtime_dev --bump minor

actions-user and others added 2 commits October 17, 2024 13:01
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
@xermicus
Copy link
Member Author

bot bench substrate-pallet --pallet=pallet_revive

@command-bot
Copy link

command-bot bot commented Oct 17, 2024

@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7593264 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --features=riscv --pallet=pallet_revive. 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 17-7e1f54f0-fca2-43fb-8c68-b710175c9a39 to cancel this command or bot cancel to cancel all commands in this pull request.

…=dev --target_dir=substrate --features=riscv --pallet=pallet_revive
@command-bot
Copy link

command-bot bot commented Oct 17, 2024

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

@xermicus
Copy link
Member Author

bot fmt

@command-bot
Copy link

command-bot bot commented Oct 17, 2024

@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7594728 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh". 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 18-27f397af-0c16-4f37-a156-cd8aeb22e6a0 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Oct 17, 2024

@xermicus Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7594728 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7594728/artifacts/download.

@xermicus xermicus marked this pull request as ready for review October 17, 2024 13:57
substrate/frame/revive/src/wasm/runtime.rs Outdated Show resolved Hide resolved
substrate/frame/revive/src/wasm/runtime.rs Outdated Show resolved Hide resolved
substrate/frame/revive/src/wasm/runtime.rs Outdated Show resolved Hide resolved
substrate/frame/revive/uapi/src/host.rs Outdated Show resolved Hide resolved
Comment on lines 1538 to 1540
fn origin(&self) -> Origin<T> {
self.origin.clone()
}
Copy link
Member

Choose a reason for hiding this comment

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

Why not return a reference?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy paste from fn caller which returns a value too. But I don't see why it can't be a reference. Changed it

Comment on lines 4447 to 4457
fn origin_api_works() {
let (code, _) = compile_module("origin").unwrap();

ExtBuilder::default().existential_deposit(100).build().execute_with(|| {
let _ = <Test as Config>::Currency::set_balance(&ALICE, 1_000_000);

// Create fixture: Constructor tests the origin to be equal the input data
builder::bare_instantiate(Code::Upload(code))
.data(ALICE_ADDR.0.to_vec())
.build_and_unwrap_contract();
});
Copy link
Member

Choose a reason for hiding this comment

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

Caller = Origin in this case. I think it should also test where this is not the case.

Copy link
Member Author

Choose a reason for hiding this comment

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

Deemed it unnecessary as this is already covered by the unit tests. Changed the fixture to go through both paths.

xermicus and others added 6 commits October 21, 2024 08:20
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Signed-off-by: xermicus <cyrill@parity.io>
Signed-off-by: xermicus <cyrill@parity.io>
Signed-off-by: xermicus <cyrill@parity.io>
@xermicus
Copy link
Member Author

bot fmt

@xermicus xermicus requested a review from athei October 21, 2024 07:05
@command-bot
Copy link

command-bot bot commented Oct 21, 2024

@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7606022 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh". 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 23-9e01355b-6ff5-42a0-8090-d4dc205fc291 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Oct 21, 2024

@xermicus Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7606022 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7606022/artifacts/download.

@xermicus
Copy link
Member Author

bot bench substrate-pallet --pallet=pallet_revive

@command-bot
Copy link

command-bot bot commented Oct 28, 2024

@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7652195 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --features=riscv --pallet=pallet_revive. 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 2-03c3e6da-13e6-4194-80dc-9cf38bf711d6 to cancel this command or bot cancel to cancel all commands in this pull request.

Signed-off-by: xermicus <cyrill@parity.io>
@command-bot
Copy link

command-bot bot commented Oct 28, 2024

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

@xermicus
Copy link
Member Author

bot bench substrate-pallet --pallet=pallet_revive

@command-bot
Copy link

command-bot bot commented Oct 29, 2024

@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7658445 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --features=riscv --pallet=pallet_revive. 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 6-d504943f-a0cf-41f7-8b7b-1ceddd5cfee2 to cancel this command or bot cancel to cancel all commands in this pull request.

…=dev --target_dir=substrate --features=riscv --pallet=pallet_revive
@command-bot
Copy link

command-bot bot commented Oct 29, 2024

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

@xermicus xermicus added this pull request to the merge queue Oct 29, 2024
Merged via the queue into master with commit 35535ef Oct 29, 2024
164 of 169 checks passed
@xermicus xermicus deleted the cl/origin branch October 29, 2024 09:42
mordamax pushed a commit to paritytech-stg/polkadot-sdk that referenced this pull request Oct 29, 2024
Implement a syscall to retreive the transaction origin.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
Signed-off-by: xermicus <cyrill@parity.io>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: command-bot <>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
mordamax pushed a commit to paritytech-stg/polkadot-sdk that referenced this pull request Oct 29, 2024
Implement a syscall to retreive the transaction origin.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
Signed-off-by: xermicus <cyrill@parity.io>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: command-bot <>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes T7-smart_contracts This PR/Issue is related to smart contracts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants