Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into reduce-costs
Browse files Browse the repository at this point in the history
  • Loading branch information
abizjak committed Apr 15, 2024
2 parents 4500456 + 49d9c78 commit a449570
Show file tree
Hide file tree
Showing 101 changed files with 3,574 additions and 667 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/linter-testing-lib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ on:
- 'contract-testing/**/*.toml'
- 'rustfmt.toml'
- 'concordium-rust-sdk'
- 'concordium-std-derive'

workflow_dispatch: # allows manual trigger

env:
RUST_FMT: nightly-2023-04-01-x86_64-unknown-linux-gnu
RUST_CLIPPY: 1.72
RUST_CLIPPY: 1.73

jobs:
"lint_fmt":
Expand Down
87 changes: 53 additions & 34 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ name: Clippy & fmt

env:
RUST_FMT: nightly-2023-04-01
RUST_VERSION: "1.66"
RUST_VERSION_TESTING_LIBRARY: "1.72"
CARGO_CONCORDIUM_VERSION: "3.2.0"
RUST_VERSION: "1.73"
RUST_VERSION_TESTING_LIBRARY: "1.73"
CARGO_CONCORDIUM_VERSION: "3.3.0"

jobs:
rustfmt:
Expand All @@ -23,6 +23,7 @@ jobs:
strategy:
matrix:
crates:
- concordium-std-derive/Cargo.toml
- concordium-std/Cargo.toml
- concordium-cis2/Cargo.toml
- examples/voting/Cargo.toml
Expand Down Expand Up @@ -103,6 +104,33 @@ jobs:
run: |
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features --color=always
# Run unit-tests for concordium-std compiled to wasm using cargo concordium test.
std-internal-wasm-test:
name: concordium-std internal wasm tests
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: recursive

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}

- name: Install Wasm target
run: rustup target install wasm32-unknown-unknown

