From 20db14d1501202996d11283050b35ad461d1e2be Mon Sep 17 00:00:00 2001 From: Hubert Bugaj Date: Thu, 13 Apr 2023 20:30:03 +0200 Subject: [PATCH] fix serde --- forest/daemon/src/bundle/mod.rs | 2 +- networks/src/calibnet/mod.rs | 2 +- networks/src/lib.rs | 16 ---------------- vm/state_migration/src/nv18/migration.rs | 19 +++++++++++-------- 4 files changed, 13 insertions(+), 26 deletions(-) diff --git a/forest/daemon/src/bundle/mod.rs b/forest/daemon/src/bundle/mod.rs index 23de89163c62..9aa12c35a94d 100644 --- a/forest/daemon/src/bundle/mod.rs +++ b/forest/daemon/src/bundle/mod.rs @@ -31,7 +31,7 @@ where 1, "expected one root when loading actors bundle" ); - println!("Loaded actors bundle with CID: {}", result[0]); + info!("Loaded actors bundle with CID: {}", result[0]); } Ok(()) } diff --git a/networks/src/calibnet/mod.rs b/networks/src/calibnet/mod.rs index 293e1cf6d6e9..8f55fe0bba51 100644 --- a/networks/src/calibnet/mod.rs +++ b/networks/src/calibnet/mod.rs @@ -118,7 +118,7 @@ pub static ref HEIGHT_INFOS: [HeightInfo; 19] = [ height: Height::Hygge, epoch: 322_354, bundle: Some(ActorBundleInfo { - manifest: Cid::try_from("bafy2bzacecsuyf7mmvrhkx2evng5gnz5canlnz2fdlzu2lvcgptiq2pzuovos").unwrap(), + manifest: Cid::try_from("bafy2bzaced25ta3j6ygs34roprilbtb3f6mxifyfnm7z7ndquaruxzdq3y7lo").unwrap(), url: Url::parse("https://github.com/filecoin-project/builtin-actors/releases/download/v10.0.0-rc.1/builtin-actors-calibrationnet.car").unwrap() }), }, diff --git a/networks/src/lib.rs b/networks/src/lib.rs index 1533ccf3cb72..cb4ab37ca91f 100644 --- a/networks/src/lib.rs +++ b/networks/src/lib.rs @@ -3,7 +3,6 @@ use std::sync::Arc; -use ahash::HashMap; use cid::Cid; use fil_actors_runtime_v10::runtime::Policy; use forest_beacon::{BeaconPoint, BeaconSchedule, DrandBeacon, DrandConfig}; @@ -119,7 +118,6 @@ pub struct ChainConfig { #[serde(default = "default_policy")] pub policy: Policy, pub eth_chain_id: u64, - pub manifests: HashMap, } impl ChainConfig { @@ -133,13 +131,6 @@ impl ChainConfig { height_infos: HEIGHT_INFOS.to_vec(), policy: Policy::mainnet(), eth_chain_id: MAINNET_ETH_CHAIN_ID, - manifests: [( - NetworkVersion::V18, - Cid::try_from("bafy2bzacecsuyf7mmvrhkx2evng5gnz5canlnz2fdlzu2lvcgptiq2pzuovos") - .unwrap(), - )] - .into_iter() - .collect(), } } pub fn calibnet() -> Self { @@ -152,13 +143,6 @@ impl ChainConfig { height_infos: HEIGHT_INFOS.to_vec(), policy: Policy::calibnet(), eth_chain_id: CALIBNET_ETH_CHAIN_ID, - manifests: [( - NetworkVersion::V18, - Cid::try_from("bafy2bzaced25ta3j6ygs34roprilbtb3f6mxifyfnm7z7ndquaruxzdq3y7lo") - .unwrap(), - )] - .into_iter() - .collect(), } } diff --git a/vm/state_migration/src/nv18/migration.rs b/vm/state_migration/src/nv18/migration.rs index f73adfba98b9..037164b0cb88 100644 --- a/vm/state_migration/src/nv18/migration.rs +++ b/vm/state_migration/src/nv18/migration.rs @@ -6,13 +6,12 @@ use std::sync::Arc; use anyhow::anyhow; use cid::Cid; use fil_actor_system_v9::State as SystemStateV9; -use forest_networks::ChainConfig; +use forest_networks::{ChainConfig, Height}; use forest_shim::{ address::Address, clock::ChainEpoch, machine::{Manifest, ManifestV2}, state_tree::{StateTree, StateTreeVersion}, - version::NetworkVersion, }; use forest_utils::db::BlockstoreExt; use fvm_ipld_blockstore::Blockstore; @@ -76,11 +75,15 @@ where DB: 'static + Blockstore + Clone + Send + Sync, { let new_manifest_cid = chain_config - .manifests - .get(&NetworkVersion::V18) - .ok_or_else(|| anyhow!("no manifest for network version NV18"))?; - - blockstore.get(new_manifest_cid)?.ok_or_else(|| { + .height_infos + .get(Height::Hygge as usize) + .ok_or_else(|| anyhow!("no height info for network version NV18"))? + .bundle + .as_ref() + .ok_or_else(|| anyhow!("no bundle info for network version NV18"))? + .manifest; + + blockstore.get(&new_manifest_cid)?.ok_or_else(|| { anyhow!( "manifest for network version NV18 not found in blockstore: {}", new_manifest_cid @@ -97,7 +100,7 @@ where .collect(); let mut migration = StateMigration::::new(Some(verifier), post_migration_actions); - migration.add_nv18_migrations(blockstore.clone(), state, new_manifest_cid)?; + migration.add_nv18_migrations(blockstore.clone(), state, &new_manifest_cid)?; let actors_in = StateTree::new_from_root(blockstore.clone(), state)?; let actors_out = StateTree::new(blockstore.clone(), StateTreeVersion::V5)?;