Skip to content

Commit

Permalink
Update Rust version to 1.74.1 (#1605)
Browse files Browse the repository at this point in the history
* Update rust version to 1.74.1

* cargo fmt -all

* Update Makefile

* cargo clippy --fix

* fix cargo clippy

* restore fuzzer/Cargo.lock

---------

Co-authored-by: Pedro Fontana <[email protected]>
  • Loading branch information
pefontana and Pedro Fontana authored Feb 9, 2024
1 parent b28f22d commit f2ddc90
Show file tree
Hide file tree
Showing 19 changed files with 32 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Install Rust
uses: dtolnay/rust-toolchain@1.70.0
uses: dtolnay/rust-toolchain@1.74.1
with:
components: rustfmt, clippy
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cairo_1_programs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.70.0
uses: dtolnay/rust-toolchain@1.74.1
- name: Set up Cargo cache
uses: Swatinem/rust-cache@v2
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fresh_run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: actions/checkout@v3

- name: Install Rust
uses: dtolnay/rust-toolchain@1.70.0
uses: dtolnay/rust-toolchain@1.74.1

- name: Install Pyenv
uses: "gabrielfalcao/pyenv-action@v13"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hint_accountant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.70.0
uses: dtolnay/rust-toolchain@1.74.1
- name: Set up Cargo cache
uses: Swatinem/rust-cache@v2
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hyperfine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:

- name: Install Rust
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
uses: dtolnay/rust-toolchain@1.70.0
uses: dtolnay/rust-toolchain@1.74.1

- name: Checkout
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/iai_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@1.70.0
uses: dtolnay/rust-toolchain@1.74.1
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
- name: Python3 Build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/iai_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- name: Install Rust
if: ${{ steps.cache-iai-results.outputs.cache-hit != 'true' }}
uses: dtolnay/rust-toolchain@1.70.0
uses: dtolnay/rust-toolchain@1.74.1
- name: Set up cargo cache
if: ${{ steps.cache-iai-results.outputs.cache-hit != 'true' }}
uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@1.70.0
uses: dtolnay/rust-toolchain@1.74.1
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
- name: Python3 Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@1.70.0
uses: dtolnay/rust-toolchain@1.74.1
- name: Publish crate cairo-vm
env:
CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Install Rust
uses: dtolnay/rust-toolchain@1.70.0
uses: dtolnay/rust-toolchain@1.74.1
with:
components: rustfmt, clippy
- name: Set up cargo cache
Expand Down Expand Up @@ -165,7 +165,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Install Rust
uses: dtolnay/rust-toolchain@1.70.0
uses: dtolnay/rust-toolchain@1.74.1
with:
targets: wasm32-unknown-unknown

Expand Down Expand Up @@ -220,7 +220,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Install Rust
uses: dtolnay/rust-toolchain@1.70.0
uses: dtolnay/rust-toolchain@1.74.1
with:
components: llvm-tools-preview
- name: Set up cargo cache
Expand Down Expand Up @@ -281,7 +281,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Install Rust
uses: dtolnay/rust-toolchain@1.70.0
uses: dtolnay/rust-toolchain@1.74.1
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ifndef PROPTEST_CASES
endif

.PHONY: build-cairo-1-compiler build-cairo-1-compiler-macos build-cairo-2-compiler build-cairo-2-compiler-macos \
deps deps-macos cargo-deps build run check test clippy coverage benchmark \
deps deps-macos cargo-deps build run check test clippy coverage benchmark flamegraph\
compare_benchmarks_deps compare_benchmarks docs clean \
compare_trace_memory compare_trace compare_memory compare_pie compare_all_no_proof \
compare_trace_memory_proof compare_all_proof compare_trace_proof compare_memory_proof compare_air_public_input compare_air_private_input\
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ It's Turing-complete and it was created by [Starkware](https://starkware.co/) as

These are needed in order to compile and use the project.

- [Rust 1.70.0 or newer](https://www.rust-lang.org/tools/install)
- [Rust 1.74.1 or newer](https://www.rust-lang.org/tools/install)
- Cargo

#### Optional
Expand Down
4 changes: 3 additions & 1 deletion cairo1-run/src/cairo_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,9 @@ fn create_entry_code(
let mut array_args_data = vec![];
let mut ap_offset: i16 = 0;
for arg in args {
let FuncArg::Array(values) = arg else { continue };
let FuncArg::Array(values) = arg else {
continue;
};
array_args_data.push(ap_offset);
casm_extend! {ctx,
%{ memory[ap + 0] = segments.add() %}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "1.70.0"
channel = "1.74.1"
components = ["rustfmt", "clippy"]
profile = "minimal"
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ mod tests {
vm.segments.add();
}

let addresses = vec![
let addresses = [
Relocatable::from((1, 0)),
Relocatable::from((1, 1)),
Relocatable::from((1, 2)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ impl Cairo1HintProcessor {
) -> Result<(), HintError> {
let a_val = res_operand_get_val(vm, a)?;
let b_val = res_operand_get_val(vm, b)?;
let mut lengths_and_indices = vec![
let mut lengths_and_indices = [
(a_val, 0),
(b_val - a_val, 1),
(Felt252::from(-1) - b_val, 2),
Expand Down
2 changes: 1 addition & 1 deletion vm/src/serde/deserialize_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ fn take_until_unbalanced(
.ok_or_else(|| Err::Error(Error::from_error_kind(i, ErrorKind::TakeUntil)))?
.chars();
match it.next().unwrap_or_default() {
c if c == '\\' => {
'\\' => {
// Skip the escape char `\`.
index += '\\'.len_utf8();
// Skip also the following char.
Expand Down
14 changes: 7 additions & 7 deletions vm/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,24 @@ mod skip_instruction_test;

//For simple programs that should just succeed and have no special needs.
//Checks memory holes == 0
pub(self) fn run_program_simple(data: &[u8]) {
fn run_program_simple(data: &[u8]) {
run_program(data, Some("all_cairo"), None, None)
}

//For simple programs that should just succeed but using small layout.
pub(self) fn run_program_small(data: &[u8]) {
fn run_program_small(data: &[u8]) {
run_program(data, Some("small"), None, None)
}

pub(self) fn run_program_with_trace(data: &[u8], trace: &[(usize, usize, usize)]) {
fn run_program_with_trace(data: &[u8], trace: &[(usize, usize, usize)]) {
run_program(data, Some("all_cairo"), Some(trace), None)
}

pub(self) fn run_program_with_error(data: &[u8], error: &str) {
fn run_program_with_error(data: &[u8], error: &str) {
run_program(data, Some("all_cairo"), None, Some(error))
}

pub(self) fn run_program(
fn run_program(
data: &[u8],
layout: Option<&str>,
trace: Option<&[(usize, usize, usize)]>,
Expand Down Expand Up @@ -101,7 +101,7 @@ pub(self) fn run_program(
#[cfg(feature = "cairo-1-hints")]
// Runs a contract entrypoint with given arguments and checks its return values
// Doesn't use a syscall_handler
pub(self) fn run_cairo_1_entrypoint(
fn run_cairo_1_entrypoint(
program_content: &[u8],
entrypoint_offset: usize,
args: &[MaybeRelocatable],
Expand Down Expand Up @@ -207,7 +207,7 @@ pub(self) fn run_cairo_1_entrypoint(
#[cfg(feature = "cairo-1-hints")]
/// Equals to fn run_cairo_1_entrypoint
/// But with run_resources as an input
pub(self) fn run_cairo_1_entrypoint_with_run_resources(
fn run_cairo_1_entrypoint_with_run_resources(
contract_class: CasmContractClass,
entrypoint_offset: usize,
hint_processor: &mut Cairo1HintProcessor,
Expand Down
3 changes: 2 additions & 1 deletion vm/src/vm/runners/builtin_runner/bitwise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ impl BitwiseBuiltinRunner {
let x_addr = (address - index)?;
let y_addr = (x_addr + 1_usize)?;

let (Ok(num_x), Ok(num_y)) = (memory.get_integer(x_addr), memory.get_integer(y_addr)) else {
let (Ok(num_x), Ok(num_y)) = (memory.get_integer(x_addr), memory.get_integer(y_addr))
else {
return Ok(None);
};

Expand Down
1 change: 1 addition & 0 deletions vm/src/vm/runners/cairo_pie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ mod serde_impl {
seq_serializer.end()
}

#[allow(clippy::format_collect)]
pub fn serialize_memory<S>(
values: &[((usize, usize), MaybeRelocatable)],
serializer: S,
Expand Down

0 comments on commit f2ddc90

Please sign in to comment.