diff --git a/f3-sidecar/go.mod b/f3-sidecar/go.mod index 41cf0d192a91..a0302c7a4bb4 100644 --- a/f3-sidecar/go.mod +++ b/f3-sidecar/go.mod @@ -4,7 +4,7 @@ go 1.25.4 require ( github.com/filecoin-project/go-f3 v0.8.10 - github.com/filecoin-project/go-jsonrpc v0.9.0 + github.com/filecoin-project/go-jsonrpc v0.10.0 github.com/filecoin-project/go-state-types v0.17.0 github.com/ihciah/rust2go v0.0.0-20251204052609-e81751674fa5 github.com/ipfs/go-cid v0.6.0 diff --git a/f3-sidecar/go.sum b/f3-sidecar/go.sum index eb0c2cf246b5..1e90b7b9966f 100644 --- a/f3-sidecar/go.sum +++ b/f3-sidecar/go.sum @@ -33,8 +33,8 @@ github.com/filecoin-project/go-clock v0.1.0 h1:SFbYIM75M8NnFm1yMHhN9Ahy3W5bEZV9g github.com/filecoin-project/go-clock v0.1.0/go.mod h1:4uB/O4PvOjlx1VCMdZ9MyDZXRm//gkj1ELEbxfI1AZs= github.com/filecoin-project/go-f3 v0.8.10 h1:Mm+daAn9EKqTTDY3ICbPTR2i3Opjb4gr6Y7bJ8oCA84= github.com/filecoin-project/go-f3 v0.8.10/go.mod h1:hFvb2CMxHDmlJAVzfiIL/V8zCtNMQqfSnhP5TyM6CHI= -github.com/filecoin-project/go-jsonrpc v0.9.0 h1:G47qEF52w7GholpI21vPSTVBFvsrip6geIoqNiqyZtQ= -github.com/filecoin-project/go-jsonrpc v0.9.0/go.mod h1:OG7kVBVh/AbDFHIwx7Kw0l9ARmKOS6gGOr0LbdBpbLc= +github.com/filecoin-project/go-jsonrpc v0.10.0 h1:gZc1thGVD5Khg5Gp1UJibRWZrnNBEP1iFrGOTn0w5TE= +github.com/filecoin-project/go-jsonrpc v0.10.0/go.mod h1:OG7kVBVh/AbDFHIwx7Kw0l9ARmKOS6gGOr0LbdBpbLc= github.com/filecoin-project/go-state-types v0.17.0 h1:HpBb6G+VSOOI6rQFSnvPVyRsnms8je94cwvU69DJ+9Y= github.com/filecoin-project/go-state-types v0.17.0/go.mod h1:em4yo9mglrdyHbcsxelHCSKMjLdJLddLERWQe6J8vYc= github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg= diff --git a/src/daemon/db_util.rs b/src/daemon/db_util.rs index b5933e512cc3..d2c2ac1dae26 100644 --- a/src/daemon/db_util.rs +++ b/src/daemon/db_util.rs @@ -244,25 +244,35 @@ pub async fn import_chain_as_forest_car( let forest_car = ForestCar::try_from(forest_car_db_path.as_path())?; if let Some(f3_cid) = forest_car.metadata().as_ref().and_then(|m| m.f3_data) { - let mut f3_data = forest_car - .get_reader(f3_cid)? - .with_context(|| format!("f3 data not found, cid: {f3_cid}"))?; - let mut temp_f3_snap = tempfile::Builder::new() - .suffix(".f3snap.bin") - .tempfile_in(forest_car_db_dir)?; + if crate::f3::get_f3_sidecar_params(chain_config) + .initial_power_table + .is_none() { - let f = temp_f3_snap.as_file_mut(); - std::io::copy(&mut f3_data, f)?; - f.sync_all()?; - } - if let Err(e) = crate::f3::import_f3_snapshot( - chain_config, - rpc_endpoint.to_string(), - f3_root.display().to_string(), - temp_f3_snap.path().display().to_string(), - ) { - // Do not make it a hard error if anything is wrong with F3 snapshot - tracing::error!("Failed to import F3 snapshot: {e}"); + // To avoid importing old/wrong F3 data without initial power table check + tracing::warn!( + "skipped importing F3 data as the initial power table CID is not set in the current manifest" + ); + } else { + let mut f3_data = forest_car + .get_reader(f3_cid)? + .with_context(|| format!("f3 data not found, cid: {f3_cid}"))?; + let mut temp_f3_snap = tempfile::Builder::new() + .suffix(".f3snap.bin") + .tempfile_in(forest_car_db_dir)?; + { + let f = temp_f3_snap.as_file_mut(); + std::io::copy(&mut f3_data, f)?; + f.sync_all()?; + } + if let Err(e) = crate::f3::import_f3_snapshot( + chain_config, + rpc_endpoint.to_string(), + f3_root.display().to_string(), + temp_f3_snap.path().display().to_string(), + ) { + // Do not make it a hard error if anything is wrong with F3 snapshot + tracing::error!("Failed to import F3 snapshot: {e}"); + } } }