-
Notifications
You must be signed in to change notification settings - Fork 690
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
Add initial version of pallet_revive
#5293
Conversation
pallet_contracts
pallet_revive
This pull request has been mentioned on Polkadot Forum. There might be relevant details there: https://forum.polkadot.network/t/contracts-on-assethub-roadmap/9513/1 |
Will YUL contracts be able to call (Wasm) ink! ones (and vice versa)? |
Building cross calling capabilities between a But if you are making changes you can deploy the modified ink! contract to The best way forward is to say: Contracts on So I expect the next major ink! version to:
This will make sure that we can all play together nicely. Of course ink! could keep its native ABI as an option for ink! to ink! calls. I am unsure if it is worth the effort though. |
In the forum post, you mention that |
The latter. For simplicity reasons we will fix all types to be whatever EVM expects. There will be no environment configuration anymore and contracts will just work on any chain without knowing which types the runtime uses. Conversion from and to the native type will be done by the runtime. The most important change is that addresses are As for the address type: ink! should just use Those changes are not implemented, yet. The current code still uses native types. |
bot fmt |
@athei https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6957347 was started for your command Comment |
We are migrating the command bot to be a GitHub Action |
@athei Command |
Thanks for the answer. So, is signing via Metamask / EVM compatible wallets necessary to interact with an ink! contract deployed on revive? Or will it map from a Polkadot-wallet to an |
We will have mappings. It is also possible to call a contract with an The main problem is to how use |
@athei just to clarify because you say these types will be "fixed". Will the account id type and the block number be configurable in the runtime? So, if a different parachain wanted to have pallet-revive with |
No it will not be configurable. The reason is that it makes it much easier for the contract to be portable between chains. From the point of the contract it is always the widest type (u256) at the syscall interface. The runtime then does the conversion and errors out in case of an overflow. And I don't think any chain wants to configure the account id differently as this would make running Solidity contracts impossible. In my opinion the way forward is to have Solidity and ink! contracts be fully interoperable. Please keep in mind that existing chains that use AccountId32 will work with this new pallet. |
The CI pipeline was cancelled due to failure one of the required jobs. |
bot fmt |
@athei https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7091630 was started for your command Comment |
@athei Command |
* master: (36 commits) Bump the ci_dependencies group across 1 directory with 2 updates (#5401) Remove deprecated calls in cumulus-parachain-system (#5439) Make the PR template a default for new PRs (#5462) Only log the propagating transactions when they are not empty (#5424) [CI] Fix SemVer check base commit (#5361) Sync status refactoring (#5450) Add build options to the srtool build step (#4956) `MaybeConsideration` extension trait for `Consideration` (#5384) Skip slot before creating inherent data providers during major sync (#5344) Add symlinks for code of conduct and contribution guidelines (#5447) pallet-collator-selection: correctly register weight in `new_session` (#5430) Derive `Clone` on `EncodableOpaqueLeaf` (#5442) Moving `Find FAIL-CI` check to GHA (#5377) Remove panic, as proof is invalid. (#5427) Reactive syncing metrics (#5410) [bridges] Prune messages from confirmation tx body, not from the on_idle (#5006) Change the chain to Rococo in the parachain template Zombienet config (#5279) Improve the appearance of crates on `crates.io` (#5243) Add initial version of `pallet_revive` (#5293) Update OpenZeppelin template documentation (#5398) ...
This is a heavily modified and stripped down version of
pallet_contracts
. We decided to fork instead of extend the old pallet. Reasons for that are:The code is reviewable but can't be merged because it depends on an unreleased version of PolkaVM via git.
Current state
All tests are passing and the code is not quick and dirty but written to last. The work is not finished, though. It is included in the
kitchensink-runtime
and a node can be built. However, we merge early in order to be able to start testing other components as early as possible.Outstanding changes are tracked here and will be merged separately: #5308
Syscall Interface
The syscall interface is best explored by generating the docs of this crate and looking at the
SyscallDoc
trait. Arguments are passed in registers a0-a5 in the order they are listed. If there are more than 6 arguments (call, instantiate) a pointer to a packed struct of the arguments is expected as the only argument. I plan to create variants of those syscalls with less arguments specifically for YUL.Functions are just referenced by their name as ASCII within the PolkaVM container. Rather than by a syscall number as it was the case in the last implementation.
Changes vs.
pallet_contracts
The changes are too numerous to list them all here. This is an incomplete list:
Memory
trait as we can't map memory directly on PolkaVM anymoreinstantiate
variant as a replacement for thosunstable
attribute has been replaced by aapi_version
attribute to declare at which version an API became availableapi_version
field on the CodeInfo makes sure that old contracts can't access new APIs (necessary due to lack of static verification.behaviour_version
field to CodeInfo that can used if we need to introduce breaking changes and keep the old behaviour for existing contractsConfig
trait and instead hardcode them