Skip to content

Commit 918ec6a

Browse files
authored
chore: migrate v3 conformance tests to rust 2024 (#2171)
1 parent 513b90d commit 918ec6a

File tree

10 files changed

+19
-15
lines changed

10 files changed

+19
-15
lines changed

testing/conformance/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "fvm_conformance_tests"
33
description = "Filecoin Virtual Machine conformance tests"
44
version = "0.1.0"
55
authors = ["ChainSafe Systems <[email protected]>", "Protocol Labs", "Filecoin Core Devs"]
6-
edition = "2021"
6+
edition.workspace = true
77
exclude = ["/test-vectors"]
88
publish = false
99
repository = "https://github.com/filecoin-project/ref-fvm"

testing/conformance/benches/bench_conformance.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use walkdir::WalkDir;
1818

1919
mod bench_drivers;
2020

21-
use crate::bench_drivers::{bench_vector_file, CheckStrength};
21+
use crate::bench_drivers::{CheckStrength, bench_vector_file};
2222

2323
/// Either grabs an environment variable called VECTOR and benches that test vector using criterion, or runs all of them in sequence. Displays output for results of benchmarking.
2424
fn bench_conformance(c: &mut Criterion) {

testing/conformance/benches/bench_conformance_overhead.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use num_traits::Zero;
1818
use walkdir::WalkDir;
1919

2020
mod bench_drivers;
21-
use crate::bench_drivers::{bench_vector_file, CheckStrength};
21+
use crate::bench_drivers::{CheckStrength, bench_vector_file};
2222

2323
/// benches only machine setup, no messages get sent. This is basically overhead of the benchmarks themselves.
2424
fn bench_init_only(

testing/conformance/benches/bench_drivers.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ pub fn bench_vector_file(
145145
engines,
146146
);
147147
} else {
148-
return Err(anyhow::anyhow!("a test failed, get the tests passing/running before running benchmarks in {:?} mode: {}", check_strength, name));
148+
return Err(anyhow::anyhow!(
149+
"a test failed, get the tests passing/running before running benchmarks in {:?} mode: {}",
150+
check_strength,
151+
name
152+
));
149153
};
150154
}
151155
Ok(())

testing/conformance/src/cidjson.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// SPDX-License-Identifier: Apache-2.0, MIT
44

55
use cid::Cid;
6-
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
6+
use serde::{Deserialize, Deserializer, Serialize, Serializer, de};
77

88
/// Wrapper for serializing and deserializing a Cid from JSON.
99
#[derive(Deserialize, Serialize, Clone, Debug)]

testing/conformance/src/driver.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::fmt;
44
use std::time::Instant;
55

6-
use anyhow::{anyhow, Result};
6+
use anyhow::{Result, anyhow};
77
use cid::Cid;
88
use fmt::Display;
99
use fvm::engine::MultiEngine;
@@ -12,7 +12,7 @@ use fvm::kernel::Context;
1212
use fvm::machine::Machine;
1313
use fvm::state_tree::{ActorState, StateTree};
1414
use fvm_ipld_blockstore::MemoryBlockstore;
15-
use fvm_ipld_encoding::{from_slice, CborStore};
15+
use fvm_ipld_encoding::{CborStore, from_slice};
1616
use fvm_shared::address::Protocol;
1717
use fvm_shared::crypto::signature::SECP_SIG_LEN;
1818
use fvm_shared::message::Message;
@@ -286,7 +286,7 @@ pub fn run_variant(
286286
return Ok(VariantResult::Failed {
287287
id,
288288
reason: anyhow!("machine poisoned"),
289-
})
289+
});
290290
}
291291
};
292292
if check_correctness {

testing/conformance/src/tracing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2021-2023 Protocol Labs
22
// SPDX-License-Identifier: Apache-2.0, MIT
3-
use std::fs::{create_dir_all, File};
3+
use std::fs::{File, create_dir_all};
44
use std::io::{Result as IoResult, Write};
55
use std::ops::DerefMut;
66
use std::path::PathBuf;

testing/conformance/src/vector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright 2019-2022 ChainSafe Systems
33
// SPDX-License-Identifier: Apache-2.0, MIT
44

5-
use anyhow::{anyhow, Context as _};
5+
use anyhow::{Context as _, anyhow};
66
use cid::Cid;
77
use flate2::bufread::GzDecoder;
88
use fvm_ipld_blockstore::MemoryBlockstore;

testing/conformance/src/vm.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
// SPDX-License-Identifier: Apache-2.0, MIT
33
use std::sync::{Arc, Mutex};
44

5-
use cid::multihash::Multihash;
65
use cid::Cid;
6+
use cid::multihash::Multihash;
77

8+
use fvm::DefaultKernel;
89
use fvm::call_manager::{CallManager, DefaultCallManager};
9-
use fvm::gas::{price_list_by_network_version, Gas, GasTimer, PriceList};
10+
use fvm::gas::{Gas, GasTimer, PriceList, price_list_by_network_version};
1011
use fvm::kernel::*;
1112
use fvm::machine::limiter::MemoryLimiter;
1213
use fvm::machine::{DefaultMachine, Machine, MachineContext, Manifest, NetworkConfig};
1314
use fvm::state_tree::StateTree;
14-
use fvm::DefaultKernel;
1515
use fvm_ipld_blockstore::MemoryBlockstore;
1616
use fvm_shared::address::Address;
1717
use fvm_shared::clock::ChainEpoch;
1818
use fvm_shared::consensus::ConsensusFault;
1919
use fvm_shared::crypto::signature::{
20-
SignatureType, SECP_PUB_LEN, SECP_SIG_LEN, SECP_SIG_MESSAGE_HASH_SIZE,
20+
SECP_PUB_LEN, SECP_SIG_LEN, SECP_SIG_MESSAGE_HASH_SIZE, SignatureType,
2121
};
2222
use fvm_shared::econ::TokenAmount;
2323
use fvm_shared::piece::PieceInfo;

testing/conformance/tests/runner.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::iter;
99
use std::path::{Path, PathBuf};
1010
use std::str::FromStr;
1111

12-
use anyhow::{anyhow, Context as _};
12+
use anyhow::{Context as _, anyhow};
1313
use async_std::{stream, sync, task};
1414
use colored::*;
1515
use futures::{Future, StreamExt, TryFutureExt, TryStreamExt};

0 commit comments

Comments
 (0)