Skip to content

Commit

Permalink
Butterflynet nv22 (#4028)
Browse files Browse the repository at this point in the history
  • Loading branch information
LesnyRumcajs committed Mar 7, 2024
1 parent cf53246 commit 515753f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 18 deletions.
4 changes: 2 additions & 2 deletions build/bootstrap/butterflynet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/dns4/bootstrap-0.butterfly.fildev.network/tcp/1347/p2p/12D3KooWFbgk3NSUv7u3kYqLUfVi5ycmzkVoCMA6DFWNJScazsh1
/dns4/bootstrap-1.butterfly.fildev.network/tcp/1347/p2p/12D3KooWLsnUi7HD2camXmvhmfHke53krsbFfFf5eHh6g2G3m2Nt
/dns4/bootstrap-0.butterfly.fildev.network/tcp/1347/p2p/12D3KooWQDmegAZg23vAgxoGzRsYb8Ma4oW2p759QrGyC9Y6Bszu
/dns4/bootstrap-1.butterfly.fildev.network/tcp/1347/p2p/12D3KooWNi7kCgFSNDKMuKu1ng8LCZtB1rWVy4yZG8UDWyUdLaDM
2 changes: 1 addition & 1 deletion src/networks/actors_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ pub static ACTOR_BUNDLES: Lazy<Box<[ActorBundleInfo]>> = Lazy::new(|| {
"bafy2bzacebl4w5ptfvuw6746w7ev562idkbf5ppq72e6zub22435ws2rukzru" @ "v12.0.0-rc.2" for "calibrationnet",
"bafy2bzacednzb3pkrfnbfhmoqtb3bc6dgvxszpqklf3qcc7qzcage4ewzxsca" @ "v12.0.0" for "calibrationnet",
"bafy2bzaceap46ftyyuhninmzelt2ev6kus5itrggszrk5wuhzf2khm47dtrfa" @ "v13.0.0-rc.2" for "calibrationnet",
"bafy2bzaceaiy4dsxxus5xp5n5i4tjzkb7sc54mjz7qnk2efhgmsrobjesxnza" @ "v11.0.0" for "butterflynet",
"bafy2bzacectxvbk77ntedhztd6sszp2btrtvsmy7lp2ypnrk6yl74zb34t2cq" @ "v12.0.0" for "butterflynet",
"bafy2bzaceaqx5xa4cwso24rjiu2ketjlztrqlac6dkyol7tlyuhzrle3zfbos" @ "v13.0.0-rc.3" for "butterflynet",
"bafy2bzacedozk3jh2j4nobqotkbofodq4chbrabioxbfrygpldgoxs3zwgggk" @ "v9.0.3" for "devnet",
"bafy2bzacebzz376j5kizfck56366kdz5aut6ktqrvqbi3efa2d4l2o2m653ts" @ "v10.0.0" for "devnet",
"bafy2bzaceay35go4xbjb45km6o46e5bib3bi46panhovcbedrynzwmm3drr4i" @ "v11.0.0" for "devnet",
Expand Down
38 changes: 25 additions & 13 deletions src/networks/butterflynet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ use url::Url;

use crate::{db::SettingsStore, utils::net::http_get};

use super::{drand::DRAND_MAINNET, parse_bootstrap_peers, DrandPoint, Height, HeightInfo};
use super::{
drand::{DRAND_MAINNET, DRAND_QUICKNET},
get_upgrade_height_from_env, parse_bootstrap_peers, DrandPoint, Height, HeightInfo,
};

/// Fetches the genesis CAR from the local database or downloads it if it does not exist.
/// The result bytes may be compressed.
Expand All @@ -32,7 +35,7 @@ pub async fn fetch_genesis<DB: SettingsStore>(db: &DB) -> anyhow::Result<Vec<u8>

/// Genesis CID
pub static GENESIS_CID: Lazy<Cid> = Lazy::new(|| {
Cid::from_str("bafy2bzacecl7vdlut572ia64cskp3onngc5ii6co2vsdoshc6ehcx7bful5oo").unwrap()
Cid::from_str("bafy2bzaceca7iggnglnsntfmtqvpsmolzvbuyzhpoq55wzubq65jasnkqxuh6").unwrap()
});

/// Compressed genesis file. It is compressed with zstd and cuts the download size by 80% (from 10 MB to 2 MB).
Expand All @@ -47,7 +50,7 @@ static GENESIS_URL: Lazy<Url> = Lazy::new(|| {
/// The genesis file does not live on the `master` branch, currently on a draft PR.
/// `<https://github.com/filecoin-project/lotus/pull/11458>`
static GENESIS_URL_ALT: Lazy<Url> = Lazy::new(|| {
"https://github.com/filecoin-project/lotus/raw/3e379c9997bf152639a593d3efee49b88fee27ec/build/genesis/butterflynet.car".parse().expect("hard-coded URL must parse")
"https://github.com/filecoin-project/lotus/raw/3331a7e52c97e5723fc0c613271a616bb3ccdb39/build/genesis/butterflynet.car".parse().expect("hard-coded URL must parse")
});

pub(crate) const MINIMUM_CONSENSUS_POWER: i64 = 2 << 30;
Expand All @@ -65,33 +68,40 @@ pub const ETH_CHAIN_ID: u64 = 3141592;
pub static HEIGHT_INFOS: Lazy<HashMap<Height, HeightInfo>> = Lazy::new(|| {
HashMap::from_iter([
(
Height::Thunder,
Height::Watermelon,
HeightInfo {
epoch: -1,
bundle: Some(
Cid::try_from("bafy2bzaceaiy4dsxxus5xp5n5i4tjzkb7sc54mjz7qnk2efhgmsrobjesxnza")
Cid::try_from("bafy2bzacectxvbk77ntedhztd6sszp2btrtvsmy7lp2ypnrk6yl74zb34t2cq")
.unwrap(),
),
},
),
(
Height::Watermelon,
Height::Dragon,
HeightInfo {
epoch: 400,
epoch: 2600,
bundle: Some(
Cid::try_from("bafy2bzacectxvbk77ntedhztd6sszp2btrtvsmy7lp2ypnrk6yl74zb34t2cq")
Cid::try_from("bafy2bzaceaqx5xa4cwso24rjiu2ketjlztrqlac6dkyol7tlyuhzrle3zfbos")
.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,
},
]
});

/// Creates a new butterfly policy with the given version.
Expand Down Expand Up @@ -161,10 +171,12 @@ mod tests {
let v10 = make_butterfly_policy!(v10);
let v11 = make_butterfly_policy!(v11);
let v12 = make_butterfly_policy!(v12);
let v13 = make_butterfly_policy!(v13);

// basic sanity checks
assert_eq!(v10.minimum_consensus_power, MINIMUM_CONSENSUS_POWER.into());
assert_eq!(v11.minimum_consensus_power, MINIMUM_CONSENSUS_POWER.into());
assert_eq!(v12.minimum_consensus_power, MINIMUM_CONSENSUS_POWER.into());
assert_eq!(v13.minimum_consensus_power, MINIMUM_CONSENSUS_POWER.into());
}
}
2 changes: 1 addition & 1 deletion src/networks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl Display for NetworkChain {
match self {
NetworkChain::Mainnet => write!(f, "mainnet"),
NetworkChain::Calibnet => write!(f, "calibnet"),
NetworkChain::Butterflynet => write!(f, "Butterflynet"),
NetworkChain::Butterflynet => write!(f, "butterflynet"),
NetworkChain::Devnet(name) => write!(f, "{name}"),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/state_migration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ where
]
}
NetworkChain::Butterflynet => {
vec![(Height::Watermelon, nv21::run_migration::<DB>)]
vec![(Height::Dragon, nv22::run_migration::<DB>)]
}
NetworkChain::Devnet(_) => {
vec![
Expand Down

0 comments on commit 515753f

Please sign in to comment.