Skip to content

feat(contracts)!: experimental support for pallet-revive#479

Merged
sinzii merged 68 commits intomainfrom
feat/pallet-revive-integration
Jun 6, 2025
Merged

feat(contracts)!: experimental support for pallet-revive#479
sinzii merged 68 commits intomainfrom
feat/pallet-revive-integration

Conversation

@1cedrus
Copy link
Copy Markdown
Member

@1cedrus 1cedrus commented Jun 1, 2025

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:

  • Contract v4 and v5 → pallet-contracts
  • Contract v6 → pallet-revive

To support this update, some breaking changes are introduced to the existing dedot/contracts interfaces:

  • Contract and ContractDeployer now accept a simple string or hex as the address. The format will be validated based on the contract version.
  • Sending contract transactions via pallet-revive now requires both a gasLimit and a storageDepositLimit, which can be estimated using a dry run.

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:

  • Dry run and deploy contract via ContractDeployer
  • Dry run and call messages via Contract
  • Utils for creating contract address (CREATE1, CREATE2, toEvmAddress, ...)
  • Storage API
  • Decoding events
  • Error handling
  • E2E tests
  • Unit tests

@sinzii sinzii changed the base branch from alpha to main June 2, 2025 09:09
@1cedrus 1cedrus requested a review from Copilot June 2, 2025 15:20

This comment was marked as outdated.

@1cedrus 1cedrus requested review from Copilot and removed request for Copilot June 4, 2025 14:39
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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);

Comment thread e2e/contracts/src/setup.ts
@1cedrus 1cedrus requested a review from sinzii June 4, 2025 14:41
@sinzii sinzii merged commit 26ac33a into main Jun 6, 2025
4 checks passed
@sinzii sinzii deleted the feat/pallet-revive-integration branch June 6, 2025 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants