Skip to content

Commit

Permalink
Update to ink! 5 (#298)
Browse files Browse the repository at this point in the history
* Rename constructor from default to new
* Add unit tests
* Update to 5.0.0-rc.1
  • Loading branch information
smiasojed authored Feb 23, 2024
1 parent e6ae3f1 commit cda614e
Show file tree
Hide file tree
Showing 10 changed files with 7,075 additions and 507 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ updates:
- package-ecosystem: npm
directory: "/frontend"
schedule:
interval: "daily"
interval: "daily"
allow:
-dependency-type: "production"
- dependency-type: "production"
ignore:
- dependency-name: "*"
update-types:
Expand Down
21 changes: 8 additions & 13 deletions .github/workflows/clippy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,18 @@ jobs:
working-directory: contract
steps:
- name: Install Rust nightly toolchain
uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # v1.0.7
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: stable
target: wasm32-unknown-unknown
override: true
components: clippy

- name: Cache Dependencies & Build Outputs
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- uses: actions/checkout@v4

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

- name: Run clippy
shell: bash
run: cargo +nightly clippy --verbose --no-default-features --target wasm32-unknown-unknown -- -D warnings
run: cargo clippy --verbose --no-default-features --target wasm32-unknown-unknown -- -D warnings
28 changes: 10 additions & 18 deletions .github/workflows/contract-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,30 @@ jobs:
working-directory: contract
steps:
- name: Install Rust toolchain
uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # v1.0.7
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Install Rust nightly toolchain
uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # v1.0.7
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: stable
override: true

- name: Cache Dependencies & Build Outputs
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/checkout@v4

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

- name: Install cargo-contract
uses: baptiste0928/cargo-install@bf6758885262d0e6f61089a9d8c8790d3ac3368f #v1.3.0
uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941 # v2.2.0
with:
crate: cargo-contract
version: "2.0.0-rc"
version: "4.0.0-rc.1"

- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Run contract check
shell: bash
run: |
cargo add ink_env --git https://github.com/paritytech/ink --tag v3.4.0
cargo +nightly add ink_env --git https://github.com/paritytech/ink --tag v3.4.0
cargo +nightly contract check
cargo contract check
22 changes: 8 additions & 14 deletions .github/workflows/fmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,17 @@ jobs:
working-directory: contract
steps:
- name: Install Rust toolchain
uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # v1.0.7
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
toolchain: nightly
override: true
components: rustfmt

- name: Cache Dependencies & Build Outputs
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/checkout@v4

- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Cache
uses: Swatinem/rust-cache@v2

- name: Run spellcheck
shell: bash
run: cargo fmt --verbose -- --check
- name: Run fmt
run: cargo +nightly fmt --verbose -- --check
10 changes: 5 additions & 5 deletions .github/workflows/spellcheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
matrix:
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
env:
RUSTC_WRAPPER: ""
defaults:
run:
working-directory: contract
container:
image: "paritytech/ink-waterfall-ci:latest"
image: "paritytech/ci-unified:bullseye-1.75.0"
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- uses: actions/checkout@v4
- name: Run spellcheck
shell: bash
run: |
cd ./contract
cargo spellcheck check -vvvv --cfg=.config/cargo_spellcheck.toml --checkers hunspell --code 1
23 changes: 6 additions & 17 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,14 @@ jobs:
defaults:
run:
working-directory: contract
container:
image: "paritytech/ci-unified:bullseye-1.75.0"
steps:
- name: Install Rust toolchain
uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # v1.0.7
with:
profile: minimal
toolchain: stable
override: true
- uses: actions/checkout@v4

- name: Cache Dependencies & Build Outputs
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Cache
uses: Swatinem/rust-cache@v2

- name: Run test
shell: bash
run: cargo test --verbose
run: cargo test --all-features --verbose
5 changes: 1 addition & 4 deletions contract/.rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ format_code_in_doc_comments = false
comment_width = 80
normalize_comments = true # changed
normalize_doc_attributes = false
license_template_path = "FILE_HEADER" # changed
format_strings = false
format_macro_matchers = false
format_macro_bodies = true
Expand All @@ -35,7 +34,7 @@ struct_field_align_threshold = 0
enum_discrim_align_threshold = 0
match_arm_blocks = true
force_multiline_blocks = true # changed
fn_args_layout = "Tall"
fn_params_layout = "Tall"
brace_style = "SameLineWhere"
control_brace_style = "AlwaysSameLine"
trailing_semicolon = false # changed
Expand All @@ -57,8 +56,6 @@ skip_children = false
hide_parse_errors = false
error_on_line_overflow = false
error_on_unformatted = false
report_todo = "Always"
report_fixme = "Always"
ignore = []

# Below are `rustfmt` internal settings
Expand Down
Loading

0 comments on commit cda614e

Please sign in to comment.