Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetworkVersion 11 Upgrade at Epoch 665280 #1066

Merged
merged 6 commits into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ jobs:
- restore_cargo_package_cache
- run:
name: Build Docs
command: cargo doc --no-deps --all-features
command: cargo doc --no-deps
- run:
name: Publish Docs
command: bash ./scripts/build-rust-docs.sh
Expand Down
5 changes: 4 additions & 1 deletion types/networks/src/interopnet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ pub const UPGRADE_ORANGE_HEIGHT: ChainEpoch = 180;
/// Remove burn on window PoSt fork
pub const UPGRADE_CLAUS_HEIGHT: ChainEpoch = 210;
/// V10 network upgrade height TBD
pub const UPGRADE_ACTORS_V3_HEIGHT: ChainEpoch = 999999999;
pub const UPGRADE_ACTORS_V3_HEIGHT: ChainEpoch = 999999998;
/// V11 network upgrade
pub const UPGRADE_NORWEGIAN_HEIGHT: ChainEpoch = 999999999;

pub const UPGRADE_PLACEHOLDER_HEIGHT: ChainEpoch = 9999999;

/// Current network version for the network
Expand Down
6 changes: 5 additions & 1 deletion types/networks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct DrandPoint<'a> {
pub config: &'a DrandConfig<'a>,
}

