feat(contracts)!: experimental support for pallet-revive#479
Merged
Conversation
# Conflicts: # packages/contracts/src/Contract.ts # packages/contracts/src/ContractDeployer.ts # packages/contracts/src/TypinkRegistry.ts # packages/contracts/src/types/index.ts
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces experimental support for pallet‑revive in the contracts module while also updating several example scripts and extensive E2E/unit tests to cover both ink! 6 and legacy ink! 5 deployments. Key changes include:
- Exporting the keyring from examples/scripts/keyring.ts to enable its reuse.
- Adding new scripts and test cases for contract interaction, deployment, events decoding, and error handling across ink‑v6 and ink‑v5.
- Updating TypeScript configurations, utility functions, and CI workflows to support the new pallet‑revive functionality.
Reviewed Changes
Copilot reviewed 84 out of 84 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| examples/scripts/keyring.ts | Exporting keyring to be reused in various demos and tests. |
| examples/scripts/inkv6/storage.ts | Adding storage interaction for deployed contracts via ink‑v6. |
| examples/scripts/inkv6/interact.ts | Demonstrates dry run, deployment, and interaction using pallet‑revive. |
| examples/scripts/inkv6/flipper_v6.json | New contract metadata for ink! 6.0.0‑alpha. |
| examples/scripts/inkv5/lazyvec-storage.ts | Minor removal of inline type annotations for cleaner code. |
| examples/scripts/inkv5/flipper-storage.ts | Updated tx status logging and event output. |
| e2e/contracts/wait-for-port.sh | New shell script to wait for network ports to become available. |
| e2e/contracts/vitest.config.ts | Updated Vitest configuration for the E2E tests. |
| e2e/contracts/tsconfig.json | TypeScript config updated for the contracts project. |
| e2e/contracts/src/utils.ts | Utilities now support deploying both ink! v5 and v6 contracts. |
| e2e/contracts/src/tests/*.test.ts | Expanded and new tests for errors, events, deployer, and contract behavior. |
| e2e/contracts/src/setup.ts | Updated test setup with global clients and account mapping via devPairs. |
| e2e/contracts/src/contracts/flipper_v6.json, flipper_v5.json | Updated contract metadata reflecting the new ink! versions. |
| e2e/contracts/src/contracts/README.md | Added instructions for generating contract types with typink. |
| e2e/contracts/package.json | New workspace configuration for E2E contracts tests. |
| .github/workflows/e2e-contracts-tests.yml | Workflow file to spawn networks and run the updated E2E tests. |
Comments suppressed due to low confidence (2)
examples/scripts/keyring.ts:4
- [nitpick] Consider adding an inline comment explaining that the exported keyring is intended for use in both example scripts and tests to improve code clarity.
export const keyring = new Keyring({ type: 'sr25519' });
e2e/contracts/src/tests/errors.test.ts:49
- [nitpick] Verify that the error thrown by the new pallet‑revive deployment flow matches the expected error type and consider adding additional tests for error cases unique to the revive implementation.
expect(deployer.query.newDefault({ gasLimit: raw.gasRequired, salt })).rejects.toThrowError(ContractInstantiateDispatchError);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces experimental support for pallet-revive while maintaining backward compatibility with pallet-contracts. Both pallet-revive and pallet-contracts interactions will be handled within the same package, dedot/contracts, using a unified interface.
Internally, Dedot will detect the contract version (via metadata) and interact with the appropriate pallet:
To support this update, some breaking changes are introduced to the existing dedot/contracts interfaces:
Unlike pallet-contracts, pallet-revive does not emit an Instantiated event after deployment so we can easily get the contract address. For now, we provide utilities for calculating the contract address post-deployment via CREATE1 and CREATE2 methods. For naming reasons behind these methods can be found here.
This PR addresses tasks listed in #464 for
ink-v6, checklist:ContractDeployerContractCREATE1,CREATE2,toEvmAddress, ...)