- name: Run internal wasm unit test
working-directory: concordium-std
run: |
curl -L https://github.com/Concordium/concordium-smart-contract-tools/releases/download/releases/cargo-concordium/${CARGO_CONCORDIUM_VERSION}/cargo-concordium-linux-amd64 -o /tmp/cargo-concordium
chmod +x /tmp/cargo-concordium
sudo mv /tmp/cargo-concordium /usr/bin/cargo-concordium
cargo concordium test --only-unit-tests -- --features internal-wasm-test
# All templates are generated with the `cargo-generate` command and it is checked that the 'cargo test' command
# can be executed without errors on the generated smart contracts.
cargo-generate-templates:
Expand Down Expand Up @@ -145,10 +173,9 @@ jobs:
# Run all tests, including doc tests.
- name: Run cargo test
run: |
CARGO_CCD=cargo-concordium_${{ env.CARGO_CONCORDIUM_VERSION }}
wget https://distribution.concordium.software/tools/linux/$CARGO_CCD
chmod +x $CARGO_CCD
sudo mv $CARGO_CCD /usr/bin/cargo-concordium
curl -L https://github.com/Concordium/concordium-smart-contract-tools/releases/download/releases/cargo-concordium/${CARGO_CONCORDIUM_VERSION}/cargo-concordium-linux-amd64 -o /tmp/cargo-concordium
chmod +x /tmp/cargo-concordium
sudo mv /tmp/cargo-concordium /usr/bin/cargo-concordium
mv $PROJECT_NAME ${{ runner.temp }}/
cd ${{ runner.temp }}/$PROJECT_NAME
cargo concordium test --out "./concordium-out/module.wasm.v1"
Expand Down Expand Up @@ -195,10 +222,9 @@ jobs:
# Run all tests, including doc tests.
- name: Run cargo test
run: |
CARGO_CCD=cargo-concordium_${{ env.CARGO_CONCORDIUM_VERSION }}
wget https://distribution.concordium.software/tools/linux/$CARGO_CCD
chmod +x $CARGO_CCD
sudo mv $CARGO_CCD /usr/bin/cargo-concordium
curl -L https://github.com/Concordium/concordium-smart-contract-tools/releases/download/releases/cargo-concordium/${CARGO_CONCORDIUM_VERSION}/cargo-concordium-linux-amd64 -o /tmp/cargo-concordium
chmod +x /tmp/cargo-concordium
sudo mv /tmp/cargo-concordium /usr/bin/cargo-concordium
mv $PROJECT_NAME ${{ runner.temp }}/
cd ${{ runner.temp }}/$PROJECT_NAME
cargo concordium test --out "./concordium-out/module.wasm.v1"
Expand Down Expand Up @@ -351,7 +377,8 @@ jobs:
sed -i "s/root/Concordium <[email protected]>/g" ${{ runner.temp }}/$PROJECT_NAME/Cargo.toml
sed -i "s/{version = \"10.0\", default-features = false}/{path = \"..\/..\/concordium-std\", default-features = false}/g" ${{ runner.temp }}/$PROJECT_NAME/Cargo.toml
sed -i "s/{version = \"6.1\", default-features = false}/{path = \"..\/..\/concordium-cis2\", default-features = false}/g" ${{ runner.temp }}/$PROJECT_NAME/Cargo.toml
sed -i "s/concordium-smart-contract-testing = \"4.0\"/concordium-smart-contract-testing = {path = \"..\/..\/contract-testing\"}/g" ${{ runner.temp }}/$PROJECT_NAME/Cargo.toml
sed -i "s/concordium-smart-contract-testing = \"4.2\"/concordium-smart-contract-testing = {path = \"..\/..\/contract-testing\"}/g" ${{ runner.temp }}/$PROJECT_NAME/Cargo.toml
sed -i "s/concordium-std-derive = \"6.0\"/concordium-std-derive = {path = \"..\/..\/concordium-std-derive\"}/g" ${{ runner.temp }}/$PROJECT_NAME/Cargo.toml
diff ${{ runner.temp }}/$PROJECT_NAME/Cargo.toml examples/cis2-nft/Cargo.toml
diff ${{ runner.temp }}/$PROJECT_NAME/src/lib.rs examples/cis2-nft/src/lib.rs
diff ${{ runner.temp }}/$PROJECT_NAME/tests/tests.rs examples/cis2-nft/tests/tests.rs
Expand Down Expand Up @@ -399,7 +426,8 @@ jobs:
sed -i "s/root/Concordium <[email protected]>/g" ${{ runner.temp }}/$PROJECT_NAME/Cargo.toml
sed -i "s/version = \"10.0\", default-features = false/path = \"..\/..\/concordium-std\", version = \"10.0\", default-features = false/g" ${{ runner.temp }}/$PROJECT_NAME/Cargo.toml
sed -i "s/version = \"6.1\", default-features = false/path = \"..\/..\/concordium-cis2\", version = \"6.1\", default-features = false/g" ${{ runner.temp }}/$PROJECT_NAME/Cargo.toml
sed -i "s/concordium-smart-contract-testing = \"4.0\"/concordium-smart-contract-testing = {path = \"..\/..\/contract-testing\"}/g" ${{ runner.temp }}/$PROJECT_NAME/Cargo.toml
sed -i "s/concordium-smart-contract-testing = \"4.2\"/concordium-smart-contract-testing = {path = \"..\/..\/contract-testing\"}/g" ${{ runner.temp }}/$PROJECT_NAME/Cargo.toml
sed -i "s/concordium-std-derive = \"6.0\"/concordium-std-derive = {path = \"..\/..\/concordium-std-derive\"}/g" ${{ runner.temp }}/$PROJECT_NAME/Cargo.toml
diff ${{ runner.temp }}/$PROJECT_NAME/Cargo.toml examples/credential-registry/Cargo.toml
diff ${{ runner.temp }}/$PROJECT_NAME/src/lib.rs examples/credential-registry/src/lib.rs
diff ${{ runner.temp }}/$PROJECT_NAME/tests/tests.rs examples/credential-registry/tests/tests.rs
Expand Down Expand Up @@ -560,18 +588,9 @@ jobs:
args: --manifest-path ${{ matrix.lib-crates }} --target=${{ matrix.target }} --features=${{ matrix.features }} -- -D warnings

