-
Notifications
You must be signed in to change notification settings - Fork 40
feat: revive compatibility with feature flag #500
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR revives compatibility with flags by integrating support for both ink! v6 and ink! v5 smart contracts, using feature flags to conditionally compile code for PolkaVM and Wasm contracts. Key changes include updating conditional compilation attributes across tests, commands, and common modules; revising Cargo.toml dependencies and feature definitions; and altering error messages and comments to reflect the new contract support.
Reviewed Changes
Copilot reviewed 41 out of 41 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/pop-cli/tests/parachain.rs | Added cfg attribute to restrict test execution to parachain feature. |
| crates/pop-cli/tests/contract.rs | Introduced conditional assertions to verify generation of contract artifacts. |
| crates/pop-cli/src/style.rs | Extended cfg attributes to include both PolkaVM and Wasm contracts. |
| crates/pop-cli/src/main.rs | Updated compile_error messages with revised feature flag conditions. |
| crates/pop-cli/src/common/wallet.rs | Modified import block for conditional wallet integration logic. |
| crates/pop-cli/src/common/contracts.rs | Updated binary naming constant usage in check_and_prompt function. |
| crates/pop-cli/src/common/builds.rs | Added cfg attribute to conditionally run tests. |
| crates/pop-cli/src/common/binary.rs | Refactored tests to use the dynamic binary name based on active features. |
| crates/pop-cli/src/commands/up/mod.rs | Replaced deprecated conditional attributes with updated feature flags. |
| crates/pop-cli/src/commands/up/contract.rs | Refactored contract deployment flow to support both contract types. |
| crates/pop-cli/src/commands/call/contract.rs | Adjusted placeholder and validation logic based on feature flags. |
| crates/pop-cli/src/commands/build/mod.rs | Updated feature attributes consistent with new contract flags. |
| crates/pop-cli/Cargo.toml | Modified dependency options and feature definitions for contracts. |
| Cargo.toml | Updated dependencies, added ink! v6 related packages, and refined features. |
Comments suppressed due to low confidence (1)
crates/pop-cli/src/commands/up/contract.rs:330
- It appears that 'map_account' is invoked twice within the contract deployment flow for the polkavm-contracts feature, which may lead to duplicate user prompts. Consider consolidating this call to ensure the account mapping check is performed only once.
map_account(instantiate_exec.opts(), &mut Cli).await?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR revives compatibility with experimental ink! v6 support by introducing new feature flags and conditional configurations for both wasm‑based and PolkaVM smart contracts. Key changes include:
- Updates to conditional compilation attributes and module imports to support the new "wasm‑contracts" and "polkavm‑contracts" features.
- Adjustments to error messages, build scripts, command implementations, and tests to correctly handle dual smart contract backends.
- Revisions to dependency definitions and feature flags in Cargo.toml to isolate ink! v5 and ink! v6 functionality.
Reviewed Changes
Copilot reviewed 41 out of 41 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/pop-cli/tests/parachain.rs | Added feature flag for parachain tests |
| crates/pop-cli/tests/contract.rs | Updated artifact checks to differentiate between wasm and polkavm builds |
| crates/pop-cli/src/style.rs | Expanded conditional attributes for style to support new contract features |
| crates/pop-cli/src/main.rs | Adjusted compile_error and module inclusions for new feature flags |
| crates/pop-cli/src/common/* | Updated imports and conditional imports to support new contract features |
| crates/pop-cli/src/commands/* | Modified command implementations and tests to use the new feature flags |
| crates/pop-cli/Cargo.toml | Revised dependency configurations and feature definitions |
| Cargo.toml | Updated dependency versions and added ink! v6-related dependencies |
Comments suppressed due to low confidence (3)
crates/pop-cli/src/commands/call/contract.rs:266
- [nitpick] Using conditional attributes inline within the placeholder argument may affect readability and maintainability. Consider computing the placeholder string outside the method call (e.g. using an if/else assignment based on feature flags) to improve clarity.
.placeholder(
crates/pop-cli/src/commands/up/contract.rs:330
- It appears that map_account is being called twice in similar contexts. Consider consolidating the account mapping prompt to avoid duplicate prompts or unintended duplicate calls for polkavm-contracts.
map_account(instantiate_exec.opts(), &mut Cli).await?
crates/pop-cli/Cargo.toml:67
- [nitpick] The new feature names 'wasm-contracts' and 'polkavm-contracts' replace the old 'contract' feature; consider updating documentation or using consistent naming (e.g. using 'contracts' consistently) to reduce potential confusion.
default = ["parachain", "telemetry", "wasm-contracts"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not changes from my side.
I was able to instantiate a new contract, build it, deploy it and interact with it.
Tests passed and I wasn't able to spot anything that required addressing.
👌
One comment from my side is that in this PR you mention ink v5 support being potentially deprecated from the CLI. Just a thought, but I would argue that there can be users interested in having v5 compatibility.
|
Blocked until A separate branch Once this is merged, we’ll proceed with generating release |
|
Can the conflicts be resolved here please? |
260c23b to
597451c
Compare
|
I noticed the following: #525 Might not be something to tackle within this PR, but something that needs attention as we roll out the revive compatibility |
5b82d9d to
aeb2662
Compare
0eb9626 to
a43dbc6
Compare
8d7b214 to
1bedee8
Compare
d2db9e3 to
8e2840f
Compare
Daanvdplas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done! Super excited to get this out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
I could deploy and interact with a contract on palle-revive without problems.
Regarding the code changes not much to point out. I've left a pair of comments but I think it is good to go.
|
Can't reply directly to #500 (comment) But there is an issue created to solve that issue: #535 |
This PR introduces support for ink! v6 smart contracts by integrating
pallet-reviveusing feature flags for temporary support of both ink! v6 and ink! v5 smart contracts..This PR continues the work started by Frank, who introduced feature flag support in #491, enabling users to switch between different ink! versions based on their needs. The
pop-contractscrate is split viav5(default) andv6features. Thepop-clicrate is split intowasm-contracts(default) andpolkavm-contractsfeaturesNote for reviewers:
The large number of changes is mostly due to temporary code duplication required to support both contract types. This setup is not permanent, WASM contract support will likely be removed in the coming months. However, since
ink! v6and thepallet_reviveare still in a highly experimental state, they are currently kept behind a feature flag.Installation instructions (from Frank PR)
Default install (wasm contracts):
PolkaVM contracts only:
PolkaVM and parachain support:
[sc-2509]