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

Target pallet-revive/PolkaVM instead of pallet-contracts/Wasm #1910

Merged
merged 51 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
37273bc
Migrate to `pallet-revive`
cmichi Dec 5, 2024
0dd4258
Bump versions to `6.0.0-alpha`
cmichi Jan 23, 2025
2282898
Add compatibility matrix
cmichi Jan 23, 2025
de38d05
Merge remote-tracking branch 'origin/master' into cmichi-remove-wasm-…
cmichi Jan 23, 2025
d577742
Use Docker image `useink/ci` for CI
cmichi Jan 23, 2025
e56fece
Clean up CI
cmichi Jan 23, 2025
14a7892
Remove `debug-ci`
cmichi Jan 23, 2025
8e9e464
Fix `cargo fmt` in CI
cmichi Jan 23, 2025
b6975f5
Fix CI
cmichi Jan 23, 2025
14b43af
Fix CI
cmichi Jan 23, 2025
073713f
Fix tests
cmichi Jan 23, 2025
4938cce
Reduce code duplication
cmichi Jan 24, 2025
eaab20b
Fix CI
cmichi Jan 24, 2025
ee2fd4f
Fix CI
cmichi Jan 24, 2025
1fa994e
Fix issues with `CARGO_TARGET_DIR`
cmichi Jan 24, 2025
eb9d7c1
Use ink! `master`
cmichi Jan 24, 2025
b37ec20
Remove generic `Hash` where possible
cmichi Jan 24, 2025
c1808e4
Use `polkadot-sdk` compatible deps
cmichi Jan 24, 2025
71d0087
Implement `contract info` + `contract storage`
cmichi Jan 28, 2025
3a7c635
Upgrade to scale `3.1.2`
cmichi Jan 29, 2025
944b9ab
Revert "Upgrade to scale `3.1.2`"
cmichi Jan 29, 2025
bafa291
Fix issue with `parity-scale-codec-derive` dep
cmichi Jan 29, 2025
59a5e4a
Overwrite dep version everywhere
cmichi Jan 29, 2025
3c86c9c
Remove `[replace]`
cmichi Jan 29, 2025
770cb0a
Revert "Remove `[replace]`"
cmichi Jan 29, 2025
9fff4dc
Fix patch
cmichi Jan 29, 2025
1d1bb95
Revert to `scale` 3.6.12
cmichi Jan 30, 2025
d09b759
Update `Cargo.lock`
cmichi Jan 30, 2025
a2407af
Use particular ink! branch
cmichi Jan 30, 2025
42cec69
Use `scale` 3.7.3
cmichi Jan 30, 2025
81058fd
Use `scale` 3.6.2 again
cmichi Jan 30, 2025
ee3c0fb
Use `scale` 3.6.12
cmichi Jan 30, 2025
619856e
Use `ink` branch
cmichi Jan 30, 2025
69d22c9
Use ink! `master`
cmichi Jan 30, 2025
6094f8c
Make clippy happy
cmichi Jan 30, 2025
58a02bf
Apply `cargo fmt`
cmichi Jan 30, 2025
f389879
Add `default-features`
cmichi Jan 30, 2025
dfbbbe8
Fix `contract info` tests
cmichi Jan 31, 2025
bfc62d9
Make clippy happy
cmichi Feb 1, 2025
d53c56d
Add test for adhering to limits
cmichi Feb 2, 2025
75bf4a1
Add `cargo contract account` for resolving H160 addr
cmichi Feb 2, 2025
9548d55
Clean up code
cmichi Feb 2, 2025
532026e
Clean up + update deps
cmichi Feb 2, 2025
d8c2199
Make clippy happy
cmichi Feb 2, 2025
af6064c
Add integration tests
cmichi Feb 2, 2025
526cfbf
Clean up
cmichi Feb 3, 2025
63b8166
Replace WebAssembly/Wasm terms with appropriate PolkaVM ones
cmichi Feb 4, 2025
c772be0
Fix CI
cmichi Feb 4, 2025
1f3bfff
Fix CI
cmichi Feb 4, 2025
592fa49
Fix naming
cmichi Feb 4, 2025
9d58fd0
Fix field names
cmichi Feb 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "daily"
interval: "monthly"
# ignore Substrate pallets major updates.
# automated Substrate releases cause dependabot PR spam, so these must be updated manually when required.
ignore:
Expand Down
195 changes: 80 additions & 115 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: ci

on:
pull_request:
push:
Expand All @@ -9,26 +10,43 @@ on:
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'

env:
# Image can be edited at https://github.com/use-ink/docker-images
IMAGE: useink/ci
CARGO_TARGET_DIR: /ci-cache/${{ github.repository }}/targets/${{ github.ref_name }}/${{ github.job }}

concurrency:
# Cancel in-progress jobs triggered only on pull_requests
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
fmt:
set-image:
# GitHub Actions does not allow using 'env' in a container context.
# This workaround sets the container image for each job using the 'set-image' job output.
runs-on: ubuntu-latest
outputs:
IMAGE: ${{ steps.set_image.outputs.IMAGE }}
steps:
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
default: true
components: rustfmt
- id: set_image
run: echo "IMAGE=${{ env.IMAGE }}" >> $GITHUB_OUTPUT

fmt:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
needs: [set-image]
container:
image: ${{ needs.set-image.outputs.IMAGE }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check Formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --check
run: |
cargo +nightly fmt --all -- --check

# Runs `cargo check` on each individual crate in the `crates` directory.
#
Expand All @@ -48,13 +66,13 @@ jobs:
# `clippy` commands which operate on the workspace and enable all targets.
check:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
needs: [set-image]
container:
image: ${{ needs.set-image.outputs.IMAGE }}
steps:
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable

- name: Cache
uses: Swatinem/rust-cache@v2

Expand All @@ -70,15 +88,13 @@ jobs:

clippy:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
needs: [set-image]
container:
image: ${{ needs.set-image.outputs.IMAGE }}
steps:
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
default: true
components: clippy

- name: Cache
uses: Swatinem/rust-cache@v2

Expand All @@ -96,96 +112,72 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Clippy with features
uses: actions-rs/clippy-check@v1
if: ${{ steps.check_permissions.outputs.has-permission }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --profile debug-ci --all-features --all-targets -- -D warnings
run: cargo +nightly clippy --all-features --all-targets -- -D warnings

- name: Clippy without features
if: ${{ steps.check_permissions.outputs.has-permission }}
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --profile debug-ci --all-targets -- -D warnings
run: cargo +nightly clippy --all-targets -- -D warnings

# Runs if the GITHUB_TOKEN does not have `write` permissions e.g. @dependabot
- name: Clippy with features (no annotations)
if: ${{ !steps.check_permissions.outputs.has-permission }}
run: cargo clippy --profile debug-ci --all-features --all-targets -- -D warnings
run: cargo +nightly clippy --all-features --all-targets -- -D warnings

# Runs if the GITHUB_TOKEN does not have `write` permissions e.g. @dependabot
- name: Clippy without features (no annotations)
if: ${{ !steps.check_permissions.outputs.has-permission }}
run: cargo clippy --profile debug-ci --all-targets -- -D warnings
run: cargo +nightly clippy --all-targets -- -D warnings

build-tests:
strategy:
fail-fast: false
matrix:
# We want newer versions than 'latest' here to have current wasm-opt
os: ["ubuntu-22.04", "macos-15"]
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: full
runs-on: ubuntu-latest
defaults:
run:
shell: bash
needs: [ set-image ]
container:
image: ${{ needs.set-image.outputs.IMAGE }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
default: true
target: wasm32-unknown-unknown
components: rust-src, clippy

- name: Cache
uses: Swatinem/rust-cache@v2

- name: Install nextest
uses: taiki-e/install-action@v2.45.15
uses: taiki-e/install-action@v2.48.1
with:
tool: nextest

- name: Build and archive tests
run: cargo nextest archive --cargo-profile debug-ci --workspace --all-features --archive-file nextest-archive-${{ matrix.os }}.tar.zst
run: cargo nextest archive --workspace --all-features --archive-file nextest-archive-${{ matrix.os }}.tar.zst
- name: Upload archive to workflow
uses: actions/upload-artifact@v4
with:
name: nextest-archive-${{ matrix.os }}
path: nextest-archive-${{ matrix.os }}.tar.zst

run-tests:
needs: build-tests
needs: [ set-image, build-tests ]
runs-on: ubuntu-latest
defaults:
run:
shell: bash
container:
image: ${{ needs.set-image.outputs.IMAGE }}
strategy:
fail-fast: false
matrix:
# We want newer versions than 'latest' here to have current wasm-opt
os: ["ubuntu-22.04", "macos-15"]
partition: [1, 2]
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: full
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
default: true
target: wasm32-unknown-unknown
components: rust-src, clippy

- name: Cache
uses: Swatinem/rust-cache@v2

- name: Install nextest
uses: taiki-e/install-action@v2.45.15
uses: taiki-e/install-action@v2.48.1
with:
tool: nextest

Expand All @@ -202,34 +194,26 @@ jobs:
run: cargo nextest run --archive-file nextest-archive-${{ matrix.os }}.tar.zst --partition count:${{ matrix.partition }}/2 -j 1 -E 'package(contract-build)'

run-integration-test:
needs: build-tests
needs: [ set-image, build-tests ]
runs-on: ubuntu-latest
defaults:
run:
shell: bash
container:
image: ${{ needs.set-image.outputs.IMAGE }}
strategy:
fail-fast: false
matrix:
# We want newer versions than 'latest' here to have current wasm-opt
os: ["ubuntu-22.04", "macos-15"]
partition: [1, 2]
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: full
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
default: true
target: wasm32-unknown-unknown
components: rust-src, clippy

- name: Cache
uses: Swatinem/rust-cache@v2

- name: Install nextest
uses: taiki-e/install-action@v2.45.15
uses: taiki-e/install-action@v2.48.1
with:
tool: nextest

Expand All @@ -238,24 +222,6 @@ jobs:
with:
name: nextest-archive-${{ matrix.os }}

- name: Install latest `substrate-contracts-node` binary
env:
CONTRACTS_NODE_URL: https://github.com/paritytech/substrate-contracts-node/releases/latest/download/substrate-contracts-node-
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
CONTRACTS_NODE_OS=linux
elif [ "$RUNNER_OS" == "macOS" ]; then
CONTRACTS_NODE_OS=mac-universal
else
echo "$RUNNER_OS not supported"
exit 1
fi
curl -L -o substrate-contracts-node.tar.gz "$CONTRACTS_NODE_URL$CONTRACTS_NODE_OS.tar.gz"
tar xfzv substrate-contracts-node.tar.gz
chmod +x substrate-contracts-node-*/substrate-contracts-node &&
mv substrate-contracts-node-*/substrate-contracts-node /usr/local/bin
shell: bash

- name: Run integration tests
# The integration tests cannot be run in parallel
run: cargo nextest run --archive-file nextest-archive-${{ matrix.os }}.tar.zst --partition count:${{ matrix.partition }}/2 -j 1 -E 'test(integration_tests)'
Expand All @@ -264,13 +230,15 @@ jobs:
strategy:
fail-fast: false
matrix:
# We want newer versions than 'latest' here to have current wasm-opt
os: ["ubuntu-22.04", "macos-15", "windows-2022"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cache
uses: Swatinem/rust-cache@v2

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
Expand All @@ -285,19 +253,16 @@ jobs:
default: true
components: rust-src

- name: Cache
uses: Swatinem/rust-cache@v2

- name: Check Template
run: >-
# The linter requires two crates
cargo install cargo-dylint dylint-link
cargo -vV &&
cargo run --profile debug-ci -- contract --version &&
cargo run --profile debug-ci -- contract new --target-dir ${{ runner.temp }} foobar &&
cargo run -- contract --version &&
cargo run -- contract new --target-dir ${{ runner.temp }} foobar &&
# Build with linting
cargo run --profile debug-ci -- contract build --lint --manifest-path=${{ runner.temp }}/foobar/Cargo.toml &&
cargo run --profile debug-ci -- contract check --manifest-path=${{ runner.temp }}/foobar/Cargo.toml &&
cargo run --profile debug-ci -- contract build --manifest-path=${{ runner.temp }}/foobar/Cargo.toml --release &&
cargo run -- contract build --lint --manifest-path=${{ runner.temp }}/foobar/Cargo.toml &&
cargo run -- contract check --manifest-path=${{ runner.temp }}/foobar/Cargo.toml &&
cargo run -- contract build --manifest-path=${{ runner.temp }}/foobar/Cargo.toml --release &&
# Run tests
cargo test --profile debug-ci --all-features -- --test-threads=1
cargo test --all-features -- --test-threads=1
2 changes: 1 addition & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ wrap_comments = true # changed
format_code_in_doc_comments = true # changed
doc_comment_code_block_width = 100 # changed
comment_width = 90 # changed
normalize_comments = true # changed
#normalize_comments = true # changed # todo change back
normalize_doc_attributes = false
format_strings = false
format_macro_matchers = false
Expand Down
Loading
Loading