Skip to content

Commit d359bfd

Browse files
committed
feat: switch to the new versioned manifest.
1. If no manifest CID is passed, load the manifest from the system actor and assume "v1" for now. In the future, we'll likely use the network version to infer the manifest version. 2. If a manifest CID _is_ passed, assume it's a versioned manifest and use the specified version. replaces #404
1 parent 2429e1e commit d359bfd

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

fvm/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ mod test {
135135
Zero::zero(),
136136
fvm_shared::version::NetworkVersion::V14,
137137
root,
138-
(0, Some(manifest_cid)),
138+
Some(manifest_cid),
139139
bs,
140140
DummyExterns,
141141
)

fvm/src/machine/default.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use anyhow::{anyhow, Context as _};
44
use cid::Cid;
55
use fvm_shared::actor::builtin::{load_manifest, Manifest};
66
use fvm_shared::address::Address;
7-
use fvm_shared::blockstore::{Blockstore, Buffered};
7+
use fvm_shared::blockstore::{Blockstore, Buffered, CborStore};
88
use fvm_shared::clock::ChainEpoch;
99
use fvm_shared::econ::TokenAmount;
1010
use fvm_shared::error::ErrorNumber;
@@ -57,7 +57,7 @@ where
5757
circ_supply: TokenAmount,
5858
network_version: NetworkVersion,
5959
state_root: Cid,
60-
builtin_actors: (u32, Option<Cid>),
60+
builtin_actors: Option<Cid>,
6161
blockstore: B,
6262
externs: E,
6363
) -> anyhow::Result<Self> {
@@ -102,15 +102,21 @@ where
102102

103103
// Load the built-in actors manifest.
104104
// TODO: Check that the actor bundle is sane for the network version.
105-
let builtin_actors_cid = match builtin_actors.1 {
106-
Some(cid) => cid,
105+
let (builtin_actors_cid, manifest_version) = match builtin_actors {
106+
Some(manifest_cid) => {
107+
let (version, cid): (u32, Cid) = state_tree
108+
.store()
109+
.get_cbor(&manifest_cid)?
110+
.context("failed to load actor manifest")?;
111+
(cid, version)
112+
}
107113
None => {
108114
let (state, _) = SystemActorState::load(&state_tree)?;
109-
state.builtin_actors
115+
(state.builtin_actors, 1)
110116
}
111117
};
112118
let builtin_actors =
113-
load_manifest(state_tree.store(), &builtin_actors_cid, builtin_actors.0)?;
119+
load_manifest(state_tree.store(), &builtin_actors_cid, manifest_version)?;
114120

115121
// Preload any uncached modules.
116122
// This interface works for now because we know all actor CIDs

testing/conformance/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ serde_json = { version = "1.0", features = ["raw_value"] }
4545
walkdir = "2.3"
4646
regex = { version = "1.0" }
4747
ittapi-rs = { version = "0.1.6", optional = true }
48-
actors-v6 = { version = "6.0.5", package = "fil_builtin_actors_bundle" }
49-
actors-v7 = { version = "7.0.4", package = "fil_builtin_actors_bundle" }
48+
actors-v6 = { version = "6.0.6", package = "fil_builtin_actors_bundle" }
49+
actors-v7 = { version = "7.0.7", package = "fil_builtin_actors_bundle" }
5050
libipld-core = { version = "0.13.1", features = ["serde-codec"] }
5151

5252
[features]

testing/conformance/src/vm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl TestMachine<Box<DefaultMachine<MemoryBlockstore, TestExterns>>> {
8585
BigInt::zero(),
8686
network_version,
8787
state_root,
88-
(0, Some(builtin_actors)),
88+
Some(builtin_actors),
8989
blockstore,
9090
externs,
9191
)

0 commit comments

Comments
 (0)