Skip to content

Commit 7bab70b

Browse files
0xVolosnikovclaude
andcommitted
chore(ci): bump the pinned nightly to 2026-08-09
`RUST_NIGHTLY_VERSION` drives every job in `ci.yml` — build, clippy, fmt, tests, doc tests and the AFL fuzzer — not just the doc build its comment claimed. It had drifted six months behind the toolchain the downstream consumers of this crate build on, so vm2 was never exercised on the compiler its users actually use. The crate already builds on the new nightly; only clippy failed, on eight pedantic findings in five files: - `chunks_exact_to_as_chunks` in `Program::new` — `as_chunks::<8>()` / `as_chunks::<32>()`. The 8-byte case also drops a `try_into().unwrap()`, which in turn makes the `#[allow(clippy::missing_panics_doc)]` on that function stale, so it goes too (verified: clippy is clean without it). - `redundant_else` in `encode_static_gas_cost` — folded the diverging `if`/`else` into an `assert!`. Written as `assert!` rather than a bare `if ... panic!` because the latter trips `manual_assert`, also pedantic. - `assert_is_empty` (2), `manual_assert_eq` (1) and `unnecessary_trailing_comma` (2) in test and mock code. No behaviour change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 8eab448 commit 7bab70b

6 files changed

Lines changed: 20 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ on:
1010

1111
env:
1212
CARGO_TERM_COLOR: always
13-
# Nightly Rust necessary for building docs.
14-
RUST_NIGHTLY_VERSION: nightly-2026-02-10
13+
# Pinned nightly used by every job below (build, clippy, fmt, tests, docs,
14+
# fuzzing), not just the doc build. Kept in step with the toolchain the
15+
# downstream consumers of this crate build on.
16+
RUST_NIGHTLY_VERSION: nightly-2026-08-09
1517

1618
concurrency:
1719
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

crates/vm2/src/addressing_modes.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,8 @@ impl Arguments {
139139
INVALID_INSTRUCTION_COST => 4,
140140
1..=4 => panic!("Reserved gas cost values overlap with actual gas costs"),
141141
x => {
142-
if x > u8::MAX as u32 {
143-
panic!("Gas cost doesn't fit into 8 bits");
144-
} else {
145-
x as u8
146-
}
142+
assert!(x <= u8::MAX as u32, "Gas cost doesn't fit into 8 bits");
143+
x as u8
147144
}
148145
}
149146
}

crates/vm2/src/program.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,20 @@ impl<T, W> fmt::Debug for Program<T, W> {
5353

5454
impl<T: Tracer, W: World<T>> Program<T, W> {
5555
/// Creates a new program.
56-
#[allow(clippy::missing_panics_doc)] // false positive
5756
pub fn new(bytecode: &[u8], enable_hooks: bool) -> Self {
57+
let (words, _) = bytecode.as_chunks::<8>();
5858
let instructions = decode_program(
59-
&bytecode
60-
.chunks_exact(8)
61-
.map(|chunk| u64::from_be_bytes(chunk.try_into().unwrap()))
59+
&words
60+
.iter()
61+
.copied()
62+
.map(u64::from_be_bytes)
6263
.collect::<Vec<_>>(),
6364
enable_hooks,
6465
);
65-
let code_page = bytecode
66-
.chunks_exact(32)
67-
.map(U256::from_big_endian)
66+
let (cells, _) = bytecode.as_chunks::<32>();
67+
let code_page = cells
68+
.iter()
69+
.map(|cell| U256::from_big_endian(cell))
6870
.collect::<Vec<_>>();
6971
Self {
7072
instructions: instructions.into(),

crates/vm2/src/single_instruction_test/print_mock_info.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ impl<T: Tracer, W: World<T>> State<T, W> {
3939
impl<T, W> Callframe<T, W> {
4040
pub(crate) fn print_mock_info(&self) {
4141
if let Some((address, (value, tag))) = self.stack.read_that_happened() {
42-
println!(" {value:?} (is_pointer: {tag}) read from stack address {address}",);
42+
println!(" {value:?} (is_pointer: {tag}) read from stack address {address}");
4343
}
4444
if let Some((address, (value, tag))) = self.stack.write_that_happened() {
45-
println!(" {value:?} (is_pointer: {tag}) written to stack address {address}",);
45+
println!(" {value:?} (is_pointer: {tag}) written to stack address {address}");
4646
}
4747
}
4848
}

crates/vm2/src/single_instruction_test/stack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl Stack {
5555

5656
fn assert_write_to_same_slot(&mut self, slot: u16) {
5757
if let Some(last_slot) = self.slot_written {
58-
assert!(last_slot == slot);
58+
assert_eq!(last_slot, slot);
5959
}
6060
self.slot_written = Some(slot);
6161
}

crates/vm2/src/world_diff.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -984,8 +984,8 @@ mod tests {
984984
world_diff.rollback(snapshot);
985985

986986
// The per-access trace is empty — the whole point of opting out.
987-
assert!(world_diff.storage_log_queries().is_empty());
988-
assert!(world_diff.rollback_storage_logs.is_empty());
987+
assert_eq!(world_diff.storage_log_queries(), []);
988+
assert_eq!(world_diff.rollback_storage_logs.as_slice(), []);
989989

990990
// ...but the maps a re-execution verifier derives the deduplicated set
991991
// from are still populated: the slot needs a protective read (read at

0 commit comments

Comments
 (0)