diff --git a/Cargo.lock b/Cargo.lock index 88311f5d00ba..24fb9feac633 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -948,9 +948,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.72" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" dependencies = [ "jobserver", ] @@ -1414,11 +1414,12 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-common" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4600d695eb3f6ce1cd44e6e291adceb2cc3ab12f20a33777ecd0bf6eba34e06" +checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" dependencies = [ "generic-array", + "typenum", ] [[package]] @@ -1554,9 +1555,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "3.2.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" dependencies = [ "byteorder 1.4.3", "digest 0.9.0", @@ -1678,9 +1679,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb780dce4f9a8f5c087362b3a4595936b2019e7c8b30f2c3e9a7e94e6ae9837" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" dependencies = [ "block-buffer 0.10.2", "crypto-common", @@ -3396,7 +3397,7 @@ dependencies = [ "once_cell", "serde", "serde_bytes", - "sha2 0.10.1", + "sha2 0.10.2", "thiserror", "unsigned-varint 0.7.1", ] @@ -3628,9 +3629,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.117" +version = "0.2.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c" +checksum = "06e509672465a0504304aa87f9f176f2b2b716ed8fb105ebe5c02dc6dce96a94" [[package]] name = "libloading" @@ -4557,9 +4558,9 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" [[package]] name = "mime_guess" -version = "2.0.3" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" dependencies = [ "mime", "unicase", @@ -4655,7 +4656,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "424f6e86263cd5294cbd7f1e95746b95aca0e0d66bff31e5a40d6baa87b4aa99" dependencies = [ - "proc-macro-crate 1.1.0", + "proc-macro-crate 1.1.2", "proc-macro-error", "proc-macro2 1.0.36", "quote 1.0.15", @@ -5335,9 +5336,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebace6889caf889b4d3f76becee12e90353f2b8c7d875534a71e5742f8f6f83" +checksum = "9dada8c9981fcf32929c3c0f0cd796a9284aca335565227ed88c83babb1d43dc" dependencies = [ "thiserror", "toml", @@ -6319,13 +6320,13 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99c3bd8169c58782adad9290a9af5939994036b76187f7b4f0e6de91dbbfc0ec" +checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest 0.10.2", + "digest 0.10.3", ] [[package]] @@ -7255,9 +7256,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.16.1" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c27a64b625de6d309e8c57716ba93021dccf1b3b5c97edd6d3dd2d2135afc0a" +checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" dependencies = [ "num_cpus", "pin-project-lite 0.2.8", diff --git a/Makefile b/Makefile index ba9412c62bf4..4c0cf7b59bde 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,9 @@ interopnet: devnet: cargo build --manifest-path=forest/Cargo.toml --no-default-features --features "devnet, rocksdb" +calibnet: + cargo build --release --manifest-path=forest/Cargo.toml --no-default-features --features "calibnet, rocksdb" + docker-run: docker build -t forest:latest -f ./Dockerfile . && docker run forest diff --git a/forest/Cargo.toml b/forest/Cargo.toml index 5517e1131594..ef503063f77e 100644 --- a/forest/Cargo.toml +++ b/forest/Cargo.toml @@ -70,6 +70,7 @@ rocksdb = ["db/rocksdb", "ipld_blockstore/rocksdb"] sled = ["db/sled", "ipld_blockstore/sled"] devnet = ["actor/devnet", "networks/devnet", "testnet"] interopnet = ["actor/interopnet", "networks/interopnet", "testnet"] +calibnet = ["networks/calibnet", "actor/calibnet", "testnet"] insecure_post = ["chain_sync/insecure_post"] testnet = [] release = [] diff --git a/forest/build.rs b/forest/build.rs index 53a9eb038aa5..f9f2ea29d2f9 100644 --- a/forest/build.rs +++ b/forest/build.rs @@ -9,10 +9,12 @@ const RELEASE_TRACK: &str = "unstable"; #[cfg(feature = "release")] const RELEASE_TRACK: &str = "alpha"; -const NETWORK: &str = if cfg!(devnet) { +const NETWORK: &str = if cfg!(feature = "devnet") { "devnet" -} else if cfg!(interopnet) { +} else if cfg!(feature = "interopnet") { "interopnet" +} else if cfg!(feature = "calibnet") { + "calibnet" } else { "mainnet" }; diff --git a/forest/src/daemon.rs b/forest/src/daemon.rs index e74fd88e4de0..03ff7faa84cd 100644 --- a/forest/src/daemon.rs +++ b/forest/src/daemon.rs @@ -29,7 +29,7 @@ use std::sync::Arc; /// Starts daemon process pub(super) async fn start(config: Config) { // Set the Address network prefix - #[cfg(feature = "testnet")] + #[cfg(any(feature = "testnet"))] address::NETWORK_DEFAULT .set(address::Network::Testnet) .unwrap(); @@ -144,6 +144,8 @@ pub(super) async fn start(config: Config) { .await .unwrap(); + info!("Using network :: {}", network_name); + let validate_height = if config.snapshot { None } else { Some(0) }; // Sync from snapshot if let Some(path) = &config.snapshot_path { diff --git a/ipld/hamt/src/node.rs b/ipld/hamt/src/node.rs index 4d5dbe812e96..7144838f31d4 100644 --- a/ipld/hamt/src/node.rs +++ b/ipld/hamt/src/node.rs @@ -389,10 +389,11 @@ where let deleted = child_node.rm_value(hashed_key, bit_width, depth + 1, key, store)?; if deleted.is_some() { *child = Pointer::Dirty(std::mem::take(child_node)); + + // Clean to retrieve canonical form + child.clean()?; } - // Clean to retrieve canonical form - child.clean()?; Ok(deleted) } Pointer::Dirty(n) => { diff --git a/types/networks/Cargo.toml b/types/networks/Cargo.toml index 9f2a5ad3de80..5f42a9cc8a82 100644 --- a/types/networks/Cargo.toml +++ b/types/networks/Cargo.toml @@ -15,4 +15,5 @@ serde_json = "1.0" mainnet = [] interopnet = [] devnet = [] -conformance = [] \ No newline at end of file +conformance = [] +calibnet = [] diff --git a/types/networks/src/calibnet/genesis.car b/types/networks/src/calibnet/genesis.car new file mode 100644 index 000000000000..cbade953f866 Binary files /dev/null and b/types/networks/src/calibnet/genesis.car differ diff --git a/types/networks/src/calibnet/mod.rs b/types/networks/src/calibnet/mod.rs new file mode 100644 index 000000000000..bdbf4cf864ff --- /dev/null +++ b/types/networks/src/calibnet/mod.rs @@ -0,0 +1,95 @@ +// Copyright 2019-2022 ChainSafe Systems +// SPDX-License-Identifier: Apache-2.0, MIT + +use super::{drand::DRAND_MAINNET, DrandPoint}; +use clock::{ChainEpoch, EPOCH_DURATION_SECONDS}; +use fil_types::NetworkVersion; + +/// Default genesis car file bytes. +pub const DEFAULT_GENESIS: &[u8] = include_bytes!("genesis.car"); + +/// V1 network upgrade +#[cfg(feature = "calibnet")] +pub const UPGRADE_BREEZE_HEIGHT: ChainEpoch = -1; + +/// V2 network upgrade +#[cfg(feature = "calibnet")] +pub const UPGRADE_SMOKE_HEIGHT: ChainEpoch = -2; + +/// V3 network upgrade +#[cfg(feature = "calibnet")] +pub const UPGRADE_IGNITION_HEIGHT: ChainEpoch = -3; + +/// V4 network upgrade +#[cfg(feature = "calibnet")] +pub const UPGRADE_ACTORS_V2_HEIGHT: ChainEpoch = 30; + +/// V5 network upgrade +#[cfg(feature = "calibnet")] +pub const UPGRADE_TAPE_HEIGHT: ChainEpoch = 60; + +#[cfg(feature = "calibnet")] +pub const UPGRADE_LIFTOFF_HEIGHT: i64 = -5; + +/// V6 network upgrade +#[cfg(feature = "calibnet")] +pub const UPGRADE_KUMQUAT_HEIGHT: ChainEpoch = 90; + +/// V7 network upgrade +#[cfg(feature = "calibnet")] +pub const UPGRADE_CALICO_HEIGHT: ChainEpoch = 120; + +/// V8 network upgrade +#[cfg(feature = "calibnet")] +pub const UPGRADE_PERSIAN_HEIGHT: ChainEpoch = 130; + +/// V9 network upgrade +#[cfg(feature = "calibnet")] +pub const UPGRADE_ORANGE_HEIGHT: ChainEpoch = 300; + +/// Remove burn on window PoSt fork +#[cfg(feature = "calibnet")] +pub const UPGRADE_CLAUS_HEIGHT: ChainEpoch = 270; + +/// V10 network upgrade +#[cfg(feature = "calibnet")] +pub const UPGRADE_ACTORS_V3_HEIGHT: ChainEpoch = 330; + +/// V11 network upgrade +#[cfg(feature = "calibnet")] +pub const UPGRADE_NORWEGIAN_HEIGHT: ChainEpoch = 360; + +/// V12 network upgrade +#[cfg(feature = "calibnet")] +pub const UPGRADE_ACTORS_V4_HEIGHT: ChainEpoch = 390; + +/// V13 network upgrade +#[cfg(feature = "calibnet")] +pub const UPGRADE_HYPERDRIVE_HEIGHT: ChainEpoch = 420; + +/// V14 network update +#[cfg(feature = "calibnet")] +pub const UPGRADE_ACTORS_V6_HEIGHT: ChainEpoch = 312746; + +pub const UPGRADE_PLACEHOLDER_HEIGHT: ChainEpoch = 9999999; + +/// Current network version for the network +pub const NEWEST_NETWORK_VERSION: NetworkVersion = NetworkVersion::V14; + +/// Bootstrap peer ids +pub const DEFAULT_BOOTSTRAP: &[&str] = &[ + "/dns4/bootstrap-0.calibration.fildev.network/tcp/1347/p2p/12D3KooWJkikQQkxS58spo76BYzFt4fotaT5NpV2zngvrqm4u5ow", + "/dns4/bootstrap-1.calibration.fildev.network/tcp/1347/p2p/12D3KooWLce5FDHR4EX4CrYavphA5xS3uDsX6aoowXh5tzDUxJav", + "/dns4/bootstrap-2.calibration.fildev.network/tcp/1347/p2p/12D3KooWA9hFfQG9GjP6bHeuQQbMD3FDtZLdW1NayxKXUT26PQZu", + "/dns4/bootstrap-3.calibration.fildev.network/tcp/1347/p2p/12D3KooWMHDi3LVTFG8Szqogt7RkNXvonbQYqSazxBx41A5aeuVz", +]; + +lazy_static! { + pub(super) static ref DRAND_SCHEDULE: [DrandPoint<'static>; 1] = [DrandPoint { + height: 0, + config: &*DRAND_MAINNET, + },]; +} + +/// Time, in seconds, between each block. +pub const BLOCK_DELAY_SECS: u64 = EPOCH_DURATION_SECONDS as u64; diff --git a/types/networks/src/lib.rs b/types/networks/src/lib.rs index a2b93760f9d1..41b5246b356c 100644 --- a/types/networks/src/lib.rs +++ b/types/networks/src/lib.rs @@ -15,6 +15,7 @@ mod drand; not(feature = "devnet"), not(feature = "mainnet"), not(feature = "conformance"), + not(feature = "calibnet") ))] compile_error!( "No network feature selected. Exactly one of \"mainnet\", \"devnet\", \"interopnet\", or \"conformance\" must be enabled for this crate." @@ -22,34 +23,67 @@ compile_error!( #[cfg(all( feature = "mainnet", - any(feature = "interopnet", feature = "devnet", feature = "conformance",) + any( + feature = "interopnet", + feature = "devnet", + feature = "conformance", + feature = "calibnet" + ) ))] compile_error!( - "\"mainnet\" feature cannot be combined with \"devnet\", \"interopnet\", or \"conformance\"." + "\"mainnet\" feature cannot be combined with \"devnet\", \"interopnet\", or \"conformance\", or \"calibnet\"." ); #[cfg(all( feature = "conformance", - any(feature = "interopnet", feature = "devnet", feature = "mainnet",) + any( + feature = "interopnet", + feature = "devnet", + feature = "mainnet", + feature = "calibnet" + ) ))] compile_error!( - "\"conformance\" feature cannot be combined with \"devnet\", \"interopnet\", or \"mainnet\"." + "\"conformance\" feature cannot be combined with \"devnet\", \"interopnet\", or \"mainnet\", \"calibnet\"." ); #[cfg(all( feature = "devnet", - any(feature = "interopnet", feature = "conformance", feature = "mainnet",) + any( + feature = "interopnet", + feature = "conformance", + feature = "mainnet", + feature = "calibnet" + ) ))] compile_error!( - "\"devnet\" feature cannot be combined with \"conformance\", \"interopnet\", or \"mainnet\"." + "\"devnet\" feature cannot be combined with \"conformance\", \"interopnet\", or \"mainnet\", \"calibnet\"." ); #[cfg(all( feature = "interopnet", - any(feature = "conformance", feature = "devnet", feature = "mainnet",) + any( + feature = "conformance", + feature = "devnet", + feature = "mainnet", + feature = "calibnet" + ) ))] compile_error!( - "\"interopnet\" feature cannot be combined with \"devnet\", \"conformance\", or \"mainnet\"." + "\"interopnet\" feature cannot be combined with \"devnet\", \"conformance\", or \"mainnet\", \"calibnet\"." +); + +#[cfg(all( + feature = "calibnet", + any( + feature = "conformance", + feature = "devnet", + feature = "mainnet", + feature = "interopnet" + ) +))] +compile_error!( + "\"interopnet\" feature cannot be combined with \"devnet\", \"conformance\", or \"mainnet\", \"interopnet\"." ); // Both mainnet and conformance parameters are kept in the 'mainnet' module. @@ -68,6 +102,11 @@ mod devnet; #[cfg(feature = "devnet")] pub use self::devnet::*; +#[cfg(feature = "calibnet")] +mod calibnet; +#[cfg(feature = "calibnet")] +pub use self::calibnet::*; + /// Defines the different hard fork parameters. struct Upgrade { /// When the hard fork will happen diff --git a/vm/actor/Cargo.toml b/vm/actor/Cargo.toml index b242f0246fea..8350cbe2a724 100644 --- a/vm/actor/Cargo.toml +++ b/vm/actor/Cargo.toml @@ -44,3 +44,4 @@ libp2p = { version = "0.40.0-rc.1", default-features = false } [features] devnet = [] interopnet = [] +calibnet = [] diff --git a/vm/actor/src/builtin/miner/policy.rs b/vm/actor/src/builtin/miner/policy.rs index 4e335ff9bc68..d576026859e1 100644 --- a/vm/actor/src/builtin/miner/policy.rs +++ b/vm/actor/src/builtin/miner/policy.rs @@ -109,6 +109,16 @@ pub fn can_pre_commit_seal_proof(proof: RegisteredSealProof) -> bool { } } + #[cfg(feature = "calibnet")] + { + if matches!( + proof, + StackedDRG32GiBV1 | StackedDRG64GiBV1 | StackedDRG32GiBV1P1 | StackedDRG64GiBV1P1 + ) { + return true; + } + } + matches!(proof, StackedDRG32GiBV1P1 | StackedDRG64GiBV1P1) } diff --git a/vm/actor/src/builtin/sector.rs b/vm/actor/src/builtin/sector.rs index c73882137f34..83412e78f37c 100644 --- a/vm/actor/src/builtin/sector.rs +++ b/vm/actor/src/builtin/sector.rs @@ -23,6 +23,9 @@ pub fn consensus_miner_min_power(p: RegisteredPoStProof) -> Result