Skip to content

Commit 385577e

Browse files
committed
Merge remote-tracking branch 'origin/main' into derive-macros
2 parents fe786fd + 670ffab commit 385577e

File tree

24 files changed

+2903
-535
lines changed

24 files changed

+2903
-535
lines changed

Diff for: .github/workflows/linter.yml

+46-30
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env:
1414
RUST_FMT: nightly-2023-04-01
1515
RUST_VERSION: "1.73"
1616
RUST_VERSION_TESTING_LIBRARY: "1.73"
17-
CARGO_CONCORDIUM_VERSION: "3.2.0"
17+
CARGO_CONCORDIUM_VERSION: "3.3.0"
1818

1919
jobs:
2020
rustfmt:
@@ -104,6 +104,33 @@ jobs:
104104
run: |
105105
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features --color=always
106106
107+
# Run unit-tests for concordium-std compiled to wasm using cargo concordium test.
108+
std-internal-wasm-test:
109+
name: concordium-std internal wasm tests
110+
runs-on: ubuntu-latest
111+
112+
steps:
113+
- name: Checkout sources
114+
uses: actions/checkout@v3
115+
with:
116+
submodules: recursive
117+
118+
- name: Install toolchain
119+
uses: actions-rs/toolchain@v1
120+
with:
121+
toolchain: ${{ env.RUST_VERSION }}
122+
123+
- name: Install Wasm target
124+
run: rustup target install wasm32-unknown-unknown
125+
126+
- name: Run internal wasm unit test
127+
working-directory: concordium-std
128+
run: |
129+
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
130+
chmod +x /tmp/cargo-concordium
131+
sudo mv /tmp/cargo-concordium /usr/bin/cargo-concordium
132+
cargo concordium test --only-unit-tests -- --features internal-wasm-test
133+
107134
# All templates are generated with the `cargo-generate` command and it is checked that the 'cargo test' command
108135
# can be executed without errors on the generated smart contracts.
109136
cargo-generate-templates:
@@ -146,10 +173,9 @@ jobs:
146173
# Run all tests, including doc tests.
147174
- name: Run cargo test
148175
run: |
149-
CARGO_CCD=cargo-concordium_${{ env.CARGO_CONCORDIUM_VERSION }}
150-
wget https://distribution.concordium.software/tools/linux/$CARGO_CCD
151-
chmod +x $CARGO_CCD
152-
sudo mv $CARGO_CCD /usr/bin/cargo-concordium
176+
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
177+
chmod +x /tmp/cargo-concordium
178+
sudo mv /tmp/cargo-concordium /usr/bin/cargo-concordium
153179
mv $PROJECT_NAME ${{ runner.temp }}/
154180
cd ${{ runner.temp }}/$PROJECT_NAME
155181
cargo concordium test --out "./concordium-out/module.wasm.v1"
@@ -196,10 +222,9 @@ jobs:
196222
# Run all tests, including doc tests.
197223
- name: Run cargo test
198224
run: |
199-
CARGO_CCD=cargo-concordium_${{ env.CARGO_CONCORDIUM_VERSION }}
200-
wget https://distribution.concordium.software/tools/linux/$CARGO_CCD
201-
chmod +x $CARGO_CCD
202-
sudo mv $CARGO_CCD /usr/bin/cargo-concordium
225+
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
226+
chmod +x /tmp/cargo-concordium
227+
sudo mv /tmp/cargo-concordium /usr/bin/cargo-concordium
203228
mv $PROJECT_NAME ${{ runner.temp }}/
204229
cd ${{ runner.temp }}/$PROJECT_NAME
205230
cargo concordium test --out "./concordium-out/module.wasm.v1"
@@ -563,18 +588,9 @@ jobs:
563588
args: --manifest-path ${{ matrix.lib-crates }} --target=${{ matrix.target }} --features=${{ matrix.features }} -- -D warnings
564589

