Skip to content

Commit 7a7fd21

Browse files
authored
Merge pull request #416 from filecoin-project/feat/manifest-versioning-v2
feat: switch to the new versioned manifest.
2 parents 2429e1e + 5d6bb1d commit 7a7fd21

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

fvm/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ mod test {
127127
bs.put_cbor(&manifest, Code::Blake2b256).unwrap()
128128
};
129129

130+
let actors_cid = bs.put_cbor(&(0, manifest_cid), Code::Blake2b256).unwrap();
131+
130132
let machine = DefaultMachine::new(
131133
Config::default(),
132134
Engine::default(),
@@ -135,7 +137,7 @@ mod test {
135137
Zero::zero(),
136138
fvm_shared::version::NetworkVersion::V14,
137139
root,
138-
(0, Some(manifest_cid)),
140+
Some(actors_cid),
139141
bs,
140142
DummyExterns,
141143
)

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.1.0", package = "fil_builtin_actors_bundle" }
49+
actors-v7 = { version = "7.1.0", 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)