Skip to content

Commit 5ec034c

Browse files
authored
Update CI (#2280)
* Update `ci-unified` to 1.81 * Fix `clippy` errors * Upgrade linting libraries * Add `rustc` components in toolchain version * Change to nightly toolchain of last stable * Update `clippy-utils` version * Fix `clippy` errors * Update dylint dependent versions * Update code to newer `rustc` * Apply `cargo fmt` * Apply `cargo fmt` * Follow `clippy` recommendations * Update test fixtures * Update test fixtures * Follow `clippy` recommendations * Apply `clippy` recommendations * Work around Rust' changes to `cfg` * Apply `cargo fmt` * Allow dead code * Apply `clippy` recommendations * Apply `clippy` recommendations * Add default impl * Apply `clippy` recommendations * Apply `cargo fmt` * Update test fixtures * Add `try-runtime` feature * Output more version info * Update test fixtures * Revert me: Install `cargo-contract` `master` * Add explainer comment for custom `cargo-contract` installation * Add clarification comment * Complete check for storage struct * Add clarification comments * Fix typo * Fix spellcheck
1 parent 0cd2b89 commit 5ec034c

File tree

56 files changed

+788
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+788
-347
lines changed

.github/rust-info/action.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,15 @@ runs:
1010
cargo +nightly --version
1111
cargo spellcheck --version
1212
bash --version
13+
substrate-contracts-node --version
14+
15+
# TODO: The installation of `cargo-contract` here can be removed after
16+
# a new image of https://hub.docker.com/r/paritytech/ci-unified/tags has
17+
# been published. At the time of this commit the Docker image is from
18+
# Sep 11, 2024. This means that the `cargo-contract` binary in the image
19+
# is also that old. There was a bug with `cargo-contract` erring on
20+
# newer Rust versions (https://github.com/use-ink/cargo-contract/pull/1786),
21+
# hence we make sure to use the latest `cargo-contract` here.
22+
cargo install --git https://github.com/paritytech/cargo-contract --locked --branch master --force
23+
cargo-contract --version
1324
shell: bash

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ on:
2626
- 'FILE_HEADER'
2727

2828
env:
29-
IMAGE: paritytech/ci-unified:bullseye-1.75.0
29+
IMAGE: paritytech/ci-unified:bullseye-1.81.0
3030
CARGO_TARGET_DIR: /ci-cache/${{ github.repository }}/targets/${{ github.ref_name }}/${{ github.job }}
3131
CARGO_INCREMENTAL: 0
3232
PURELY_STD_CRATES: ink/codegen metadata engine e2e e2e/macro ink/ir
@@ -270,6 +270,7 @@ jobs:
270270
# we are using a toolchain file in this directory
271271
# add required components for CI
272272
rustup component add rustfmt clippy
273+
rustup component add rust-src rustc-dev llvm-tools-preview
273274
cargo check --verbose
274275
cargo +nightly fmt --all -- --check
275276
cargo clippy -- -D warnings;
@@ -504,7 +505,7 @@ jobs:
504505
env:
505506
# Fix linking of `linkme`: https://github.com/dtolnay/linkme/issues/49
506507
RUSTFLAGS: -Clink-arg=-z -Clink-arg=nostart-stop-gc
507-
uses: docker://paritytech/ci-unified:bullseye-1.75.0
508+
uses: docker://paritytech/ci-unified:bullseye-1.81.0
508509
with:
509510
# run all tests with --all-features, which will run the e2e-tests feature if present
510511
args: /bin/bash -c "scripts/for_all_contracts_exec.sh --path integration-tests --ignore public/static-buffer --partition ${{ matrix.partition }}/6 -- cargo test \

.github/workflows/measurements.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
run:
1515
shell: bash
1616
container:
17-
image: paritytech/ci-unified:bullseye-1.75.0
17+
image: paritytech/ci-unified:bullseye-1.81.0
1818
strategy:
1919
fail-fast: false
2020
matrix:

Cargo.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ blake2 = { version = "0.10" }
3939
cargo_metadata = { version = "0.18.0" }
4040
cfg-if = { version = "1.0" }
4141
contract-build = { version = "4.1.1" }
42-
darling = { version = "0.20.8" }
42+
darling = { version = "0.20.10" }
4343
derive_more = { version = "0.99.17", default-features = false }
4444
either = { version = "1.12", default-features = false }
4545
funty = { version = "2.0.0" }

crates/allocator/src/bump.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,9 @@ impl InnerAlloc {
199199
/// of a layout in the linear memory.
200200
/// - Initially `self.next` is `0`` and aligned
201201
/// - `layout.align() - 1` accounts for `0` as the first index.
202-
/// - the binary with the inverse of the align creates a
203-
/// bitmask that is used to zero out bits, ensuring alignment according to type
204-
/// requirements and ensures that the next allocated pointer address is of the
205-
/// power of 2.
202+
/// - the binary with the inverse of the align creates a bitmask that is used to zero
203+
/// out bits, ensuring alignment according to type requirements and ensures that the
204+
/// next allocated pointer address is of the power of 2.
206205
fn align_ptr(&self, layout: &Layout) -> usize {
207206
(self.next + layout.align() - 1) & !(layout.align() - 1)
208207
}

crates/e2e/src/error.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ pub struct SandboxErr {
7979

8080
impl SandboxErr {
8181
/// Create a new `SandboxErr` with the given message.
82+
#[allow(dead_code)]
8283
pub fn new(msg: String) -> Self {
8384
Self { msg }
8485
}

crates/e2e/src/xts.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,11 @@ where
333333
})
334334
.submit_and_watch()
335335
.await
336-
.map(|tx_progress| {
336+
.inspect(|tx_progress| {
337337
log_info(&format!(
338338
"signed and submitted tx with hash {:?}",
339339
tx_progress.extrinsic_hash()
340340
));
341-
tx_progress
342341
})
343342
.unwrap_or_else(|err| {
344343
panic!("error on call `submit_and_watch`: {err:?}");

crates/engine/src/database.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl Database {
7070
key: &[u8],
7171
) -> Option<&Vec<u8>> {
7272
let hashed_key = storage_of_contract_key(account_id, key);
73-
self.hmap.get(&hashed_key.to_vec())
73+
self.hmap.get(hashed_key.as_slice())
7474
}
7575

7676
/// Inserts `value` into the contract storage of `account_id` at storage key `key`.
@@ -91,7 +91,7 @@ impl Database {
9191
key: &[u8],
9292
) -> Option<Vec<u8>> {
9393
let hashed_key = storage_of_contract_key(account_id, key);
94-
self.hmap.remove(&hashed_key.to_vec())
94+
self.hmap.remove(hashed_key.as_slice())
9595
}
9696

9797
/// Removes a key from the storage, returning the value at the key if the key

crates/env/src/arithmetic.rs

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ impl<T> AtLeast32BitUnsigned for T where T: AtLeast32Bit + Unsigned {}
136136

137137
/// Saturating arithmetic operations, returning maximum or minimum values instead of
138138
/// overflowing.
139+
#[allow(dead_code)]
139140
pub trait Saturating {
140141
/// Saturating addition. Compute `self + rhs`, saturating at the numeric bounds
141142
/// instead of overflowing.
@@ -194,53 +195,26 @@ mod tests {
194195

195196
#[test]
196197
fn saturating_add() {
197-
assert_eq!(
198-
u64::max_value(),
199-
Saturating::saturating_add(u64::max_value(), 1)
200-
)
198+
assert_eq!(u64::MAX, Saturating::saturating_add(u64::MAX, 1))
201199
}
202200

203201
#[test]
204202
fn saturatiung_sub() {
205-
assert_eq!(
206-
u64::min_value(),
207-
Saturating::saturating_sub(u64::min_value(), 1)
208-
)
203+
assert_eq!(u64::MIN, Saturating::saturating_sub(u64::MIN, 1))
209204
}
210205

211206
#[test]
212207
fn saturating_mul() {
213-
assert_eq!(
214-
u64::max_value(),
215-
Saturating::saturating_mul(u64::max_value(), 2)
216-
);
217-
assert_eq!(
218-
i64::max_value(),
219-
Saturating::saturating_mul(i64::max_value(), 2)
220-
);
221-
assert_eq!(
222-
i64::min_value(),
223-
Saturating::saturating_mul(i64::min_value(), 2)
224-
);
225-
assert_eq!(
226-
i64::min_value(),
227-
Saturating::saturating_mul(2, i64::min_value())
228-
);
208+
assert_eq!(u64::MAX, Saturating::saturating_mul(u64::MAX, 2));
209+
assert_eq!(i64::MAX, Saturating::saturating_mul(i64::MAX, 2));
210+
assert_eq!(i64::MIN, Saturating::saturating_mul(i64::MIN, 2));
211+
assert_eq!(i64::MIN, Saturating::saturating_mul(2, i64::MIN));
229212
}
230213

231214
#[test]
232215
fn saturating_pow() {
233-
assert_eq!(
234-
u64::max_value(),
235-
Saturating::saturating_pow(u64::max_value(), 2)
236-
);
237-
assert_eq!(
238-
i64::max_value(),
239-
Saturating::saturating_pow(i64::min_value(), 2)
240-
);
241-
assert_eq!(
242-
i64::min_value(),
243-
Saturating::saturating_pow(i64::min_value(), 3)
244-
);
216+
assert_eq!(u64::MAX, Saturating::saturating_pow(u64::MAX, 2));
217+
assert_eq!(i64::MAX, Saturating::saturating_pow(i64::MIN, 2));
218+
assert_eq!(i64::MIN, Saturating::saturating_pow(i64::MIN, 3));
245219
}
246220
}

0 commit comments

Comments
 (0)