Skip to content

Commit

Permalink
self-review
Browse files Browse the repository at this point in the history
  • Loading branch information
LesnyRumcajs committed Mar 7, 2024
1 parent 46a0d04 commit 71903f7
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 36 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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 }
Expand Down
20 changes: 10 additions & 10 deletions scripts/devnet/.env
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
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
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
2 changes: 1 addition & 1 deletion scripts/devnet/lotus.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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__" \
Expand Down
4 changes: 2 additions & 2 deletions src/networks/actors_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub static ACTOR_BUNDLES: Lazy<Box<[ActorBundleInfo]>> = 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",
Expand All @@ -81,7 +81,7 @@ pub static ACTOR_BUNDLES: Lazy<Box<[ActorBundleInfo]>> = 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",
])
});

Expand Down
26 changes: 16 additions & 10 deletions src/networks/calibnet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -194,25 +194,31 @@ pub static HEIGHT_INFOS: Lazy<HashMap<Height, HeightInfo>> = 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(),
),
},
),
])
});

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)]
Expand Down
3 changes: 0 additions & 3 deletions src/networks/devnet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
9 changes: 5 additions & 4 deletions src/networks/mainnet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,10 @@ pub static HEIGHT_INFOS: Lazy<HashMap<Height, HeightInfo>> = 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(),
),
},
Expand All @@ -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,
},
]
Expand Down
5 changes: 2 additions & 3 deletions src/state_migration/nv21/mod.rs
Original file line number Diff line number Diff line change
@@ -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 !!!
//! <https://github.com/filecoin-project/go-state-types/blob/master/builtin/v12/migration/top.go>

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;

Expand Down
4 changes: 2 additions & 2 deletions src/state_migration/nv22/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit 71903f7

Please sign in to comment.