Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to rust 1.81.0 #2109

Merged
merged 3 commits into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions fvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ gas_calibration = []
# The current implementation keeps it by default for backward compatibility reason.
# See <https://github.com/filecoin-project/ref-fvm/issues/2001>
verify-signature = []

# Allow coverage attribute.
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage,coverage_nightly)'] }
37 changes: 15 additions & 22 deletions fvm/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,9 @@ fn wasmtime_config(ec: &EngineConfig) -> anyhow::Result<wasmtime::Config> {
c.static_memory_maximum_size(instance_memory_maximum_size);
c.static_memory_forced(true);

// wasmtime default: true
// We don't want threads, there is no way to ensure determinism
#[cfg(feature = "wasmtime/threads")]
c.wasm_threads(false);
// Note: Threads are disabled by default.
// If we add the "wasmtime/threads" feature in the future,
// we would explicitly set c.wasm_threads(false) here.

// wasmtime default: true
// simd isn't supported in wasm-instrument, but if we add support there, we can probably enable
Expand Down Expand Up @@ -197,15 +196,9 @@ fn wasmtime_config(ec: &EngineConfig) -> anyhow::Result<wasmtime::Config> {
// handled correctly in wasm-instrument
c.wasm_multi_value(false);

// wasmtime default: false
// Cool proposal to allow function references, but we don't support it yet.
#[cfg(feature = "wasmtime/gc")]
c.wasm_function_references(false);

// wasmtime default: false
// Wasmtime function reference proposal.
#[cfg(feature = "wasmtime/gc")]
c.wasm_gc(false);
// Note: GC is disabled by default.
// If we add the "wasmtime/gc" feature in the future,
// we would explicitly set c.wasm_gc(false) and c.wasm_function_references(false) here.

// wasmtime default: false
//
Expand Down Expand Up @@ -239,12 +232,13 @@ fn wasmtime_config(ec: &EngineConfig) -> anyhow::Result<wasmtime::Config> {
c.guard_before_linear_memory(true);
c.parallel_compilation(true);

// Disable caching if some other crate enables it. We do our own caching.
#[cfg(feature = "wasmtime/cache")]
c.disable_cache();
// Note: Caching is disabled by default.
// If we add the "wasmtime/cache" feature in the future,
// we would explicitly set c.disable_cache() here.

#[cfg(feature = "wasmtime/async")]
c.async_support(false);
// Note: Async is disabled by default.
// If we add the "wasmtime/async" feature in the future,
// we would explicitly set c.async_support(false) here.

// Doesn't seem to have significant impact on the time it takes to load code
// todo(M2): make sure this is guaranteed to run in linear time.
Expand All @@ -264,10 +258,9 @@ fn wasmtime_config(ec: &EngineConfig) -> anyhow::Result<wasmtime::Config> {
// FIP.
c.wasm_extended_const(false);

// wasmtime default: false
// Disable the component module.
#[cfg(feature = "wasmtime/component-model")]
c.wasm_component_model(false);
// Note: Component model is disabled by default.
// If we add the "wasmtime/component-model" feature in the future,
// we would explicitly set c.wasm_component_model(false) here.

Ok(c)
}
Expand Down
4 changes: 2 additions & 2 deletions fvm/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ impl ApplyRet {
/// The kind of message being applied:
///
/// 1. Explicit messages may only come from account actors and charge the sending account for gas
/// consumed.
/// consumed.
/// 2. Implicit messages may come from any actor, ignore the nonce, and charge no gas (but still
/// account for it).
/// account for it).
#[derive(Eq, PartialEq, Copy, Clone, Debug)]
pub enum ApplyKind {
Explicit,
Expand Down
3 changes: 3 additions & 0 deletions fvm/src/kernel/filecoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ pub trait FilecoinKernel: Kernel {
/// - first header is of the same or lower epoch as the second
/// - at least one of the headers appears in the current chain at or after epoch `earliest`
/// - the headers provide evidence of a fault (see the spec for the different fault types).
///
/// The parameters are all serialized block headers. The third "extra" parameter is consulted only for
/// the "parent grinding fault", in which case it must be the sibling of h1 (same parent tipset) and one of the
/// blocks in the parent of h2 (i.e. h2's grandparent).
Expand Down Expand Up @@ -81,13 +82,15 @@ pub trait FilecoinKernel: Kernel {
/// The circulating supply is the sum of:
/// - rewards emitted by the reward actor,
/// - funds vested from lock-ups in the genesis state,
///
/// less the sum of:
/// - funds burnt,
/// - pledge collateral locked in storage miner actors (recorded in the storage power actor)
/// - deal collateral locked by the storage market actor
fn total_fil_circ_supply(&self) -> Result<TokenAmount>;
}

#[allow(clippy::duplicated_attributes)]
#[derive(Delegate)]
#[delegate(IpldBlockOps, where = "C: CallManager")]
#[delegate(ActorOps, where = "C: CallManager")]
Expand Down
1 change: 1 addition & 0 deletions fvm/src/syscalls/filecoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ pub fn verify_post(
/// - first header is of the same or lower epoch as the second
/// - at least one of the headers appears in the current chain at or after epoch `earliest`
/// - the headers provide evidence of a fault (see the spec for the different fault types).
///
/// The parameters are all serialized block headers. The third "extra" parameter is consulted only for
/// the "parent grinding fault", in which case it must be the sibling of h1 (same parent tipset) and one of the
/// blocks in the parent of h2 (i.e. h2's grandparent).
Expand Down
6 changes: 1 addition & 5 deletions fvm/tests/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ pub struct DummyCallManager {
pub gas_tracker: GasTracker,
pub gas_premium: TokenAmount,
pub origin: ActorID,
pub origin_address: Address,
pub nonce: u64,
pub test_data: Rc<RefCell<TestData>>,
limits: DummyLimiter,
Expand All @@ -216,7 +215,6 @@ impl DummyCallManager {
nonce: 0,
test_data: rc,
limits: DummyLimiter::default(),
origin_address: Address::new_id(0),
gas_premium: TokenAmount::zero(),
},
cell_ref,
Expand All @@ -236,7 +234,6 @@ impl DummyCallManager {
nonce: 0,
test_data: rc,
limits: DummyLimiter::default(),
origin_address: Address::new_id(0),
gas_premium: TokenAmount::zero(),
},
cell_ref,
Expand All @@ -252,7 +249,7 @@ impl CallManager for DummyCallManager {
_engine: Engine,
_gas_limit: u64,
origin: ActorID,
origin_address: Address,
_origin_address: Address,
_receiver: Option<ActorID>,
_receiver_address: Address,
nonce: u64,
Expand All @@ -267,7 +264,6 @@ impl CallManager for DummyCallManager {
gas_tracker: GasTracker::new(BLOCK_GAS_LIMIT, Gas::new(0), false),
gas_premium,
origin,
origin_address,
nonce,
test_data: rc,
limits,
Expand Down
2 changes: 1 addition & 1 deletion ipld/amt/benches/amt_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<'de> Deserialize<'de> for BenchData {
where
D: Deserializer<'de>,
{
Deserialize::deserialize(deserializer)?;
let _: () = Deserialize::deserialize(deserializer)?;
Ok(Self::default())
}
}
Expand Down
4 changes: 2 additions & 2 deletions ipld/amt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ const MAX_HEIGHT: u32 = 64;

/// MaxIndex is the maximum index for elements in the AMT. This u64::MAX-1 so we
/// don't overflow u64::MAX when computing the length.
pub const MAX_INDEX: u64 = std::u64::MAX - 1;
pub const MAX_INDEX: u64 = u64::MAX - 1;

fn nodes_for_height(bit_width: u32, height: u32) -> u64 {
let height_log_two = bit_width as u64 * height as u64;
if height_log_two >= 64 {
return std::u64::MAX;
return u64::MAX;
}
1 << height_log_two
}
Expand Down
14 changes: 6 additions & 8 deletions ipld/hamt/src/bitfield.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use std::u64;

use byteorder::{BigEndian, ByteOrder};
use fvm_ipld_encoding::de::{Deserialize, Deserializer};
use fvm_ipld_encoding::ser::{Serialize, Serializer};
Expand Down Expand Up @@ -117,16 +115,16 @@ impl Bitfield {
if bit < 64 {
self.0[0] = set_bits_leq(self.0[0], bit);
} else if bit < 128 {
self.0[0] = std::u64::MAX;
self.0[0] = u64::MAX;
self.0[1] = set_bits_leq(self.0[1], bit - 64);
} else if bit < 192 {
self.0[0] = std::u64::MAX;
self.0[1] = std::u64::MAX;
self.0[0] = u64::MAX;
self.0[1] = u64::MAX;
self.0[2] = set_bits_leq(self.0[2], bit - 128);
} else {
self.0[0] = std::u64::MAX;
self.0[1] = std::u64::MAX;
self.0[2] = std::u64::MAX;
self.0[0] = u64::MAX;
self.0[1] = u64::MAX;
self.0[2] = u64::MAX;
self.0[3] = set_bits_leq(self.0[3], bit - 192);
}

Expand Down
14 changes: 6 additions & 8 deletions ipld/kamt/src/bitfield.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use std::u64;

use byteorder::{BigEndian, ByteOrder};
use fvm_ipld_encoding::de::{Deserialize, Deserializer};
use fvm_ipld_encoding::ser::{Serialize, Serializer};
Expand Down Expand Up @@ -128,16 +126,16 @@ impl Bitfield {
if bit < 64 {
self.0[0] = set_bits_leq(self.0[0], bit);
} else if bit < 128 {
self.0[0] = std::u64::MAX;
self.0[0] = u64::MAX;
self.0[1] = set_bits_leq(self.0[1], bit - 64);
} else if bit < 192 {
self.0[0] = std::u64::MAX;
self.0[1] = std::u64::MAX;
self.0[0] = u64::MAX;
self.0[1] = u64::MAX;
self.0[2] = set_bits_leq(self.0[2], bit - 128);
} else {
self.0[0] = std::u64::MAX;
self.0[1] = std::u64::MAX;
self.0[2] = std::u64::MAX;
self.0[0] = u64::MAX;
self.0[1] = u64::MAX;
self.0[2] = u64::MAX;
self.0[3] = set_bits_leq(self.0[3], bit - 192);
}

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "1.78.0"
channel = "1.81.0"
components = ["clippy", "llvm-tools-preview", "rustfmt"]
targets = ["wasm32-unknown-unknown"]
1 change: 1 addition & 0 deletions sdk/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ pub fn verify_post(info: &WindowPoStVerifyInfo) -> SyscallResult<bool> {
/// - first header is of the same or lower epoch as the second
/// - at least one of the headers appears in the current chain at or after epoch `earliest`
/// - the headers provide evidence of a fault (see the spec for the different fault types).
///
/// The parameters are all serialized block headers. The third "extra" parameter is consulted only for
/// the "parent grinding fault", in which case it must be the sibling of h1 (same parent tipset) and one of the
/// blocks in the parent of h2 (i.e. h2's grandparent).
Expand Down
4 changes: 4 additions & 0 deletions shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ secp256k1 = ["libsecp256k1"]
blst = ["bls-signatures/blst"]
testing = []
arb = ["arbitrary", "dep:quickcheck", "num-bigint/quickcheck", "cid/arb"]

# Allow coverage attribute.
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage,coverage_nightly)'] }
1 change: 0 additions & 1 deletion shared/src/address/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use std::array::from_fn;
use std::convert::TryInto;
use std::hash::Hash;
use std::u64;

use super::{
from_leb_bytes, to_leb_bytes, Error, Protocol, BLS_PUB_LEN, MAX_SUBADDRESS_LEN,
Expand Down
2 changes: 1 addition & 1 deletion shared/src/address/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use std::fmt;
use std::hash::Hash;
use std::{fmt, u64};

use num_derive::FromPrimitive;
use num_traits::FromPrimitive;
Expand Down
6 changes: 3 additions & 3 deletions shared/tests/address_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,12 @@ fn delegated_address() {
expected: "f432f77777777x32lpna",
},
F4TestVec {
namespace: std::u64::MAX,
namespace: u64::MAX,
subaddr: &[],
expected: "f418446744073709551615ftnkyfaq",
},
F4TestVec {
namespace: std::u64::MAX,
namespace: u64::MAX,
subaddr: &[0; MAX_SUBADDRESS_LEN],
expected: "f418446744073709551615faaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaafbbuagu",
},
Expand Down Expand Up @@ -291,7 +291,7 @@ fn id_address() {
expected: "f0999999",
},
IDTestVec {
input: std::u64::MAX,
input: u64::MAX,
expected: "f018446744073709551615",
},
];
Expand Down
1 change: 1 addition & 0 deletions testing/integration/src/custom_kernel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub trait CustomKernel: Kernel {
}

// our custom kernel extends the filecoin kernel
#[allow(clippy::duplicated_attributes)]
#[derive(Delegate)]
#[delegate(IpldBlockOps, where = "C: CallManager")]
#[delegate(ActorOps, where = "C: CallManager")]
Expand Down