From 56b9988fd717bf62cc2350b241a31a3b792d1b16 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 8 Feb 2024 18:03:27 -0800 Subject: [PATCH] Move QuantSpec into the miner actor Unfortunately, I had to duplicate a little bit of code in the market actor, but I think it's better to do that than to put this mostly miner specific logic in, e.g., the runtime. --- actors/market/src/lib.rs | 17 ++++-- actors/miner/src/bitfield_queue.rs | 4 +- actors/miner/src/deadline_info.rs | 4 +- actors/miner/src/deadline_state.rs | 4 +- actors/miner/src/deadlines.rs | 4 +- actors/miner/src/expiration_queue.rs | 4 +- actors/miner/src/expiration_queue/tests.rs | 3 +- actors/miner/src/lib.rs | 4 +- actors/miner/src/partition_state.rs | 5 +- actors/miner/src/quantize.rs | 53 +++++++++++++++++++ actors/miner/src/state.rs | 4 +- actors/miner/src/testing.rs | 5 +- actors/miner/src/vesting_state.rs | 4 +- actors/miner/tests/apply_rewards.rs | 9 ++-- actors/miner/tests/deadline_cron.rs | 6 +-- actors/miner/tests/deadline_state_test.rs | 6 +-- actors/miner/tests/expiration_queue.rs | 5 +- .../tests/miner_actor_test_bitfield_queue.rs | 4 +- .../tests/miner_actor_test_partitions.rs | 4 +- actors/miner/tests/record_skipped_faults.rs | 2 +- actors/miner/tests/state_harness.rs | 11 ++-- actors/miner/tests/util.rs | 7 ++- 22 files changed, 120 insertions(+), 49 deletions(-) create mode 100644 actors/miner/src/quantize.rs diff --git a/actors/market/src/lib.rs b/actors/market/src/lib.rs index b6ad8df30..12b7e3e28 100644 --- a/actors/market/src/lib.rs +++ b/actors/market/src/lib.rs @@ -14,7 +14,7 @@ use fvm_ipld_encoding::{RawBytes, DAG_CBOR}; use fvm_ipld_hamt::BytesKey; use fvm_shared::address::Address; use fvm_shared::bigint::BigInt; -use fvm_shared::clock::{ChainEpoch, QuantSpec, EPOCH_UNDEFINED}; +use fvm_shared::clock::{ChainEpoch, EPOCH_UNDEFINED}; use fvm_shared::deal::DealID; use fvm_shared::econ::TokenAmount; use fvm_shared::error::ExitCode; @@ -1550,8 +1550,19 @@ fn balance_of(rt: &impl Runtime, owner: &Address) -> Result ChainEpoch { - let q = QuantSpec { unit: interval, offset: id as i64 % interval }; - q.quantize_up(earliest) + // Same logic as QuantSpec from the miner actor, but duplicated here to avoid unnecessary + // dependencies. + let offset = id as i64 % interval; + let remainder = (earliest - offset) % interval; + let quotient = (earliest - offset) / interval; + + // Don't round if epoch falls on a quantization epoch or when negative (negative truncating + // division rounds up). + if remainder == 0 || earliest - offset < 0 { + interval * quotient + offset + } else { + interval * (quotient + 1) + offset + } } //////////////////////////////////////////////////////////////////////////////// diff --git a/actors/miner/src/bitfield_queue.rs b/actors/miner/src/bitfield_queue.rs index 6d3c1c969..673f7ee90 100644 --- a/actors/miner/src/bitfield_queue.rs +++ b/actors/miner/src/bitfield_queue.rs @@ -8,9 +8,11 @@ use fil_actors_runtime::{ActorDowncast, Array}; use fvm_ipld_amt::Error as AmtError; use fvm_ipld_bitfield::BitField; use fvm_ipld_blockstore::Blockstore; -use fvm_shared::clock::{ChainEpoch, QuantSpec}; +use fvm_shared::clock::ChainEpoch; use itertools::Itertools; +use super::QuantSpec; + /// Wrapper for working with an AMT[ChainEpoch]*Bitfield functioning as a queue, bucketed by epoch. /// Keys in the queue are quantized (upwards), modulo some offset, to reduce the cardinality of keys. pub struct BitFieldQueue<'db, BS> { diff --git a/actors/miner/src/deadline_info.rs b/actors/miner/src/deadline_info.rs index 8d1ec1c59..5b85804af 100644 --- a/actors/miner/src/deadline_info.rs +++ b/actors/miner/src/deadline_info.rs @@ -1,9 +1,11 @@ // Copyright 2019-2022 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT -use fvm_shared::clock::{ChainEpoch, QuantSpec}; +use fvm_shared::clock::ChainEpoch; use serde::{Deserialize, Serialize}; +use crate::QuantSpec; + /// Deadline calculations with respect to a current epoch. /// "Deadline" refers to the window during which proofs may be submitted. /// Windows are non-overlapping ranges [Open, Close), but the challenge epoch for a window occurs diff --git a/actors/miner/src/deadline_state.rs b/actors/miner/src/deadline_state.rs index 11eb89a9d..0a18d97ea 100644 --- a/actors/miner/src/deadline_state.rs +++ b/actors/miner/src/deadline_state.rs @@ -13,7 +13,7 @@ use fvm_ipld_bitfield::BitField; use fvm_ipld_blockstore::Blockstore; use fvm_ipld_encoding::tuple::*; use fvm_ipld_encoding::CborStore; -use fvm_shared::clock::{ChainEpoch, QuantSpec}; +use fvm_shared::clock::ChainEpoch; use fvm_shared::econ::TokenAmount; use fvm_shared::error::ExitCode; use fvm_shared::sector::{PoStProof, SectorSize}; @@ -21,7 +21,7 @@ use num_traits::{Signed, Zero}; use super::{ BitFieldQueue, ExpirationSet, Partition, PartitionSectorMap, PoStPartition, PowerPair, - SectorOnChainInfo, Sectors, TerminationResult, + QuantSpec, SectorOnChainInfo, Sectors, TerminationResult, }; use crate::SECTORS_AMT_BITWIDTH; diff --git a/actors/miner/src/deadlines.rs b/actors/miner/src/deadlines.rs index 707bcdad1..bd943f628 100644 --- a/actors/miner/src/deadlines.rs +++ b/actors/miner/src/deadlines.rs @@ -5,10 +5,10 @@ use fil_actors_runtime::runtime::Policy; use fil_actors_runtime::Array; use fvm_ipld_blockstore::Blockstore; -use fvm_shared::clock::{ChainEpoch, QuantSpec}; +use fvm_shared::clock::ChainEpoch; use fvm_shared::sector::SectorNumber; -use super::{DeadlineInfo, Deadlines, Partition}; +use super::{DeadlineInfo, Deadlines, Partition, QuantSpec}; pub fn new_deadline_info( policy: &Policy, diff --git a/actors/miner/src/expiration_queue.rs b/actors/miner/src/expiration_queue.rs index d6777c9e9..54fbefadf 100644 --- a/actors/miner/src/expiration_queue.rs +++ b/actors/miner/src/expiration_queue.rs @@ -13,12 +13,12 @@ use fvm_ipld_bitfield::BitField; use fvm_ipld_blockstore::Blockstore; use fvm_ipld_encoding::tuple::*; -use fvm_shared::clock::{ChainEpoch, QuantSpec}; +use fvm_shared::clock::ChainEpoch; use fvm_shared::econ::TokenAmount; use fvm_shared::sector::{SectorNumber, SectorSize}; use num_traits::{Signed, Zero}; -use super::{power_for_sector, PowerPair, SectorOnChainInfo}; +use super::{power_for_sector, PowerPair, QuantSpec, SectorOnChainInfo}; /// An internal limit on the cardinality of a bitfield in a queue entry. /// This must be at least large enough to support the maximum number of sectors in a partition. diff --git a/actors/miner/src/expiration_queue/tests.rs b/actors/miner/src/expiration_queue/tests.rs index 796a2d4fe..3b4986759 100644 --- a/actors/miner/src/expiration_queue/tests.rs +++ b/actors/miner/src/expiration_queue/tests.rs @@ -1,9 +1,10 @@ // Copyright 2019-2022 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT +use crate::NO_QUANTIZATION; + use super::*; use fil_actors_runtime::DealWeight; -use fvm_shared::clock::NO_QUANTIZATION; use fvm_shared::sector::StoragePower; #[test] diff --git a/actors/miner/src/lib.rs b/actors/miner/src/lib.rs index 8a8cf8623..017046214 100644 --- a/actors/miner/src/lib.rs +++ b/actors/miner/src/lib.rs @@ -18,7 +18,7 @@ use fvm_ipld_encoding::ipld_block::IpldBlock; use fvm_ipld_encoding::{from_slice, BytesDe, CborStore, RawBytes}; use fvm_shared::address::{Address, Payload, Protocol}; use fvm_shared::bigint::{BigInt, Integer}; -use fvm_shared::clock::{ChainEpoch, QuantSpec}; +use fvm_shared::clock::ChainEpoch; use fvm_shared::deal::DealID; use fvm_shared::econ::TokenAmount; use fvm_shared::error::*; @@ -60,6 +60,7 @@ use crate::ext::market::NO_ALLOCATION_ID; pub use monies::*; pub use partition_state::*; pub use policy::*; +pub use quantize::*; pub use sector_map::*; pub use sectors::*; pub use state::*; @@ -91,6 +92,7 @@ mod monies; mod notifications; mod partition_state; mod policy; +mod quantize; mod sector_map; mod sectors; mod state; diff --git a/actors/miner/src/partition_state.rs b/actors/miner/src/partition_state.rs index 9ff3c3e72..1eb2b6824 100644 --- a/actors/miner/src/partition_state.rs +++ b/actors/miner/src/partition_state.rs @@ -12,7 +12,7 @@ use fvm_ipld_bitfield::BitField; use fvm_ipld_blockstore::Blockstore; use fvm_ipld_encoding::tuple::*; use fvm_shared::bigint::bigint_ser; -use fvm_shared::clock::{ChainEpoch, QuantSpec, NO_QUANTIZATION}; +use fvm_shared::clock::ChainEpoch; use fvm_shared::econ::TokenAmount; use fvm_shared::error::ExitCode; use fvm_shared::sector::{SectorSize, StoragePower}; @@ -20,7 +20,8 @@ use num_traits::{Signed, Zero}; use super::{ power_for_sectors, select_sectors, validate_partition_contains_sectors, BitFieldQueue, - ExpirationQueue, ExpirationSet, SectorOnChainInfo, Sectors, TerminationResult, + ExpirationQueue, ExpirationSet, QuantSpec, SectorOnChainInfo, Sectors, TerminationResult, + NO_QUANTIZATION, }; // Bitwidth of AMTs determined empirically from mutation patterns and projections of mainnet data. diff --git a/actors/miner/src/quantize.rs b/actors/miner/src/quantize.rs new file mode 100644 index 000000000..f45f7ca3e --- /dev/null +++ b/actors/miner/src/quantize.rs @@ -0,0 +1,53 @@ +// Copyright 2021-2023 Protocol Labs +// Copyright 2019-2022 ChainSafe Systems +// SPDX-License-Identifier: Apache-2.0, MIT + +use fvm_shared::clock::ChainEpoch; + +/// Constant defining the [QuantSpec] which performs no quantization. +pub const NO_QUANTIZATION: QuantSpec = QuantSpec { unit: 1, offset: 0 }; + +/// A spec for epoch quantization. +#[derive(Copy, Clone)] +pub struct QuantSpec { + /// The unit of quantization + pub unit: ChainEpoch, + /// The offset from zero from which to base the modulus + pub offset: ChainEpoch, +} + +impl QuantSpec { + /// Rounds `epoch` to the nearest exact multiple of the quantization unit offset by + /// `offset % unit`, rounding up. + /// + /// This function is equivalent to `unit * ceil(epoch - (offset % unit) / unit) + (offsetSeed % unit)` + /// with the variables/operations over real numbers instead of ints. + /// + /// Precondition: `unit >= 0` + pub fn quantize_up(&self, epoch: ChainEpoch) -> ChainEpoch { + let offset = self.offset % self.unit; + + let remainder = (epoch - offset) % self.unit; + let quotient = (epoch - offset) / self.unit; + + // Don't round if epoch falls on a quantization epoch + if remainder == 0 + // Negative truncating division rounds up + || epoch - offset < 0 + { + self.unit * quotient + offset + } else { + self.unit * (quotient + 1) + offset + } + } + + pub fn quantize_down(&self, epoch: ChainEpoch) -> ChainEpoch { + let next = self.quantize_up(epoch); + // QuantizeDown == QuantizeUp iff epoch is a fixed point of QuantizeUp + if epoch == next { + next + } else { + next - self.unit + } + } +} diff --git a/actors/miner/src/state.rs b/actors/miner/src/state.rs index 58b542ad4..e4babb43f 100644 --- a/actors/miner/src/state.rs +++ b/actors/miner/src/state.rs @@ -22,7 +22,7 @@ use fvm_ipld_encoding::{strict_bytes, BytesDe, CborStore}; use fvm_ipld_hamt::Error as HamtError; use fvm_shared::address::Address; -use fvm_shared::clock::{ChainEpoch, QuantSpec, EPOCH_UNDEFINED}; +use fvm_shared::clock::{ChainEpoch, EPOCH_UNDEFINED}; use fvm_shared::econ::TokenAmount; use fvm_shared::error::ExitCode; use fvm_shared::sector::{RegisteredPoStProof, SectorNumber, SectorSize}; @@ -37,7 +37,7 @@ use super::types::*; use super::{ assign_deadlines, deadline_is_mutable, new_deadline_info_from_offset_and_epoch, quant_spec_for_deadline, BitFieldQueue, Deadline, DeadlineInfo, DeadlineSectorMap, Deadlines, - PowerPair, Sectors, TerminationResult, VestingFunds, + PowerPair, QuantSpec, Sectors, TerminationResult, VestingFunds, }; const PRECOMMIT_EXPIRY_AMT_BITWIDTH: u32 = 6; diff --git a/actors/miner/src/testing.rs b/actors/miner/src/testing.rs index 5ce2eb274..591109352 100644 --- a/actors/miner/src/testing.rs +++ b/actors/miner/src/testing.rs @@ -1,6 +1,7 @@ use crate::{ power_for_sectors, BitFieldQueue, Deadline, ExpirationQueue, MinerInfo, Partition, PowerPair, - SectorOnChainInfo, SectorOnChainInfoFlags, SectorPreCommitOnChainInfo, Sectors, State, + QuantSpec, SectorOnChainInfo, SectorOnChainInfoFlags, SectorPreCommitOnChainInfo, Sectors, + State, NO_QUANTIZATION, }; use fil_actors_runtime::runtime::Policy; use fil_actors_runtime::{ @@ -10,7 +11,7 @@ use fvm_ipld_bitfield::BitField; use fvm_ipld_blockstore::Blockstore; use fvm_ipld_encoding::CborStore; use fvm_shared::address::Protocol; -use fvm_shared::clock::{ChainEpoch, QuantSpec, NO_QUANTIZATION}; +use fvm_shared::clock::ChainEpoch; use fvm_shared::econ::TokenAmount; use fvm_shared::sector::{RegisteredPoStProof, SectorNumber, SectorSize}; use num_traits::Zero; diff --git a/actors/miner/src/vesting_state.rs b/actors/miner/src/vesting_state.rs index 861e99770..de247d383 100644 --- a/actors/miner/src/vesting_state.rs +++ b/actors/miner/src/vesting_state.rs @@ -4,12 +4,12 @@ use std::{iter, mem}; use fvm_ipld_encoding::tuple::*; -use fvm_shared::clock::{ChainEpoch, QuantSpec}; +use fvm_shared::clock::ChainEpoch; use fvm_shared::econ::TokenAmount; use itertools::{EitherOrBoth, Itertools}; use num_traits::Zero; -use super::VestSpec; +use super::{QuantSpec, VestSpec}; // Represents miner funds that will vest at the given epoch. #[derive(Debug, Serialize_tuple, Deserialize_tuple)] diff --git a/actors/miner/tests/apply_rewards.rs b/actors/miner/tests/apply_rewards.rs index 65847ab7c..55bfe2515 100644 --- a/actors/miner/tests/apply_rewards.rs +++ b/actors/miner/tests/apply_rewards.rs @@ -1,7 +1,6 @@ -use fil_actor_miner::locked_reward_from_reward; -use fil_actor_miner::ApplyRewardParams; -use fil_actor_miner::REWARD_VESTING_SPEC; -use fil_actor_miner::{Actor, Method}; +use fil_actor_miner::{ + locked_reward_from_reward, Actor, ApplyRewardParams, Method, QuantSpec, REWARD_VESTING_SPEC, +}; use fil_actor_power::Method as PowerMethod; use fil_actors_runtime::runtime::Runtime; use fil_actors_runtime::runtime::RuntimePolicy; @@ -11,7 +10,7 @@ use fil_actors_runtime::REWARD_ACTOR_ADDR; use fil_actors_runtime::STORAGE_POWER_ACTOR_ADDR; use fvm_shared::bigint::Zero; -use fvm_shared::clock::{ChainEpoch, QuantSpec}; +use fvm_shared::clock::ChainEpoch; use fvm_shared::econ::TokenAmount; use fvm_shared::error::ExitCode; use fvm_shared::METHOD_SEND; diff --git a/actors/miner/tests/deadline_cron.rs b/actors/miner/tests/deadline_cron.rs index 1818a3054..1adc3305f 100644 --- a/actors/miner/tests/deadline_cron.rs +++ b/actors/miner/tests/deadline_cron.rs @@ -1,14 +1,14 @@ use fil_actor_miner::testing::{check_deadline_state_invariants, DeadlineStateSummary}; use fil_actor_miner::{ - pledge_penalty_for_continued_fault, power_for_sectors, Deadline, PowerPair, SectorOnChainInfo, - REWARD_VESTING_SPEC, + pledge_penalty_for_continued_fault, power_for_sectors, Deadline, PowerPair, QuantSpec, + SectorOnChainInfo, REWARD_VESTING_SPEC, }; use fil_actors_runtime::runtime::RuntimePolicy; use fil_actors_runtime::test_utils::MockRuntime; use fil_actors_runtime::{MessageAccumulator, EPOCHS_IN_DAY}; use fvm_ipld_bitfield::BitField; use fvm_shared::bigint::Zero; -use fvm_shared::clock::{ChainEpoch, QuantSpec}; +use fvm_shared::clock::ChainEpoch; use fvm_shared::econ::TokenAmount; use fvm_shared::sector::SectorSize; use std::ops::Neg; diff --git a/actors/miner/tests/deadline_state_test.rs b/actors/miner/tests/deadline_state_test.rs index 7ca1520c4..6a4e1dd75 100644 --- a/actors/miner/tests/deadline_state_test.rs +++ b/actors/miner/tests/deadline_state_test.rs @@ -2,8 +2,8 @@ use std::collections::HashMap; use fil_actor_miner::testing::{check_deadline_state_invariants, DeadlineStateSummary}; use fil_actor_miner::{ - power_for_sectors, Deadline, PartitionSectorMap, PoStPartition, PowerPair, SectorOnChainInfo, - TerminationResult, + power_for_sectors, Deadline, PartitionSectorMap, PoStPartition, PowerPair, QuantSpec, + SectorOnChainInfo, TerminationResult, }; use fil_actors_runtime::runtime::{Policy, Runtime}; use fil_actors_runtime::test_utils::MockRuntime; @@ -12,7 +12,7 @@ use fil_actors_runtime::MessageAccumulator; use fvm_ipld_bitfield::BitField; use fvm_ipld_blockstore::Blockstore; use fvm_shared::clock::ChainEpoch; -use fvm_shared::{clock::QuantSpec, error::ExitCode, sector::SectorSize}; +use fvm_shared::{error::ExitCode, sector::SectorSize}; mod util; use crate::util::*; diff --git a/actors/miner/tests/expiration_queue.rs b/actors/miner/tests/expiration_queue.rs index 47379d520..90aae1cb0 100644 --- a/actors/miner/tests/expiration_queue.rs +++ b/actors/miner/tests/expiration_queue.rs @@ -1,5 +1,6 @@ use fil_actor_miner::{ - power_for_sectors, ExpirationQueue, ExpirationSet, PowerPair, SectorOnChainInfo, + power_for_sectors, ExpirationQueue, ExpirationSet, PowerPair, QuantSpec, SectorOnChainInfo, + NO_QUANTIZATION, }; use fil_actors_runtime::test_blockstores::MemoryBlockstore; use fil_actors_runtime::{ @@ -9,7 +10,7 @@ use fil_actors_runtime::{ use fvm_ipld_amt::Amt; use fvm_ipld_bitfield::{BitField, MaybeBitField}; use fvm_shared::bigint::Zero; -use fvm_shared::clock::{ChainEpoch, QuantSpec, NO_QUANTIZATION}; +use fvm_shared::clock::ChainEpoch; use fvm_shared::econ::TokenAmount; use fvm_shared::sector::{SectorNumber, SectorSize, StoragePower}; use std::convert::TryInto; diff --git a/actors/miner/tests/miner_actor_test_bitfield_queue.rs b/actors/miner/tests/miner_actor_test_bitfield_queue.rs index e36d5c1e9..6604de5fd 100644 --- a/actors/miner/tests/miner_actor_test_bitfield_queue.rs +++ b/actors/miner/tests/miner_actor_test_bitfield_queue.rs @@ -1,10 +1,10 @@ -use fil_actor_miner::BitFieldQueue; +use fil_actor_miner::{BitFieldQueue, QuantSpec, NO_QUANTIZATION}; use fil_actors_runtime::test_blockstores::MemoryBlockstore; use fil_actors_runtime::test_utils::MockRuntime; use fvm_ipld_amt::Amt; use fvm_ipld_bitfield::BitField; use fvm_ipld_bitfield::MaybeBitField; -use fvm_shared::clock::{ChainEpoch, QuantSpec, NO_QUANTIZATION}; +use fvm_shared::clock::ChainEpoch; use std::iter::FromIterator; mod util; diff --git a/actors/miner/tests/miner_actor_test_partitions.rs b/actors/miner/tests/miner_actor_test_partitions.rs index ded5e51ab..2d406a0e8 100644 --- a/actors/miner/tests/miner_actor_test_partitions.rs +++ b/actors/miner/tests/miner_actor_test_partitions.rs @@ -1,6 +1,6 @@ use fil_actor_miner::{ power_for_sectors, testing::PartitionStateSummary, BitFieldQueue, ExpirationQueue, Partition, - PowerPair, SectorOnChainInfo, + PowerPair, QuantSpec, SectorOnChainInfo, }; use fil_actors_runtime::runtime::Policy; use fil_actors_runtime::test_blockstores::MemoryBlockstore; @@ -8,7 +8,7 @@ use fil_actors_runtime::test_utils::*; use fil_actors_runtime::MessageAccumulator; use fvm_ipld_bitfield::BitField; use fvm_ipld_encoding::RawBytes; -use fvm_shared::clock::{ChainEpoch, QuantSpec}; +use fvm_shared::clock::ChainEpoch; use fvm_shared::econ::TokenAmount; use fvm_shared::sector::{RegisteredSealProof, SectorSize}; diff --git a/actors/miner/tests/record_skipped_faults.rs b/actors/miner/tests/record_skipped_faults.rs index 718d1019e..bc45481a3 100644 --- a/actors/miner/tests/record_skipped_faults.rs +++ b/actors/miner/tests/record_skipped_faults.rs @@ -2,6 +2,7 @@ use fil_actor_miner::power_for_sectors; use fil_actor_miner::select_sectors; use fil_actor_miner::testing::PartitionStateSummary; use fil_actor_miner::Partition; +use fil_actor_miner::QuantSpec; use fil_actor_miner::SectorOnChainInfo; use fil_actors_runtime::runtime::Policy; use fil_actors_runtime::ActorError; @@ -10,7 +11,6 @@ use fvm_ipld_bitfield::BitField; use fil_actors_runtime::test_blockstores::MemoryBlockstore; use fvm_shared::clock::ChainEpoch; -use fvm_shared::clock::QuantSpec; use fvm_shared::error::ExitCode; use fvm_shared::sector::SectorSize; use std::ops::Neg; diff --git a/actors/miner/tests/state_harness.rs b/actors/miner/tests/state_harness.rs index 6e7eccb97..bd79616d9 100644 --- a/actors/miner/tests/state_harness.rs +++ b/actors/miner/tests/state_harness.rs @@ -1,10 +1,9 @@ #![allow(dead_code)] use cid::multihash::Code::Blake2b256; -use fil_actor_miner::MinerInfo; -use fil_actor_miner::SectorPreCommitOnChainInfo; -use fil_actor_miner::VestSpec; -use fil_actor_miner::VestingFunds; -use fil_actor_miner::{BitFieldQueue, CollisionPolicy, SectorOnChainInfo, State}; +use fil_actor_miner::{ + BitFieldQueue, CollisionPolicy, MinerInfo, QuantSpec, SectorOnChainInfo, + SectorPreCommitOnChainInfo, State, VestSpec, VestingFunds, +}; use fil_actors_runtime::test_blockstores::MemoryBlockstore; use fil_actors_runtime::{runtime::Policy, ActorError}; use fvm_ipld_bitfield::BitField; @@ -13,7 +12,7 @@ use fvm_ipld_encoding::CborStore; use fvm_ipld_hamt::Error as HamtError; use fvm_shared::econ::TokenAmount; use fvm_shared::sector::{SectorNumber, SectorSize}; -use fvm_shared::{clock::ChainEpoch, clock::QuantSpec, sector::RegisteredPoStProof}; +use fvm_shared::{clock::ChainEpoch, sector::RegisteredPoStProof}; use fil_actors_runtime::test_utils::*; diff --git a/actors/miner/tests/util.rs b/actors/miner/tests/util.rs index 8a3e1cb51..d750933a4 100644 --- a/actors/miner/tests/util.rs +++ b/actors/miner/tests/util.rs @@ -19,8 +19,7 @@ use fvm_ipld_encoding::{BytesDe, CborStore, RawBytes}; use fvm_shared::address::Address; use fvm_shared::bigint::BigInt; use fvm_shared::bigint::Zero; -use fvm_shared::clock::QuantSpec; -use fvm_shared::clock::{ChainEpoch, NO_QUANTIZATION}; +use fvm_shared::clock::ChainEpoch; use fvm_shared::commcid::{FIL_COMMITMENT_SEALED, FIL_COMMITMENT_UNSEALED}; use fvm_shared::consensus::ConsensusFault; use fvm_shared::crypto::hash::SupportedHashes; @@ -75,13 +74,13 @@ use fil_actor_miner::{ PieceActivationManifest, PieceChange, PieceReturn, PoStPartition, PowerPair, PreCommitSectorBatchParams, PreCommitSectorBatchParams2, PreCommitSectorParams, ProveCommitAggregateParams, ProveCommitSectorParams, ProveCommitSectors3Params, - ProveCommitSectors3Return, RecoveryDeclaration, ReportConsensusFaultParams, + ProveCommitSectors3Return, QuantSpec, RecoveryDeclaration, ReportConsensusFaultParams, SectorActivationManifest, SectorChanges, SectorContentChangedParams, SectorContentChangedReturn, SectorOnChainInfo, SectorPreCommitInfo, SectorPreCommitOnChainInfo, SectorReturn, SectorUpdateManifest, Sectors, State, SubmitWindowedPoStParams, TerminateSectorsParams, TerminationDeclaration, VerifiedAllocationKey, VestingFunds, WindowedPoSt, WithdrawBalanceParams, WithdrawBalanceReturn, CRON_EVENT_PROVING_DEADLINE, - REWARD_VESTING_SPEC, SECTORS_AMT_BITWIDTH, SECTOR_CONTENT_CHANGED, + NO_QUANTIZATION, REWARD_VESTING_SPEC, SECTORS_AMT_BITWIDTH, SECTOR_CONTENT_CHANGED, }; use fil_actor_miner::{ProveReplicaUpdates3Params, ProveReplicaUpdates3Return}; use fil_actor_power::{