Skip to content

Commit 880602e

Browse files
authored
chore: update the FVM to v4.1.0 (#446)
1. Implements the new tracing changes. 2. Explicitly uses the new "FilecoinKernel". 3. Enables support for nv22.
1 parent 8e6cb7a commit 880602e

File tree

4 files changed

+63
-23
lines changed

4 files changed

+63
-23
lines changed

rust/Cargo.lock

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

rust/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ rayon = "1.2.1"
3131
anyhow = "1.0.23"
3232
serde_json = "1.0.46"
3333
rust-gpu-tools = { version = "0.7", optional = true, default-features = false }
34-
fvm4 = { package = "fvm", version = "~4.0.0-alpha.4", default-features = false }
35-
fvm4_shared = { package = "fvm_shared", version = "~4.0.0-alpha.4" }
34+
fvm4 = { package = "fvm", version = "~4.1.1", default-features = false }
35+
fvm4_shared = { package = "fvm_shared", version = "~4.1.1" }
3636
fvm3 = { package = "fvm", version = "~3.8.0", default-features = false }
3737
fvm3_shared = { package = "fvm_shared", version = "~3.6.0" }
3838
fvm2 = { package = "fvm", version = "~2.7", default-features = false }

rust/src/fvm/engine.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl TryFrom<u32> for EngineVersion {
7474
match value {
7575
16 | 17 => Ok(EngineVersion::V1),
7676
18 | 19 | 20 => Ok(EngineVersion::V2),
77-
21 => Ok(EngineVersion::V3),
77+
21 | 22 => Ok(EngineVersion::V3),
7878
_ => return Err(anyhow!("network version not supported")),
7979
}
8080
}
@@ -164,8 +164,8 @@ mod v4 {
164164
ApplyKind, ApplyRet, DefaultExecutor as DefaultExecutor4,
165165
ThreadedExecutor as ThreadedExecutor4,
166166
};
167+
use fvm4::kernel::filecoin::DefaultFilecoinKernel as DefaultFilecoinKernel4;
167168
use fvm4::machine::{DefaultMachine as DefaultMachine4, NetworkConfig};
168-
use fvm4::DefaultKernel as DefaultKernel4;
169169
use fvm4_shared::{chainid::ChainID, clock::ChainEpoch, message::Message};
170170

171171
use crate::fvm::engine::{
@@ -175,7 +175,7 @@ mod v4 {
175175
use super::Config;
176176

177177
type CgoMachine4 = DefaultMachine4<CgoBlockstore, CgoExterns>;
178-
type BaseExecutor4 = DefaultExecutor4<DefaultKernel4<DefaultCallManager4<CgoMachine4>>>;
178+
type BaseExecutor4 = DefaultExecutor4<DefaultFilecoinKernel4<DefaultCallManager4<CgoMachine4>>>;
179179
type CgoExecutor4 = ThreadedExecutor4<BaseExecutor4>;
180180

181181
fn new_executor(
@@ -427,9 +427,6 @@ mod v3 {
427427
.unwrap_or(ErrorNumber::AssertionFailed),
428428
)))
429429
}
430-
ExecutionEvent3::InvokeActor(cid) => {
431-
Some(ExecutionEvent::InvokeActor(cid))
432-
}
433430
_ => None,
434431
})
435432
.collect(),

rust/src/fvm/machine.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ use fvm4::executor::ApplyKind;
77
use fvm4::gas::GasCharge;
88
use fvm4::trace::ExecutionEvent;
99
use fvm4_shared::address::Address;
10-
use fvm4_shared::MethodNum;
10+
use fvm4_shared::state::ActorState;
11+
use fvm4_shared::{ActorID, MethodNum};
1112
use fvm_ipld_encoding::ipld_block::IpldBlock;
1213
use fvm_ipld_encoding::tuple::{Deserialize_tuple, Serialize_tuple};
1314
use fvm_ipld_encoding::{strict_bytes, to_vec, CborStore};
@@ -369,6 +370,7 @@ struct LotusGasCharge {
369370
struct Trace {
370371
pub msg: TraceMessage,
371372
pub msg_ret: TraceReturn,
373+
pub msg_invoked: Option<TraceActor>,
372374
pub gas_charges: Vec<LotusGasCharge>,
373375
pub subcalls: Vec<Trace>,
374376
}
@@ -384,7 +386,12 @@ pub struct TraceMessage {
384386
pub codec: u64,
385387
pub gas_limit: u64,
386388
pub read_only: bool,
387-
pub code_cid: Cid,
389+
}
390+
391+
#[derive(Serialize_tuple, Deserialize_tuple, Debug, PartialEq, Eq, Clone)]
392+
pub struct TraceActor {
393+
pub actor_id: ActorID,
394+
pub actor_state: ActorState,
388395
}
389396

390397
#[derive(Serialize_tuple, Deserialize_tuple, Debug, PartialEq, Eq, Clone)]
@@ -417,8 +424,8 @@ fn build_lotus_trace(
417424
codec: params.codec,
418425
gas_limit,
419426
read_only,
420-
code_cid: Cid::default(),
421427
},
428+
msg_invoked: None,
422429
msg_ret: TraceReturn {
423430
exit_code: ExitCode::OK,
424431
return_data: Vec::new(),
@@ -443,8 +450,11 @@ fn build_lotus_trace(
443450
from, to, method, params, value, gas_limit, read_only, trace_iter,
444451
)?);
445452
}
446-
ExecutionEvent::InvokeActor(cid) => {
447-
new_trace.msg.code_cid = cid;
453+
ExecutionEvent::InvokeActor { id, state } => {
454+
new_trace.msg_invoked = Some(TraceActor {
455+
actor_id: id,
456+
actor_state: state,
457+
})
448458
}
449459
ExecutionEvent::CallReturn(exit_code, return_data) => {
450460
let return_data = return_data.unwrap_or_default();

0 commit comments

Comments
 (0)