check-std-no-std:
name: Build on nightly,
name: Build no-std on nightly,
runs-on: ubuntu-latest
needs: rustfmt
strategy:
matrix:
target:
- wasm32-unknown-unknown

crates:
- concordium-std/Cargo.toml
- concordium-cis2/Cargo.toml

steps:
- name: Checkout sources
uses: actions/checkout@v2
Expand All @@ -583,14 +602,16 @@ jobs:
with:
profile: minimal
toolchain: nightly
target: ${{ matrix.target }}
target: wasm32-unknown-unknown
override: true

- name: Run cargo check with no-std
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ${{ matrix.crates }} --target=${{ matrix.target }} --no-default-features
- name: Run no-std build concordium-std
working-directory: concordium-std
run: cargo build --target wasm32-unknown-unknown --no-default-features --features bump_alloc

- name: Run no-std build concordium-cis2
working-directory: concordium-cis2
run: cargo build --target wasm32-unknown-unknown --no-default-features --features concordium-std/bump_alloc

check-no-std-examples:
name: Build on nightly,
Expand Down Expand Up @@ -864,11 +885,9 @@ jobs:

- name: Download and install Cargo Concordium
run: |
CARGO_CCD=cargo-concordium_${{ env.CARGO_CONCORDIUM_VERSION }}
wget https://distribution.concordium.software/tools/linux/$CARGO_CCD
chmod +x $CARGO_CCD
sudo mv $CARGO_CCD /usr/bin/cargo-concordium
curl -L https://github.com/Concordium/concordium-smart-contract-tools/releases/download/releases/cargo-concordium/${CARGO_CONCORDIUM_VERSION}/cargo-concordium-linux-amd64 -o /tmp/cargo-concordium
chmod +x /tmp/cargo-concordium
sudo mv /tmp/cargo-concordium /usr/bin/cargo-concordium
# The 'smart-contract-upgrade' example has a v1 and v2 contract and the tests in v1 needs the wasm module from v2 for upgrading.
- name: Build contract-upgrade version 2 module if needed
if: ${{ matrix.crates == 'examples/smart-contract-upgrade/contract-version1' }}
Expand Down
2 changes: 2 additions & 0 deletions concordium-cis2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased changes

- Bump MSRV to 1.72

## concordium-cis2 6.1.0 (2024-02-22)

- Support version 10 of concordium-std.
Expand Down
1 change: 1 addition & 0 deletions concordium-cis2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "concordium-cis2"
version = "6.1.0"
authors = ["Concordium <[email protected]>"]
rust-version = "1.73"
edition = "2021"
license = "MPL-2.0"
description = "A collection of types for implementing CIS-2 Concordium Token Standard."
Expand Down
14 changes: 14 additions & 0 deletions concordium-std-derive/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changelog

## Unreleased changes

## concordium-std-derive 6.0.0 (2024-04-04)

- Macros for creating constant values from strings for the following types:
- `AccountAddress`
- `ContractAddress`
- `ModuleReference`
- `PublicKeyEcdsaSecp256k1`
- `PublicKeyEd25519`
- `SignatureEcdsaSecp256k1`
- `SignatureEd25519`
24 changes: 24 additions & 0 deletions concordium-std-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "concordium-std-derive"
authors = ["Concordium <[email protected]>"]
version = "6.0.0"
edition = "2021"
rust-version = "1.73"
license = "MPL-2.0"
description = "Procedural macros to generate concordium type constants from strings, that makes writing smart contracts on the Concordium blockchain easier."
homepage = "https://github.com/Concordium/concordium-rust-smart-contracts/"
repository = "https://github.com/Concordium/concordium-rust-smart-contracts/"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
proc-macro = true

[dependencies]
concordium-contracts-common = { path = "../concordium-rust-sdk/concordium-base/smart-contracts/contracts-common/concordium-contracts-common", features = [ "derive-serde" ], version = "9" }
syn = "2.0"
proc-macro2 = "1.0"
quote = "1.0"

[dev-dependencies]
trybuild = "1.0"

Loading

0 comments on commit a449570

Please sign in to comment.