From 71903f7dda2ba59c21dfb6cbbae80554c9681610 Mon Sep 17 00:00:00 2001 From: Hubert Bugaj Date: Thu, 7 Mar 2024 13:53:13 +0100 Subject: [PATCH] self-review --- CHANGELOG.md | 3 +++ Cargo.toml | 2 +- scripts/devnet/.env | 20 ++++++++++---------- scripts/devnet/lotus.dockerfile | 2 +- src/networks/actors_bundle.rs | 4 ++-- src/networks/calibnet/mod.rs | 26 ++++++++++++++++---------- src/networks/devnet/mod.rs | 3 --- src/networks/mainnet/mod.rs | 9 +++++---- src/state_migration/nv21/mod.rs | 5 ++--- src/state_migration/nv22/miner.rs | 4 ++-- 10 files changed, 42 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a121854096c..4ddf0b02d15b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,9 @@ `Filecoin.NetAgentVersion` and `--agent` flag to the `forest-cli net peers` subcommand, that will list the agent version of the connected peers. +- [#3995](https://github.com/ChainSafe/forest/pull/3955) Added support for the + NV22 _Dragon_ network upgrade, together with the required state migration. + ### Changed ### Removed diff --git a/Cargo.toml b/Cargo.toml index 436ea298b622..406c1caf0000 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,7 +52,6 @@ dialoguer = "0.11" digest = "0.10.5" directories = "5" ethereum-types = "0.14.1" -frc46_token = "10.0.0" fil_actor_account_state = { version = "10.0.0-dev.4" } fil_actor_cron_state = { version = "10.0.0-dev.4" } fil_actor_datacap_state = { version = "10.0.0-dev.4" } @@ -67,6 +66,7 @@ fil_actor_verifreg_state = { version = "10.0.0-dev.4" } fil_actors_shared = { version = "10.0.0-dev.4", features = ["json"] } filecoin-proofs-api = { version = "16.0", default-features = false } flume = "0.11" +frc46_token = "10.0.0" fs_extra = "1.2" futures = "0.3" fvm2 = { package = "fvm", version = "~2.7", default-features = false } diff --git a/scripts/devnet/.env b/scripts/devnet/.env index 3426aee7ac22..e4d2fc77dbbd 100644 --- a/scripts/devnet/.env +++ b/scripts/devnet/.env @@ -1,4 +1,4 @@ -LOTUS_IMAGE=lotus-devnet +LOTUS_IMAGE=ghcr.io/chainsafe/lotus-devnet:2024-03-07-b74be0f FOREST_DATA_DIR=/forest_data LOTUS_DATA_DIR=/lotus_data FIL_PROOFS_PARAMETER_CACHE=/var/tmp/filecoin-proof-parameters @@ -6,12 +6,12 @@ LOTUS_RPC_PORT=1234 LOTUS_P2P_PORT=1235 MINER_RPC_PORT=2345 FOREST_RPC_PORT=3456 -GENESIS_NETWORK_VERSION=21 -SHARK_HEIGHT=-20 -HYGGE_HEIGHT=-22 -LIGHTNING_HEIGHT=-23 -THUNDER_HEIGHT=-24 -WATERMELON_HEIGHT=-1 -DRAGON_HEIGHT=20 -DRAND_QUICKNET_HEIGHT=140 -TARGET_HEIGHT=200 +GENESIS_NETWORK_VERSION=18 +SHARK_HEIGHT=-10 +HYGGE_HEIGHT=-9 +LIGHTNING_HEIGHT=3 +THUNDER_HEIGHT=6 +WATERMELON_HEIGHT=9 +DRAGON_HEIGHT=12 +DRAND_QUICKNET_HEIGHT=15 +TARGET_HEIGHT=20 diff --git a/scripts/devnet/lotus.dockerfile b/scripts/devnet/lotus.dockerfile index 33d6b393c717..bf7f730533e8 100644 --- a/scripts/devnet/lotus.dockerfile +++ b/scripts/devnet/lotus.dockerfile @@ -5,7 +5,7 @@ RUN apt-get update && apt-get install -y ca-certificates build-essential clang o WORKDIR /lotus -RUN git clone --depth 1 --branch release/v1.26.0 https://github.com/filecoin-project/lotus.git . +RUN git clone --depth 1 --branch v1.26.0-rc2 https://github.com/filecoin-project/lotus.git . RUN CGO_CFLAGS_ALLOW="-D__BLST_PORTABLE__" \ CGO_CFLAGS="-D__BLST_PORTABLE__" \ diff --git a/src/networks/actors_bundle.rs b/src/networks/actors_bundle.rs index feaebe03b793..8cd2eb370f85 100644 --- a/src/networks/actors_bundle.rs +++ b/src/networks/actors_bundle.rs @@ -69,7 +69,7 @@ pub static ACTOR_BUNDLES: Lazy> = Lazy::new(|| { "bafy2bzacedrunxfqta5skb7q7x32lnp4efz2oq7fn226ffm7fu5iqs62jkmvs" @ "v12.0.0-rc.1" for "calibrationnet", "bafy2bzacebl4w5ptfvuw6746w7ev562idkbf5ppq72e6zub22435ws2rukzru" @ "v12.0.0-rc.2" for "calibrationnet", "bafy2bzacednzb3pkrfnbfhmoqtb3bc6dgvxszpqklf3qcc7qzcage4ewzxsca" @ "v12.0.0" for "calibrationnet", - "bafy2bzaceap46ftyyuhninmzelt2ev6kus5itrggszrk5wuhzf2khm47dtrfa" @ "v13.0.0-rc.2" for "calibrationnet", + "bafy2bzacea4firkyvt2zzdwqjrws5pyeluaesh6uaid246tommayr4337xpmi" @ "v13.0.0-rc.3" for "calibrationnet", "bafy2bzacectxvbk77ntedhztd6sszp2btrtvsmy7lp2ypnrk6yl74zb34t2cq" @ "v12.0.0" for "butterflynet", "bafy2bzaceaqx5xa4cwso24rjiu2ketjlztrqlac6dkyol7tlyuhzrle3zfbos" @ "v13.0.0-rc.3" for "butterflynet", "bafy2bzacedozk3jh2j4nobqotkbofodq4chbrabioxbfrygpldgoxs3zwgggk" @ "v9.0.3" for "devnet", @@ -81,7 +81,7 @@ pub static ACTOR_BUNDLES: Lazy> = Lazy::new(|| { "bafy2bzacecsuyf7mmvrhkx2evng5gnz5canlnz2fdlzu2lvcgptiq2pzuovos" @ "v10.0.0" for "mainnet", "bafy2bzacecnhaiwcrpyjvzl4uv4q3jzoif26okl3m66q3cijp3dfwlcxwztwo" @ "v11.0.0" for "mainnet", "bafy2bzaceapkgfggvxyllnmuogtwasmsv5qi2qzhc2aybockd6kag2g5lzaio" @ "v12.0.0" for "mainnet", - "bafy2bzacea6f5icdp6t6fs5sexjxmo3q5d2qu4g4ghq6s5eaob6svnmhvltmw" @ "v13.0.0-rc.2" for "mainnet", + "bafy2bzacecoplaet2m4kzueqgutjxpl76bhmuiq5hmo3ueighbnxas3rj4dvy" @ "v13.0.0-rc.3" for "mainnet", ]) }); diff --git a/src/networks/calibnet/mod.rs b/src/networks/calibnet/mod.rs index c226c8b9c10a..723198849eed 100644 --- a/src/networks/calibnet/mod.rs +++ b/src/networks/calibnet/mod.rs @@ -8,8 +8,8 @@ use once_cell::sync::Lazy; use std::str::FromStr; use super::{ - drand::DRAND_MAINNET, get_upgrade_height_from_env, parse_bootstrap_peers, DrandPoint, Height, - HeightInfo, + drand::{DRAND_MAINNET, DRAND_QUICKNET}, + get_upgrade_height_from_env, parse_bootstrap_peers, DrandPoint, Height, HeightInfo, }; /// Default genesis car file bytes. @@ -194,13 +194,12 @@ pub static HEIGHT_INFOS: Lazy> = Lazy::new(|| { ), }, ), - // TODO: This shouldn't be modifiable outside of testing ( Height::Dragon, HeightInfo { - epoch: get_upgrade_height_from_env("FOREST_DRAGON_HEIGHT").unwrap_or(1_427_974), + epoch: 1_427_974, bundle: Some( - Cid::try_from("bafy2bzaceap46ftyyuhninmzelt2ev6kus5itrggszrk5wuhzf2khm47dtrfa") + Cid::try_from("bafy2bzacea4firkyvt2zzdwqjrws5pyeluaesh6uaid246tommayr4337xpmi") .unwrap(), ), }, @@ -208,11 +207,18 @@ pub static HEIGHT_INFOS: Lazy> = Lazy::new(|| { ]) }); -pub(super) static DRAND_SCHEDULE: Lazy<[DrandPoint<'static>; 1]> = Lazy::new(|| { - [DrandPoint { - height: 0, - config: &DRAND_MAINNET, - }] +pub(super) static DRAND_SCHEDULE: Lazy<[DrandPoint<'static>; 2]> = Lazy::new(|| { + [ + DrandPoint { + height: 0, + config: &DRAND_MAINNET, + }, + DrandPoint { + height: get_upgrade_height_from_env("FOREST_DRAND_QUICKNET_HEIGHT") + .unwrap_or(HEIGHT_INFOS.get(&Height::Dragon).unwrap().epoch + 120), + config: &DRAND_QUICKNET, + }, + ] }); #[cfg(test)] diff --git a/src/networks/devnet/mod.rs b/src/networks/devnet/mod.rs index 107833f57bf5..beb222378231 100644 --- a/src/networks/devnet/mod.rs +++ b/src/networks/devnet/mod.rs @@ -85,9 +85,6 @@ pub(super) static DRAND_SCHEDULE: Lazy<[DrandPoint<'static>; 2]> = Lazy::new(|| config: &DRAND_MAINNET, }, DrandPoint { - // height is TBD. - // likely to be `get_upgrade_epoch_by_height(HEIGHT_INFOS.iter(), Height::Pineapple).unwrap()`. - // remember to remove `#[allow(dead_code)]` from `get_upgrade_epoch_by_height` height: get_upgrade_height_from_env("FOREST_DRAND_QUICKNET_HEIGHT").unwrap_or(i64::MAX), config: &DRAND_QUICKNET, }, diff --git a/src/networks/mainnet/mod.rs b/src/networks/mainnet/mod.rs index d479e13383e4..2024adec1510 100644 --- a/src/networks/mainnet/mod.rs +++ b/src/networks/mainnet/mod.rs @@ -205,9 +205,10 @@ pub static HEIGHT_INFOS: Lazy> = Lazy::new(|| { ( Height::Dragon, HeightInfo { - epoch: get_upgrade_height_from_env("FOREST_DRAGON_HEIGHT").unwrap_or(i64::MAX), + // 2024-04-02T14:00:00Z - Epoch will be updated in final release + epoch: i64::MAX, bundle: Some( - Cid::try_from("bafy2bzacea6f5icdp6t6fs5sexjxmo3q5d2qu4g4ghq6s5eaob6svnmhvltmw") + Cid::try_from("bafy2bzacecoplaet2m4kzueqgutjxpl76bhmuiq5hmo3ueighbnxas3rj4dvy") .unwrap(), ), }, @@ -226,8 +227,8 @@ pub(super) static DRAND_SCHEDULE: Lazy<[DrandPoint<'static>; 3]> = Lazy::new(|| config: &DRAND_MAINNET, }, DrandPoint { - // height is TBD - height: i64::MAX, + height: get_upgrade_height_from_env("FOREST_DRAND_QUICKNET_HEIGHT") + .unwrap_or(HEIGHT_INFOS.get(&Height::Dragon).unwrap().epoch + 120), config: &DRAND_QUICKNET, }, ] diff --git a/src/state_migration/nv21/mod.rs b/src/state_migration/nv21/mod.rs index 58105870106c..858e2e11302a 100644 --- a/src/state_migration/nv21/mod.rs +++ b/src/state_migration/nv21/mod.rs @@ -1,15 +1,14 @@ // Copyright 2019-2024 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT -//! This module contains the migration logic for the `NV22` upgrade. +//! This module contains the migration logic for the `NV21` upgrade. //! The corresponding Go implementation can be found here: -//! TODO !!! //! mod migration; mod miner; -/// Run migration for `NV22`. This should be the only exported method in this +/// Run migration for `NV21`. This should be the only exported method in this /// module. pub use migration::run_migration; diff --git a/src/state_migration/nv22/miner.rs b/src/state_migration/nv22/miner.rs index 3ff1ecdcdc8a..0214fc47c5e3 100644 --- a/src/state_migration/nv22/miner.rs +++ b/src/state_migration/nv22/miner.rs @@ -7,8 +7,8 @@ //! metadata from the Miner actor. //! //! As per [FIP-0076](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0076.md#backwards-compatibility) -//! > This proposal requires a state migration to the market actor to add the new ProviderSectors mapping, -//! > and to add a sector number to and remove allocation ID from each DealState. Computing this mapping +//! > This proposal requires a state migration to the market actor to add the new `ProviderSectors` mapping, +//! > and to add a sector number to and remove allocation ID from each `DealState`. Computing this mapping //! > requires reading all sector metadata from the miner actor. use crate::state_migration::common::{ActorMigration, ActorMigrationInput, ActorMigrationOutput};