565590
check-std-no-std:
566-
name: Build on nightly,
591+
name: Build no-std on nightly,
567592
runs-on: ubuntu-latest
568593
needs: rustfmt
569-
strategy:
570-
matrix:
571-
target:
572-
- wasm32-unknown-unknown
573-
574-
crates:
575-
- concordium-std/Cargo.toml
576-
- concordium-cis2/Cargo.toml
577-
578594
steps:
579595
- name: Checkout sources
580596
uses: actions/checkout@v2
@@ -586,14 +602,16 @@ jobs:
586602
with:
587603
profile: minimal
588604
toolchain: nightly
589-
target: ${{ matrix.target }}
605+
target: wasm32-unknown-unknown
590606
override: true
591607

592-
- name: Run cargo check with no-std
593-
uses: actions-rs/cargo@v1
594-
with:
595-
command: build
596-
args: --manifest-path ${{ matrix.crates }} --target=${{ matrix.target }} --no-default-features
608+
- name: Run no-std build concordium-std
609+
working-directory: concordium-std
610+
run: cargo build --target wasm32-unknown-unknown --no-default-features --features bump_alloc
611+
612+
- name: Run no-std build concordium-cis2
613+
working-directory: concordium-cis2
614+
run: cargo build --target wasm32-unknown-unknown --no-default-features --features concordium-std/bump_alloc
597615

598616
check-no-std-examples:
599617
name: Build on nightly,
@@ -867,11 +885,9 @@ jobs:
867885

868886
- name: Download and install Cargo Concordium
869887
run: |
870-
CARGO_CCD=cargo-concordium_${{ env.CARGO_CONCORDIUM_VERSION }}
871-
wget https://distribution.concordium.software/tools/linux/$CARGO_CCD
872-
chmod +x $CARGO_CCD
873-
sudo mv $CARGO_CCD /usr/bin/cargo-concordium
874-
888+
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
889+
chmod +x /tmp/cargo-concordium
890+
sudo mv /tmp/cargo-concordium /usr/bin/cargo-concordium
875891
# The 'smart-contract-upgrade' example has a v1 and v2 contract and the tests in v1 needs the wasm module from v2 for upgrading.
876892
- name: Build contract-upgrade version 2 module if needed
877893
if: ${{ matrix.crates == 'examples/smart-contract-upgrade/contract-version1' }}

Diff for: concordium-std/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
via the `HasHost::contract_module_reference` and `HasHost::contract_name` functions.
99
These are only available from protocol version 7, and as such are guarded by the
1010
`p7` feature flag.
11+
- Add two ordered collections: `StateBTreeMap` and `StateBTreeSet`. These are based on [B-Tree](https://en.wikipedia.org/wiki/B-tree), but where each node is stored in the low-level smart contract key-value store. Use one of these when needing operations related to the ordering of the keys, such as `higher(k)` providing the smallest key in collection which is stricly greater than `k`.
1112

1213
## concordium-std 10.0.0 (2024-02-22)
1314

Diff for: concordium-std/Cargo.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ features = ["smart-contract"]
2929
default = ["std"]
3030
std = ["concordium-contracts-common/std"]
3131
wasm-test = ["concordium-contracts-common/wasm-test"]
32+
# Own internal wasm-tests leak out to the smart contracts using this library,
33+
# so a separate feature 'internal-wasm-test' is introduced for these.
34+
internal-wasm-test = ["wasm-test", "concordium-quickcheck"]
3235
build-schema = ["concordium-contracts-common/build-schema"]
3336
crypto-primitives = ["sha2", "sha3", "secp256k1", "ed25519-zebra"]
3437
concordium-quickcheck = ["getrandom", "quickcheck", "concordium-contracts-common/concordium-quickcheck", "std"]
@@ -38,7 +41,8 @@ bump_alloc = []
3841
p7 = []
3942

4043
[lib]
41-
crate-type = ["rlib"]
44+
# cdylib is needed below to compile into a wasm module with internal unit tests.
45+
crate-type = ["cdylib", "rlib"]
4246

4347
[profile.release]
4448
# Tell `rustc` to optimize for small code size.

0 commit comments

Comments
 (0)