Skip to content

Commit a29674a

Browse files
authored
chore: update proofs dependency and rust toolchain (#2265)
* chore: update proofs dependency and rust toolchain * rm dead hash mod
1 parent 37457a9 commit a29674a

25 files changed

Lines changed: 131 additions & 314 deletions

File tree

.github/workflows/deny.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
- uses: actions/checkout@v4
1616
- uses: EmbarkStudios/cargo-deny-action@v2
1717
with:
18-
rust-version: "1.81.0"
18+
rust-version: "1.94.0"

Cargo.lock

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

fvm/src/call_manager/default.rs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -182,21 +182,21 @@ where
182182
where
183183
K: Kernel<CallManager = Self>,
184184
{
185-
if self.machine.context().tracing {
186-
if let Entrypoint::Invoke(method) = &entrypoint {
187-
self.trace(ExecutionEvent::Call {
188-
from,
189-
to,
190-
method: *method,
191-
params: params.as_ref().map(Into::into),
192-
value: value.clone(),
193-
gas_limit: std::cmp::min(
194-
gas_limit.unwrap_or(Gas::from_milligas(u64::MAX)).round_up(),
195-
self.gas_tracker.gas_available().round_up(),
196-
),
197-
read_only,
198-
});
199-
}
185+
if self.machine.context().tracing
186+
&& let Entrypoint::Invoke(method) = &entrypoint
187+
{
188+
self.trace(ExecutionEvent::Call {
189+
from,
190+
to,
191+
method: *method,
192+
params: params.as_ref().map(Into::into),
193+
value: value.clone(),
194+
gas_limit: std::cmp::min(
195+
gas_limit.unwrap_or(Gas::from_milligas(u64::MAX)).round_up(),
196+
self.gas_tracker.gas_available().round_up(),
197+
),
198+
read_only,
199+
});
200200
}
201201

202202
// If a specific gas limit has been requested, push a new limit into the gas tracker.
@@ -897,14 +897,13 @@ where
897897
.ok()
898898
.and_then(|r| r.value.as_ref())
899899
.map(|v| (v.size(), v.links().len()))
900-
{
901-
if let Err(e) = cm.charge_gas(cm.price_list().on_method_return(
900+
&& let Err(e) = cm.charge_gas(cm.price_list().on_method_return(
902901
cm.call_stack_depth,
903902
ret_size,
904903
link_count,
905-
)) {
906-
ret = Err(e);
907-
}
904+
))
905+
{
906+
ret = Err(e);
908907
}
909908

910909
// Log the results if tracing is enabled.

fvm/src/engine/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ fn wasmtime_config(ec: &EngineConfig) -> anyhow::Result<wasmtime::Config> {
128128

129129
let instance_count = ec.instance_pool_size();
130130
let instance_memory_maximum_size = ec.max_inst_memory_bytes;
131-
if instance_memory_maximum_size % wasmtime_environ::Memory::DEFAULT_PAGE_SIZE as u64 != 0 {
131+
if !instance_memory_maximum_size
132+
.is_multiple_of(wasmtime_environ::Memory::DEFAULT_PAGE_SIZE as u64)
133+
{
132134
return Err(anyhow!(
133135
"requested memory limit {} not a multiple of the WASM_PAGE_SIZE {}",
134136
instance_memory_maximum_size,

fvm/src/gas/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ impl GasTracker {
282282
#[inline]
283283
pub(crate) const fn milligas_to_gas(milligas: u64, round_up: bool) -> u64 {
284284
let mut div_result = milligas / MILLIGAS_PRECISION;
285-
if round_up && milligas % MILLIGAS_PRECISION != 0 {
285+
if round_up && !milligas.is_multiple_of(MILLIGAS_PRECISION) {
286286
div_result = div_result.saturating_add(1);
287287
}
288288
div_result

fvm/src/syscalls/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl Memory {
9494
pub fn try_chunks<const S: usize>(&self, offset: u32, len: u32) -> Result<&[[u8; S]]> {
9595
let num_chunks = {
9696
let len = len as usize;
97-
if len % S != 0 {
97+
if !len.is_multiple_of(S) {
9898
return Err(syscall_error!(
9999
IllegalArgument;
100100
"buffer length {len} is not divisible by chunk len {S}"

ipld/amt/src/diff.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,11 @@ where
353353
node::Link::Dirty(n) => (None, Either::Borrowed(n.borrow())),
354354
};
355355

356-
if let Some(prev_cid) = &prev_cid {
357-
if let Some(curr_cid) = &curr_cid {
358-
if prev_cid == curr_cid {
359-
continue;
360-
}
361-
}
356+
if let Some(prev_cid) = &prev_cid
357+
&& let Some(curr_cid) = &curr_cid
358+
&& prev_cid == curr_cid
359+
{
360+
continue;
362361
}
363362

364363
let prev_sub_ctx = NodeContext {

ipld/amt/src/node.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,13 +333,10 @@ where
333333

334334
fn set_leaf(&mut self, i: u64, val: V) -> Option<V> {
335335
match self {
336-
Node::Leaf { vals } => {
337-
let prev = std::mem::replace(
338-
vals.get_mut(usize::try_from(i).unwrap()).unwrap(),
339-
Some(val),
340-
);
341-
prev
342-
}
336+
Node::Leaf { vals } => vals
337+
.get_mut(usize::try_from(i).unwrap())
338+
.unwrap()
339+
.replace(val),
343340
Node::Link { .. } => panic!("set_leaf should never be called on a shard of links"),
344341
}
345342
}

ipld/bitfield/src/range.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,14 @@ impl RangeSize for Range<u64> {
1414
type Idx = u64;
1515

1616
fn size(&self) -> Self::Idx {
17-
if self.end <= self.start {
18-
0
19-
} else {
20-
self.end - self.start
21-
}
17+
self.end.saturating_sub(self.start)
2218
}
2319
}
2420

2521
impl RangeSize for Range<u32> {
2622
type Idx = u32;
2723

2824
fn size(&self) -> Self::Idx {
29-
if self.end <= self.start {
30-
0
31-
} else {
32-
self.end - self.start
33-
}
25+
self.end.saturating_sub(self.start)
3426
}
3527
}

ipld/car/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ where
144144
// Read node -> cid, bytes
145145
match read_node(&mut self.reader) {
146146
Ok(Some(block)) => {
147-
if self.validate {
148-
if let Err(e) = block.validate() {
149-
return Some(Err(e));
150-
}
147+
if self.validate
148+
&& let Err(e) = block.validate()
149+
{
150+
return Some(Err(e));
151151
}
152152
Some(Ok(block))
153153
}

0 commit comments

Comments
 (0)