const VERSION_SCHEDULE: [Upgrade; 10] = [
const VERSION_SCHEDULE: [Upgrade; 11] = [
Upgrade {
height: UPGRADE_BREEZE_HEIGHT,
network: NetworkVersion::V1,
Expand Down Expand Up @@ -74,6 +74,10 @@ const VERSION_SCHEDULE: [Upgrade; 10] = [
height: UPGRADE_ACTORS_V3_HEIGHT,
network: NetworkVersion::V10,
},
Upgrade {
height: UPGRADE_NORWEGIAN_HEIGHT,
network: NetworkVersion::V11,
},
cryptoquick marked this conversation as resolved.
Show resolved Hide resolved
];

/// Gets network version from epoch using default Mainnet schedule.
Expand Down
6 changes: 4 additions & 2 deletions types/networks/src/mainnet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ pub const UPGRADE_PERSIAN_HEIGHT: ChainEpoch = 272400;
pub const UPGRADE_ORANGE_HEIGHT: ChainEpoch = 336458;
/// Remove burn on window PoSt fork
pub const UPGRADE_CLAUS_HEIGHT: ChainEpoch = 343200;
/// V10 network upgrade height
/// V10 network upgrade
pub const UPGRADE_ACTORS_V3_HEIGHT: ChainEpoch = 550321;
/// V11 network upgrade
pub const UPGRADE_NORWEGIAN_HEIGHT: ChainEpoch = 665280;

pub const UPGRADE_PLACEHOLDER_HEIGHT: ChainEpoch = 9999999;

/// Current network version for the network
pub const NEWEST_NETWORK_VERSION: NetworkVersion = NetworkVersion::V10;
pub const NEWEST_NETWORK_VERSION: NetworkVersion = NetworkVersion::V11;

/// Bootstrap peer ids
pub const DEFAULT_BOOTSTRAP: &[&str] = &[
Expand Down
4 changes: 3 additions & 1 deletion types/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ pub enum NetworkVersion {
V9,
/// actors v3 (specs-actors v3.0.x)
V10,
/// reserved
/// norwegian (specs-actor v3.1.x)
V11,
/// reserved
V12,
}
19 changes: 10 additions & 9 deletions vm/actor/src/builtin/miner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,7 @@ impl Actor {

let (power_delta, pledge_delta) = rt.transaction(|state: &mut State, rt| {
let info = get_miner_info(rt.store(), state)?;

let nv = rt.network_version();
rt.validate_immediate_caller_is(
info.control_addresses
.iter()
Expand Down Expand Up @@ -1772,7 +1772,7 @@ impl Actor {
let new_sectors: Vec<SectorOnChainInfo> = old_sectors
.iter()
.map(|sector| {
if !can_extend_seal_proof_type(sector.seal_proof) {
if !can_extend_seal_proof_type(sector.seal_proof, nv) {
return Err(actor_error!(
ErrForbidden,
"cannot extend expiration for sector {} with unsupported \
Expand Down Expand Up @@ -3249,13 +3249,14 @@ where
}

// total sector lifetime cannot exceed SectorMaximumLifetime for the sector's seal proof
let max_lifetime = seal_proof_sector_maximum_lifetime(seal_proof).ok_or_else(|| {
actor_error!(
ErrIllegalArgument,
"unrecognized seal proof type {:?}",
seal_proof
)
})?;
let max_lifetime = seal_proof_sector_maximum_lifetime(seal_proof, rt.network_version())
.ok_or_else(|| {
actor_error!(
ErrIllegalArgument,
"unrecognized seal proof type {:?}",
seal_proof
)
})?;
if expiration - activation > max_lifetime {
return Err(actor_error!(
ErrIllegalArgument,
Expand Down
28 changes: 22 additions & 6 deletions vm/actor/src/builtin/miner/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,13 @@ pub fn can_pre_commit_seal_proof(proof: RegisteredSealProof, nv: NetworkVersion)
}

/// Checks whether a seal proof type is supported for new miners and sectors.
pub fn can_extend_seal_proof_type(proof: RegisteredSealProof) -> bool {
pub fn can_extend_seal_proof_type(proof: RegisteredSealProof, nv: NetworkVersion) -> bool {
use RegisteredSealProof::*;

matches!(proof, StackedDRG32GiBV1P1 | StackedDRG64GiBV1P1)
// Between V7 and V11, older seal proof types could not be extended (see FIP 0014).
if nv >= NetworkVersion::V7 && nv <= NetworkVersion::V10 {
return matches!(proof, StackedDRG32GiBV1P1 | StackedDRG64GiBV1P1);
}
true
}

/// Maximum duration to allow for the sealing process for seal algorithms.
Expand All @@ -131,12 +134,25 @@ pub fn max_prove_commit_duration(proof: RegisteredSealProof) -> Option<ChainEpoc

/// Maximum duration to allow for the sealing process for seal algorithms.
/// Dependent on algorithm and sector size
pub fn seal_proof_sector_maximum_lifetime(proof: RegisteredSealProof) -> Option<ChainEpoch> {
pub fn seal_proof_sector_maximum_lifetime(
proof: RegisteredSealProof,
nv: NetworkVersion,
) -> Option<ChainEpoch> {
use RegisteredSealProof::*;
if nv < NetworkVersion::V11 {
return match proof {
StackedDRG32GiBV1 | StackedDRG2KiBV1 | StackedDRG8MiBV1 | StackedDRG512MiBV1
| StackedDRG64GiBV1 | StackedDRG32GiBV1P1 | StackedDRG2KiBV1P1 | StackedDRG8MiBV1P1
| StackedDRG512MiBV1P1 | StackedDRG64GiBV1P1 => Some(EPOCHS_IN_YEAR * 5),
_ => None,
};
}
// In NetworkVersion 11, we allow for sectors using the old proofs to be extended by 540 days.
match proof {
StackedDRG32GiBV1 | StackedDRG2KiBV1 | StackedDRG8MiBV1 | StackedDRG512MiBV1
| StackedDRG64GiBV1 | StackedDRG32GiBV1P1 | StackedDRG2KiBV1P1 | StackedDRG8MiBV1P1
| StackedDRG512MiBV1P1 | StackedDRG64GiBV1P1 => Some(EPOCHS_IN_YEAR * 5),
| StackedDRG64GiBV1 => Some(EPOCHS_IN_DAY * 540),
StackedDRG32GiBV1P1 | StackedDRG2KiBV1P1 | StackedDRG8MiBV1P1 | StackedDRG512MiBV1P1
| StackedDRG64GiBV1P1 => Some(EPOCHS_IN_YEAR * 5),
_ => None,
}
}
Expand Down