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

Contracts: Reuse module when validating #3789

Merged
merged 9 commits into from
Apr 10, 2024

Conversation

pgherveou
Copy link
Contributor

@pgherveou pgherveou commented Mar 21, 2024

Reuse wasmi Module when validating.
Prepare the code for 0.32 and the addition of Module::new_unchecked

@pgherveou pgherveou requested a review from athei as a code owner March 21, 2024 20:33
@pgherveou pgherveou changed the title Only validate when uploading Contracts: Only validate when uploading Mar 21, 2024
@pgherveou pgherveou changed the title Contracts: Only validate when uploading Contracts: Reuse module when validating Mar 21, 2024
@pgherveou
Copy link
Contributor Author

bot bench substrate-pallet --pallet=pallet_contracts

@command-bot
Copy link

command-bot bot commented Mar 21, 2024

@pgherveou https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5610229 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts. 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 24-8d3b1b3d-6bbb-42cc-b673-474c0d48b657 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Mar 21, 2024

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

@pgherveou
Copy link
Contributor Author

bot bench substrate-pallet --pallet=pallet_contracts

@command-bot
Copy link

command-bot bot commented Mar 21, 2024

@pgherveou https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5610548 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts. 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 25-16d57403-e6b7-4490-b596-27c5f7b26aef to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Mar 21, 2024

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

@pgherveou pgherveou force-pushed the pg/only-validate-when-uploading branch from b345605 to 94fe749 Compare March 22, 2024 08:41
@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: cargo-clippy
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5613501

Copy link
Member

@xermicus xermicus left a comment

Choose a reason for hiding this comment

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

My only concern is that if there was a bug in the validation logic when the contract was uploaded and validated. Now this bug gets fixed and would reject the contract code. Are we fine with this?

@pgherveou
Copy link
Contributor Author

My only concern is that if there was a bug in the validation logic when the contract was uploaded and validated. Now this bug gets fixed and would reject the contract code. Are we fine with this?

I think so, Note that even though it's laying up the ground work for Module:new_unchecked, it's not even using it here (since it's not available in the current wasmi version). This mainly fix an issue where we were wasting time loading the module twice when validating.

@pgherveou pgherveou requested a review from Robbepop March 22, 2024 09:01
@Robbepop
Copy link
Contributor

My only concern is that if there was a bug in the validation logic when the contract was uploaded and validated. Now this bug gets fixed and would reject the contract code. Are we fine with this?

This argument could be applied to every caching logic. What we could do is to provide a mechanism for chain users to off-chain scan for invalid uploaded contracts and contest them, initiating a validation and if they no longer validate the user is getting a reward, otherwise is punished.

Copy link
Member

@athei athei left a comment

Choose a reason for hiding this comment

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

My only concern is that if there was a bug in the validation logic when the contract was uploaded and validated. Now this bug gets fixed and would reject the contract code. Are we fine with this?

This is already the case right now. If it gives us any performance benefit we will start skipping validation in a later PR as @pgherveou pointed out.

@pgherveou
Copy link
Contributor Author

bot bench substrate-pallet --pallet=pallet_contracts

@command-bot
Copy link

command-bot bot commented Apr 10, 2024

@pgherveou "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts (https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5863083) was cancelled in #3789 (comment)

@pgherveou
Copy link
Contributor Author

bot cancel 2-69da3527-bbc9-406f-95d6-bb76aec58651

@command-bot
Copy link

command-bot bot commented Apr 10, 2024

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

@pgherveou pgherveou changed the base branch from master to pg/bench_tweaks April 10, 2024 13:08
@paritytech-review-bot paritytech-review-bot bot requested a review from a team April 10, 2024 13:08
@pgherveou pgherveou force-pushed the pg/only-validate-when-uploading branch from 5f8ef47 to 242f018 Compare April 10, 2024 13:10
@pgherveou pgherveou changed the base branch from pg/bench_tweaks to master April 10, 2024 13:10
@pgherveou
Copy link
Contributor Author

bot bench substrate-pallet --pallet=pallet_contracts

@command-bot
Copy link

command-bot bot commented Apr 10, 2024

@pgherveou https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5865293 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts. 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 3-140e9fb7-e28a-4723-aba2-337b507240d6 to cancel this command or bot cancel to cancel all commands in this pull request.

@pgherveou pgherveou added the T7-smart_contracts This PR/Issue is related to smart contracts. label Apr 10, 2024
@pgherveou pgherveou added this pull request to the merge queue Apr 10, 2024
@command-bot
Copy link

command-bot bot commented Apr 10, 2024

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

@pgherveou pgherveou removed this pull request from the merge queue due to a manual request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T7-smart_contracts This PR/Issue is related to smart contracts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants