6f7498b622
* [WIP] feat: Add nv22 skeleton Addition of Network Version 22 skeleton * update FFI * feat: drand: refactor round verification * feat: sealing: Support nv22 DDO features in the sealing pipeline (#11226) * Initial work supporting DDO pieces in lotus-miner * sealing: Update pipeline input to operate on UniversalPiece * sealing: Update pipeline checks/sealing states to operate on UniversalPiece * sealing: Make pipeline build with UniversalPiece * move PieceDealInfo out of api * make gen * make sealing pipeline unit tests pass * fix itest ensemble build * don't panic in SectorsStatus with deals * stop linter from complaining about checkPieces * fix sector import tests * mod tidy * sealing: Add logic for (pre)committing DDO sectors * sealing: state-types with method defs * DDO non-snap pipeline works(?), DDO Itests * DDO support in snapdeals pipeline * make gen * update actor bundles * update the gst market fix * fix: chain: use PreCommitSectorsBatch2 when setting up genesis * some bug fixes * integration working changes * update actor bundles * Make TestOnboardRawPieceSnap pass * Appease the linter * Make deadlines test pass with v12 actors * Update go-state-types, abstract market DealState * make gen * mod tidy, lint fixes * Fix some more tests * Bump version in master Bump version in master * Make gen Make gen * fix sender * fix: lotus-provider: Fix winning PoSt * fix: sql Scan cannot write to an object * Actually show miner-addrs in info-log Actually show miner-addrs in lotus-provider info-log * [WIP] feat: Add nv22 skeleton Addition of Network Version 22 skeleton * update FFI * ddo is now nv22 * make gen * temp actor bundle with ddo * use working go-state-types * gst with v13 market migration * update bundle, builtin.MethodsMiner.ProveCommitSectors2 -> 3 * actually working v13 migration, v13 migration itest * Address review * sealing: Correct DDO snap pledge math * itests: Mixed ddo itest * pipeline: Fix sectorWeight * sealing: convert market deals into PAMs in mixed sectors * sealing: make market to ddo conversion work * fix lint * update gst * Update actors and GST to lastest integ branch * commit batcher: Update ProveCommitSectors3Params builder logic * make gen * use builtin-actors master * ddo: address review * itests: Add commd assertions to ddo tests * make gen * gst with fixed types * config knobs for RequireActivationSuccess * storage: Drop obsolete flaky tasts --------- Co-authored-by: Jennifer Wang <jiayingw703@gmail.com> Co-authored-by: Aayush <arajasek94@gmail.com> Co-authored-by: Shrenuj Bansal <shrenuj.bansal@protocol.ai> Co-authored-by: Phi <orjan.roren@gmail.com> Co-authored-by: Andrew Jackson (Ajax) <snadrus@gmail.com> Co-authored-by: TippyFlits <james.bluett@protocol.ai> * feat: implement FIP-0063 * chore: deps: update to go-multiaddr v0.12.2 (#11602) * feat: fvm: update the FVM/FFI to v4.1 (#11608) (#11612) This: 1. Adds nv22 support. 2. Updates the message tracing format. Co-authored-by: Steven Allen <steven@stebalien.com> * AggregateProofType nil when doing batch updates Use latest nv22 go-state-types version with matching update * Update to v13.0.0-rc.2 bundle * chore: Upgrade heights and codename Update upgrade heights Co-Authored-By: Steven Allen <steven@stebalien.com> * Update epoch after nv22 DRAND switch Update epoch after nv22 DRAND switch * Update Mango codename to Phoneix Make the codename for the Drand-change inline with Dragon style. * Add UpgradePhoenixHeight to API params * set UpgradePhoenixHeight to be one hour after Dragon * Make gen Make gen and UpgradePhoenixHeight in butterfly and local devnet to be in line with Calibration and Mainnet * Update epoch heights (#11637) Update epoch heights * new: add forest bootstrap nodes (#11636) Signed-off-by: samuelarogbonlo <sbayo971@gmail.com> * Merge pull request #11491 from filecoin-project/fix/remove-decommissioned-pl-bootstrap-nodes Remove PL operated bootstrap nodes from mainnet.pi * feat: api: new verified registry methods to get all allocations and claims (#11631) * new verireg methods * update changelog and add itest * update itest and cli * update new method's support till v9 * remove gateway APIs * fix cli internal var names * chore:: backport #11609 to the feat/nv22 branch (#11644) * feat: api: improve the correctness of Eth's trace_block (#11609) * Improve the correctness of Eth's trace_block - Improve encoding/decoding of parameters and return values: - Encode "native" parameters and return values with Solidity ABI. - Correctly decode parameters to "create" calls. - Use the correct (ish) output for "create" calls. - Handle all forms of "create". - Make robust with respect to reverts: - Use the actor ID/address from the trace instead of looking it up in the state-tree (may not exist in the state-tree due to a revert). - Gracefully handle failed actor/contract creation. - Improve performance: - We avoid looking anything up in the state-tree when translating the trace, which should significantly improve performance. - Improve code readability: - Remove all "backtracking" logic. - Use an "environment" struct to store temporary state instead of attaching it to the trace. - Fix random bugs: - Fix an allocation bug in the "address" logic (need to set the capacity before modifying the slice). - Improved error checking/handling. - Use correct types for `trace_block` action/results (create, call, etc.). - And use the correct types for Result/Action structs instead of reusing the same "Call" action every time. - Improve error messages. * Make gen Make gen --------- Co-authored-by: Steven Allen <steven@stebalien.com> * fix: add UpgradePhoenixHeight to StateGetNetworkParams (#11648) * chore: deps: update to go-state-types v13.0.0-rc.1 * do NOT update the cache when running the real migration * Merge pull request #11632 from hanabi1224/hm/drand-test feat: drand quicknet: allow scheduling drand quicknet upgrade before nv22 on 2k devnet * chore: deps: update to go-state-types v13.0.0-rc.2 chore: deps: update to go-state-types v13.0.0-rc.2 * feat: set migration config UpgradeEpoch for v13 actors upgrade * Built-in actor events first draft * itest for DDO non-market verified data w/ builtin actor events * Tests for builtin actor events API * Clean up DDO+Events tests, add lots of explainer comments * Minor tweaks to events types * Avoid duplicate messages when looking for receipts * Rename internal events modules for clarity * Adjust actor event API after review * s/ActorEvents/Events/g in global config * Manage event sending rate for SubscribeActorEvents * Terminate SubscribeActorEvents chan when at max height * Document future API changes * More clarity in actor event API docs * More post-review changes, lots of tests for SubscribeActorEvents Use BlockDelay as the window for receiving events on the SubscribeActorEvents channel. We expect the user to have received the initial batch of historical events (if any) in one block's time. For real-time events we expect them to not fall behind by roughly one block's time. * Remove duplicate code from actor event type marshalling tests Reduce verbosity and remove duplicate test logic from actor event types JSON marshalling tests. * Rename actor events test to follow go convention Add missing `s` to `actor_events` test file to follow golang convention used across the repo. * Run actor events table tests in deterministic order Refactor `map` usage for actor event table tests to ensure deterministic test execution order, making debugging potential issues easier. If non-determinism is a target, leverage Go's built-in parallel testing capabilities. * Reduce scope for filter removal failure when getting actor events Use a fresh context to remove the temporary filter installed solely to get the actor events. This should reduce chances of failure in a case where the original context may be expired/cancelled. Refactor removal into a `defer` statement for a more readable, concise return statement. * Use fixed RNG seed for actor event tests Improve determinism in actor event tests by using a fixed RNG seed. This makes up a more reproducible test suit. * Use provided libraries to assert eventual conditions Use the functionalities already provided by `testify` to assert eventual conditions, and remove the use of `time.Sleep`. Remove duplicate code in utility functions that are already defined. Refactor assertion helper functions to use consistent terminology: "require" implies fatal error, whereas "assert" implies error where the test may proceed executing. * Update changelog for actor events APIs * Fix concerns and docs identified by review * Update actor bundle to v13.0.0-rc3 Update actor bundle to v13.0.0-rc3 * Prep Lotus v1.26.0-rc1 - For sanity reverting the mainnet upgrade epoch to 99999999, and then only set it when cutting the final release -Update Calibnet CIDs to v13.0.0-rc3 - Add GetActorEvents, SubscribeActorEvents, GetAllClaims and GetAllAllocations methods to the changelog Co-Authored-By: Jiaying Wang <42981373+jennijuju@users.noreply.github.com> * Update CHANGELOG.md Co-authored-by: Masih H. Derkani <m@derkani.org> * Make gen Make gen * fix: beacon: validate drand change at nv16 correctly * bump to v1.26.0-rc2 * test: cleanup ddo verified itest, extract steps to functions also add allocation-removed event case * test: extract verified DDO test to separate file, add more checks * test: add additional actor events checks * Add verification for "deal-activated" actor event * docs(drand): document the meaning of "IsChained" (#11692) * Resolve conflicts I encountered multiple issues when trying to run make gen. And these changes fixed a couple of them: - go mod tidy - Remove RaftState/RaftLeader - Revert `if ts.Height() > claim.TermMax+claim.TermStart || !cctx.IsSet("expired")` to the what is in the release/v1.26.0: `if tsHeight > val.TermMax || !expired` * fixup imports, make jen * Update version Update version in master to v1.27.0-dev * Update node/impl/full/dummy.go Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com> * Adjust ListClaimsCmd Adjust ListClaimsCmd according to review --------- Signed-off-by: samuelarogbonlo <sbayo971@gmail.com> Co-authored-by: TippyFlits <james.bluett@protocol.ai> Co-authored-by: Aayush <arajasek94@gmail.com> Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com> Co-authored-by: Jennifer Wang <jiayingw703@gmail.com> Co-authored-by: Shrenuj Bansal <shrenuj.bansal@protocol.ai> Co-authored-by: Andrew Jackson (Ajax) <snadrus@gmail.com> Co-authored-by: Steven Allen <steven@stebalien.com> Co-authored-by: Rod Vagg <rod@vagg.org> Co-authored-by: Samuel Arogbonlo <47984109+samuelarogbonlo@users.noreply.github.com> Co-authored-by: LexLuthr <88259624+LexLuthr@users.noreply.github.com> Co-authored-by: tom123222 <160735201+tom123222@users.noreply.github.com> Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com> Co-authored-by: Masih H. Derkani <m@derkani.org> Co-authored-by: Jiaying Wang <42981373+jennijuju@users.noreply.github.com>
945 lines
28 KiB
Go
945 lines
28 KiB
Go
package policy
|
|
|
|
import (
|
|
"golang.org/x/xerrors"
|
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
|
"github.com/filecoin-project/go-state-types/big"
|
|
builtin10 "github.com/filecoin-project/go-state-types/builtin"
|
|
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
|
builtin12 "github.com/filecoin-project/go-state-types/builtin"
|
|
builtin13 "github.com/filecoin-project/go-state-types/builtin"
|
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
|
builtin9 "github.com/filecoin-project/go-state-types/builtin"
|
|
market10 "github.com/filecoin-project/go-state-types/builtin/v10/market"
|
|
miner10 "github.com/filecoin-project/go-state-types/builtin/v10/miner"
|
|
verifreg10 "github.com/filecoin-project/go-state-types/builtin/v10/verifreg"
|
|
market11 "github.com/filecoin-project/go-state-types/builtin/v11/market"
|
|
miner11 "github.com/filecoin-project/go-state-types/builtin/v11/miner"
|
|
verifreg11 "github.com/filecoin-project/go-state-types/builtin/v11/verifreg"
|
|
market12 "github.com/filecoin-project/go-state-types/builtin/v12/market"
|
|
miner12 "github.com/filecoin-project/go-state-types/builtin/v12/miner"
|
|
verifreg12 "github.com/filecoin-project/go-state-types/builtin/v12/verifreg"
|
|
market13 "github.com/filecoin-project/go-state-types/builtin/v13/market"
|
|
miner13 "github.com/filecoin-project/go-state-types/builtin/v13/miner"
|
|
paych13 "github.com/filecoin-project/go-state-types/builtin/v13/paych"
|
|
verifreg13 "github.com/filecoin-project/go-state-types/builtin/v13/verifreg"
|
|
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
|
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
|
verifreg8 "github.com/filecoin-project/go-state-types/builtin/v8/verifreg"
|
|
market9 "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
|
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
|
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
|
"github.com/filecoin-project/go-state-types/network"
|
|
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
|
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
|
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
|
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
|
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
|
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
|
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
|
verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg"
|
|
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
|
market3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/market"
|
|
miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner"
|
|
verifreg3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/verifreg"
|
|
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
|
market4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/market"
|
|
miner4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/miner"
|
|
verifreg4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/verifreg"
|
|
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
|
market5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/market"
|
|
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
|
|
verifreg5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/verifreg"
|
|
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
|
market6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/market"
|
|
miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner"
|
|
verifreg6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/verifreg"
|
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
|
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
|
|
miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner"
|
|
verifreg7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/verifreg"
|
|
)
|
|
|
|
const (
|
|
ChainFinality = miner13.ChainFinality
|
|
SealRandomnessLookback = ChainFinality
|
|
PaychSettleDelay = paych13.SettleDelay
|
|
MaxPreCommitRandomnessLookback = builtin13.EpochsInDay + SealRandomnessLookback
|
|
)
|
|
|
|
var (
|
|
MarketDefaultAllocationTermBuffer = market13.MarketDefaultAllocationTermBuffer
|
|
)
|
|
|
|
// SetSupportedProofTypes sets supported proof types, across all actor versions.
|
|
// This should only be used for testing.
|
|
func SetSupportedProofTypes(types ...abi.RegisteredSealProof) {
|
|
|
|
miner0.SupportedProofTypes = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
|
|
miner2.PreCommitSealProofTypesV0 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
miner2.PreCommitSealProofTypesV7 = make(map[abi.RegisteredSealProof]struct{}, len(types)*2)
|
|
miner2.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
|
|
miner3.PreCommitSealProofTypesV0 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
miner3.PreCommitSealProofTypesV7 = make(map[abi.RegisteredSealProof]struct{}, len(types)*2)
|
|
miner3.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
|
|
miner4.PreCommitSealProofTypesV0 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
miner4.PreCommitSealProofTypesV7 = make(map[abi.RegisteredSealProof]struct{}, len(types)*2)
|
|
miner4.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
|
|
miner5.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
|
|
miner6.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
|
|
miner7.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
|
|
AddSupportedProofTypes(types...)
|
|
}
|
|
|
|
// AddSupportedProofTypes sets supported proof types, across all actor versions.
|
|
// This should only be used for testing.
|
|
func AddSupportedProofTypes(types ...abi.RegisteredSealProof) {
|
|
for _, t := range types {
|
|
if t >= abi.RegisteredSealProof_StackedDrg2KiBV1_1 {
|
|
panic("must specify v1 proof types only")
|
|
}
|
|
// Set for all miner versions.
|
|
|
|
miner0.SupportedProofTypes[t] = struct{}{}
|
|
|
|
miner2.PreCommitSealProofTypesV0[t] = struct{}{}
|
|
miner2.PreCommitSealProofTypesV7[t] = struct{}{}
|
|
miner2.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
|
miner2.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
|
|
|
miner3.PreCommitSealProofTypesV0[t] = struct{}{}
|
|
miner3.PreCommitSealProofTypesV7[t] = struct{}{}
|
|
miner3.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
|
miner3.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
|
|
|
miner4.PreCommitSealProofTypesV0[t] = struct{}{}
|
|
miner4.PreCommitSealProofTypesV7[t] = struct{}{}
|
|
miner4.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
|
miner4.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
|
|
|
miner5.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
|
wpp, err := t.RegisteredWindowPoStProof()
|
|
if err != nil {
|
|
// Fine to panic, this is a test-only method
|
|
panic(err)
|
|
}
|
|
|
|
miner5.WindowPoStProofTypes[wpp] = struct{}{}
|
|
|
|
miner6.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
|
wpp, err = t.RegisteredWindowPoStProof()
|
|
if err != nil {
|
|
// Fine to panic, this is a test-only method
|
|
panic(err)
|
|
}
|
|
|
|
miner6.WindowPoStProofTypes[wpp] = struct{}{}
|
|
|
|
miner7.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
|
wpp, err = t.RegisteredWindowPoStProof()
|
|
if err != nil {
|
|
// Fine to panic, this is a test-only method
|
|
panic(err)
|
|
}
|
|
|
|
miner7.WindowPoStProofTypes[wpp] = struct{}{}
|
|
|
|
}
|
|
}
|
|
|
|
// SetPreCommitChallengeDelay sets the pre-commit challenge delay across all
|
|
// actors versions. Use for testing.
|
|
func SetPreCommitChallengeDelay(delay abi.ChainEpoch) {
|
|
// Set for all miner versions.
|
|
|
|
miner0.PreCommitChallengeDelay = delay
|
|
|
|
miner2.PreCommitChallengeDelay = delay
|
|
|
|
miner3.PreCommitChallengeDelay = delay
|
|
|
|
miner4.PreCommitChallengeDelay = delay
|
|
|
|
miner5.PreCommitChallengeDelay = delay
|
|
|
|
miner6.PreCommitChallengeDelay = delay
|
|
|
|
miner7.PreCommitChallengeDelay = delay
|
|
|
|
miner8.PreCommitChallengeDelay = delay
|
|
|
|
miner9.PreCommitChallengeDelay = delay
|
|
|
|
miner10.PreCommitChallengeDelay = delay
|
|
|
|
miner11.PreCommitChallengeDelay = delay
|
|
|
|
miner12.PreCommitChallengeDelay = delay
|
|
|
|
miner13.PreCommitChallengeDelay = delay
|
|
|
|
}
|
|
|
|
// TODO: this function shouldn't really exist. Instead, the API should expose the precommit delay.
|
|
func GetPreCommitChallengeDelay() abi.ChainEpoch {
|
|
return miner13.PreCommitChallengeDelay
|
|
}
|
|
|
|
// SetConsensusMinerMinPower sets the minimum power of an individual miner must
|
|
// meet for leader election, across all actor versions. This should only be used
|
|
// for testing.
|
|
func SetConsensusMinerMinPower(p abi.StoragePower) {
|
|
|
|
power0.ConsensusMinerMinPower = p
|
|
|
|
for _, policy := range builtin2.SealProofPolicies {
|
|
policy.ConsensusMinerMinPower = p
|
|
}
|
|
|
|
for _, policy := range builtin3.PoStProofPolicies {
|
|
policy.ConsensusMinerMinPower = p
|
|
}
|
|
|
|
for _, policy := range builtin4.PoStProofPolicies {
|
|
policy.ConsensusMinerMinPower = p
|
|
}
|
|
|
|
for _, policy := range builtin5.PoStProofPolicies {
|
|
policy.ConsensusMinerMinPower = p
|
|
}
|
|
|
|
for _, policy := range builtin6.PoStProofPolicies {
|
|
policy.ConsensusMinerMinPower = p
|
|
}
|
|
|
|
for _, policy := range builtin7.PoStProofPolicies {
|
|
policy.ConsensusMinerMinPower = p
|
|
}
|
|
|
|
for _, policy := range builtin8.PoStProofPolicies {
|
|
policy.ConsensusMinerMinPower = p
|
|
}
|
|
|
|
for _, policy := range builtin9.PoStProofPolicies {
|
|
policy.ConsensusMinerMinPower = p
|
|
}
|
|
|
|
for _, policy := range builtin10.PoStProofPolicies {
|
|
policy.ConsensusMinerMinPower = p
|
|
}
|
|
|
|
for _, policy := range builtin11.PoStProofPolicies {
|
|
policy.ConsensusMinerMinPower = p
|
|
}
|
|
|
|
for _, policy := range builtin12.PoStProofPolicies {
|
|
policy.ConsensusMinerMinPower = p
|
|
}
|
|
|
|
for _, policy := range builtin13.PoStProofPolicies {
|
|
policy.ConsensusMinerMinPower = p
|
|
}
|
|
|
|
}
|
|
|
|
// SetMinVerifiedDealSize sets the minimum size of a verified deal. This should
|
|
// only be used for testing.
|
|
func SetMinVerifiedDealSize(size abi.StoragePower) {
|
|
|
|
verifreg0.MinVerifiedDealSize = size
|
|
|
|
verifreg2.MinVerifiedDealSize = size
|
|
|
|
verifreg3.MinVerifiedDealSize = size
|
|
|
|
verifreg4.MinVerifiedDealSize = size
|
|
|
|
verifreg5.MinVerifiedDealSize = size
|
|
|
|
verifreg6.MinVerifiedDealSize = size
|
|
|
|
verifreg7.MinVerifiedDealSize = size
|
|
|
|
verifreg8.MinVerifiedDealSize = size
|
|
|
|
verifreg9.MinVerifiedDealSize = size
|
|
|
|
verifreg10.MinVerifiedDealSize = size
|
|
|
|
verifreg11.MinVerifiedDealSize = size
|
|
|
|
verifreg12.MinVerifiedDealSize = size
|
|
|
|
verifreg13.MinVerifiedDealSize = size
|
|
|
|
}
|
|
|
|
func GetMaxProveCommitDuration(ver actorstypes.Version, t abi.RegisteredSealProof) (abi.ChainEpoch, error) {
|
|
switch ver {
|
|
|
|
case actorstypes.Version0:
|
|
|
|
return miner0.MaxSealDuration[t], nil
|
|
|
|
case actorstypes.Version2:
|
|
|
|
return miner2.MaxProveCommitDuration[t], nil
|
|
|
|
case actorstypes.Version3:
|
|
|
|
return miner3.MaxProveCommitDuration[t], nil
|
|
|
|
case actorstypes.Version4:
|
|
|
|
return miner4.MaxProveCommitDuration[t], nil
|
|
|
|
case actorstypes.Version5:
|
|
|
|
return miner5.MaxProveCommitDuration[t], nil
|
|
|
|
case actorstypes.Version6:
|
|
|
|
return miner6.MaxProveCommitDuration[t], nil
|
|
|
|
case actorstypes.Version7:
|
|
|
|
return miner7.MaxProveCommitDuration[t], nil
|
|
|
|
case actorstypes.Version8:
|
|
|
|
return miner8.MaxProveCommitDuration[t], nil
|
|
|
|
case actorstypes.Version9:
|
|
|
|
return miner9.MaxProveCommitDuration[t], nil
|
|
|
|
case actorstypes.Version10:
|
|
|
|
return miner10.MaxProveCommitDuration[t], nil
|
|
|
|
case actorstypes.Version11:
|
|
|
|
return miner11.MaxProveCommitDuration[t], nil
|
|
|
|
case actorstypes.Version12:
|
|
|
|
return miner12.MaxProveCommitDuration[t], nil
|
|
|
|
case actorstypes.Version13:
|
|
|
|
return miner13.MaxProveCommitDuration[t], nil
|
|
|
|
default:
|
|
return 0, xerrors.Errorf("unsupported actors version")
|
|
}
|
|
}
|
|
|
|
// SetProviderCollateralSupplyTarget sets the percentage of normalized circulating
|
|
// supply that must be covered by provider collateral in a deal. This should
|
|
// only be used for testing.
|
|
func SetProviderCollateralSupplyTarget(num, denom big.Int) {
|
|
|
|
market2.ProviderCollateralSupplyTarget = builtin2.BigFrac{
|
|
Numerator: num,
|
|
Denominator: denom,
|
|
}
|
|
|
|
market3.ProviderCollateralSupplyTarget = builtin3.BigFrac{
|
|
Numerator: num,
|
|
Denominator: denom,
|
|
}
|
|
|
|
market4.ProviderCollateralSupplyTarget = builtin4.BigFrac{
|
|
Numerator: num,
|
|
Denominator: denom,
|
|
}
|
|
|
|
market5.ProviderCollateralSupplyTarget = builtin5.BigFrac{
|
|
Numerator: num,
|
|
Denominator: denom,
|
|
}
|
|
|
|
market6.ProviderCollateralSupplyTarget = builtin6.BigFrac{
|
|
Numerator: num,
|
|
Denominator: denom,
|
|
}
|
|
|
|
market7.ProviderCollateralSupplyTarget = builtin7.BigFrac{
|
|
Numerator: num,
|
|
Denominator: denom,
|
|
}
|
|
|
|
market8.ProviderCollateralSupplyTarget = builtin8.BigFrac{
|
|
Numerator: num,
|
|
Denominator: denom,
|
|
}
|
|
|
|
market9.ProviderCollateralSupplyTarget = builtin9.BigFrac{
|
|
Numerator: num,
|
|
Denominator: denom,
|
|
}
|
|
|
|
market10.ProviderCollateralSupplyTarget = builtin10.BigFrac{
|
|
Numerator: num,
|
|
Denominator: denom,
|
|
}
|
|
|
|
market11.ProviderCollateralSupplyTarget = builtin11.BigFrac{
|
|
Numerator: num,
|
|
Denominator: denom,
|
|
}
|
|
|
|
market12.ProviderCollateralSupplyTarget = builtin12.BigFrac{
|
|
Numerator: num,
|
|
Denominator: denom,
|
|
}
|
|
|
|
market13.ProviderCollateralSupplyTarget = builtin13.BigFrac{
|
|
Numerator: num,
|
|
Denominator: denom,
|
|
}
|
|
|
|
}
|
|
|
|
func DealProviderCollateralBounds(
|
|
size abi.PaddedPieceSize, verified bool,
|
|
rawBytePower, qaPower, baselinePower abi.StoragePower,
|
|
circulatingFil abi.TokenAmount, nwVer network.Version,
|
|
) (min, max abi.TokenAmount, err error) {
|
|
v, err := actorstypes.VersionForNetwork(nwVer)
|
|
if err != nil {
|
|
return big.Zero(), big.Zero(), err
|
|
}
|
|
switch v {
|
|
|
|
case actorstypes.Version0:
|
|
|
|
min, max := market0.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil, nwVer)
|
|
return min, max, nil
|
|
|
|
case actorstypes.Version2:
|
|
|
|
min, max := market2.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
|
return min, max, nil
|
|
|
|
case actorstypes.Version3:
|
|
|
|
min, max := market3.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
|
return min, max, nil
|
|
|
|
case actorstypes.Version4:
|
|
|
|
min, max := market4.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
|
return min, max, nil
|
|
|
|
case actorstypes.Version5:
|
|
|
|
min, max := market5.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
|
return min, max, nil
|
|
|
|
case actorstypes.Version6:
|
|
|
|
min, max := market6.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
|
return min, max, nil
|
|
|
|
case actorstypes.Version7:
|
|
|
|
min, max := market7.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
|
return min, max, nil
|
|
|
|
case actorstypes.Version8:
|
|
|
|
min, max := market8.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
|
return min, max, nil
|
|
|
|
case actorstypes.Version9:
|
|
|
|
min, max := market9.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
|
return min, max, nil
|
|
|
|
case actorstypes.Version10:
|
|
|
|
min, max := market10.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
|
return min, max, nil
|
|
|
|
case actorstypes.Version11:
|
|
|
|
min, max := market11.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
|
return min, max, nil
|
|
|
|
case actorstypes.Version12:
|
|
|
|
min, max := market12.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
|
return min, max, nil
|
|
|
|
case actorstypes.Version13:
|
|
|
|
min, max := market13.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
|
return min, max, nil
|
|
|
|
default:
|
|
return big.Zero(), big.Zero(), xerrors.Errorf("unsupported actors version")
|
|
}
|
|
}
|
|
|
|
func DealDurationBounds(pieceSize abi.PaddedPieceSize) (min, max abi.ChainEpoch) {
|
|
return market13.DealDurationBounds(pieceSize)
|
|
}
|
|
|
|
// Sets the challenge window and scales the proving period to match (such that
|
|
// there are always 48 challenge windows in a proving period).
|
|
func SetWPoStChallengeWindow(period abi.ChainEpoch) {
|
|
|
|
miner0.WPoStChallengeWindow = period
|
|
miner0.WPoStProvingPeriod = period * abi.ChainEpoch(miner0.WPoStPeriodDeadlines)
|
|
|
|
miner2.WPoStChallengeWindow = period
|
|
miner2.WPoStProvingPeriod = period * abi.ChainEpoch(miner2.WPoStPeriodDeadlines)
|
|
|
|
miner3.WPoStChallengeWindow = period
|
|
miner3.WPoStProvingPeriod = period * abi.ChainEpoch(miner3.WPoStPeriodDeadlines)
|
|
|
|
// by default, this is 2x finality which is 30 periods.
|
|
// scale it if we're scaling the challenge period.
|
|
miner3.WPoStDisputeWindow = period * 30
|
|
|
|
miner4.WPoStChallengeWindow = period
|
|
miner4.WPoStProvingPeriod = period * abi.ChainEpoch(miner4.WPoStPeriodDeadlines)
|
|
|
|
// by default, this is 2x finality which is 30 periods.
|
|
// scale it if we're scaling the challenge period.
|
|
miner4.WPoStDisputeWindow = period * 30
|
|
|
|
miner5.WPoStChallengeWindow = period
|
|
miner5.WPoStProvingPeriod = period * abi.ChainEpoch(miner5.WPoStPeriodDeadlines)
|
|
|
|
// by default, this is 2x finality which is 30 periods.
|
|
// scale it if we're scaling the challenge period.
|
|
miner5.WPoStDisputeWindow = period * 30
|
|
|
|
miner6.WPoStChallengeWindow = period
|
|
miner6.WPoStProvingPeriod = period * abi.ChainEpoch(miner6.WPoStPeriodDeadlines)
|
|
|
|
// by default, this is 2x finality which is 30 periods.
|
|
// scale it if we're scaling the challenge period.
|
|
miner6.WPoStDisputeWindow = period * 30
|
|
|
|
miner7.WPoStChallengeWindow = period
|
|
miner7.WPoStProvingPeriod = period * abi.ChainEpoch(miner7.WPoStPeriodDeadlines)
|
|
|
|
// by default, this is 2x finality which is 30 periods.
|
|
// scale it if we're scaling the challenge period.
|
|
miner7.WPoStDisputeWindow = period * 30
|
|
|
|
miner8.WPoStChallengeWindow = period
|
|
miner8.WPoStProvingPeriod = period * abi.ChainEpoch(miner8.WPoStPeriodDeadlines)
|
|
|
|
// by default, this is 2x finality which is 30 periods.
|
|
// scale it if we're scaling the challenge period.
|
|
miner8.WPoStDisputeWindow = period * 30
|
|
|
|
miner9.WPoStChallengeWindow = period
|
|
miner9.WPoStProvingPeriod = period * abi.ChainEpoch(miner9.WPoStPeriodDeadlines)
|
|
|
|
// by default, this is 2x finality which is 30 periods.
|
|
// scale it if we're scaling the challenge period.
|
|
miner9.WPoStDisputeWindow = period * 30
|
|
|
|
miner10.WPoStChallengeWindow = period
|
|
miner10.WPoStProvingPeriod = period * abi.ChainEpoch(miner10.WPoStPeriodDeadlines)
|
|
|
|
// by default, this is 2x finality which is 30 periods.
|
|
// scale it if we're scaling the challenge period.
|
|
miner10.WPoStDisputeWindow = period * 30
|
|
|
|
miner11.WPoStChallengeWindow = period
|
|
miner11.WPoStProvingPeriod = period * abi.ChainEpoch(miner11.WPoStPeriodDeadlines)
|
|
|
|
// by default, this is 2x finality which is 30 periods.
|
|
// scale it if we're scaling the challenge period.
|
|
miner11.WPoStDisputeWindow = period * 30
|
|
|
|
miner12.WPoStChallengeWindow = period
|
|
miner12.WPoStProvingPeriod = period * abi.ChainEpoch(miner12.WPoStPeriodDeadlines)
|
|
|
|
// by default, this is 2x finality which is 30 periods.
|
|
// scale it if we're scaling the challenge period.
|
|
miner12.WPoStDisputeWindow = period * 30
|
|
|
|
miner13.WPoStChallengeWindow = period
|
|
miner13.WPoStProvingPeriod = period * abi.ChainEpoch(miner13.WPoStPeriodDeadlines)
|
|
|
|
// by default, this is 2x finality which is 30 periods.
|
|
// scale it if we're scaling the challenge period.
|
|
miner13.WPoStDisputeWindow = period * 30
|
|
|
|
}
|
|
|
|
func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch {
|
|
if nwVer <= network.Version3 {
|
|
return 10
|
|
}
|
|
|
|
// NOTE: if this ever changes, adjust it in a (*Miner).mineOne() logline as well
|
|
return ChainFinality
|
|
}
|
|
|
|
func GetMaxSectorExpirationExtension(nv network.Version) (abi.ChainEpoch, error) {
|
|
v, err := actorstypes.VersionForNetwork(nv)
|
|
if err != nil {
|
|
return 0, xerrors.Errorf("failed to get actors version: %w", err)
|
|
}
|
|
switch v {
|
|
|
|
case actorstypes.Version0:
|
|
return miner0.MaxSectorExpirationExtension, nil
|
|
|
|
case actorstypes.Version2:
|
|
return miner2.MaxSectorExpirationExtension, nil
|
|
|
|
case actorstypes.Version3:
|
|
return miner3.MaxSectorExpirationExtension, nil
|
|
|
|
case actorstypes.Version4:
|
|
return miner4.MaxSectorExpirationExtension, nil
|
|
|
|
case actorstypes.Version5:
|
|
return miner5.MaxSectorExpirationExtension, nil
|
|
|
|
case actorstypes.Version6:
|
|
return miner6.MaxSectorExpirationExtension, nil
|
|
|
|
case actorstypes.Version7:
|
|
return miner7.MaxSectorExpirationExtension, nil
|
|
|
|
case actorstypes.Version8:
|
|
return miner8.MaxSectorExpirationExtension, nil
|
|
|
|
case actorstypes.Version9:
|
|
return miner9.MaxSectorExpirationExtension, nil
|
|
|
|
case actorstypes.Version10:
|
|
return miner10.MaxSectorExpirationExtension, nil
|
|
|
|
case actorstypes.Version11:
|
|
return miner11.MaxSectorExpirationExtension, nil
|
|
|
|
case actorstypes.Version12:
|
|
return miner12.MaxSectorExpirationExtension, nil
|
|
|
|
case actorstypes.Version13:
|
|
return miner13.MaxSectorExpirationExtension, nil
|
|
|
|
default:
|
|
return 0, xerrors.Errorf("unsupported network version")
|
|
}
|
|
|
|
}
|
|
|
|
func GetMinSectorExpiration() abi.ChainEpoch {
|
|
return miner13.MinSectorExpiration
|
|
}
|
|
|
|
func GetMaxPoStPartitions(nv network.Version, p abi.RegisteredPoStProof) (int, error) {
|
|
sectorsPerPart, err := builtin13.PoStProofWindowPoStPartitionSectors(p)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
maxSectors, err := GetAddressedSectorsMax(nv)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
|
|
return min(miner13.PoStedPartitionsMax, int(uint64(maxSectors)/sectorsPerPart)), nil
|
|
}
|
|
|
|
func GetDefaultAggregationProof() abi.RegisteredAggregationProof {
|
|
return abi.RegisteredAggregationProof_SnarkPackV1
|
|
}
|
|
|
|
func GetSectorMaxLifetime(proof abi.RegisteredSealProof, nwVer network.Version) abi.ChainEpoch {
|
|
if nwVer <= network.Version10 {
|
|
return builtin4.SealProofPoliciesV0[proof].SectorMaxLifetime
|
|
}
|
|
|
|
return builtin13.SealProofPoliciesV11[proof].SectorMaxLifetime
|
|
}
|
|
|
|
func GetAddressedSectorsMax(nwVer network.Version) (int, error) {
|
|
v, err := actorstypes.VersionForNetwork(nwVer)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
switch v {
|
|
|
|
case actorstypes.Version0:
|
|
return miner0.AddressedSectorsMax, nil
|
|
|
|
case actorstypes.Version2:
|
|
return miner2.AddressedSectorsMax, nil
|
|
|
|
case actorstypes.Version3:
|
|
return miner3.AddressedSectorsMax, nil
|
|
|
|
case actorstypes.Version4:
|
|
return miner4.AddressedSectorsMax, nil
|
|
|
|
case actorstypes.Version5:
|
|
return miner5.AddressedSectorsMax, nil
|
|
|
|
case actorstypes.Version6:
|
|
return miner6.AddressedSectorsMax, nil
|
|
|
|
case actorstypes.Version7:
|
|
return miner7.AddressedSectorsMax, nil
|
|
|
|
case actorstypes.Version8:
|
|
return miner8.AddressedSectorsMax, nil
|
|
|
|
case actorstypes.Version9:
|
|
return miner9.AddressedSectorsMax, nil
|
|
|
|
case actorstypes.Version10:
|
|
return miner10.AddressedSectorsMax, nil
|
|
|
|
case actorstypes.Version11:
|
|
return miner11.AddressedSectorsMax, nil
|
|
|
|
case actorstypes.Version12:
|
|
return miner12.AddressedSectorsMax, nil
|
|
|
|
case actorstypes.Version13:
|
|
return miner13.AddressedSectorsMax, nil
|
|
|
|
default:
|
|
return 0, xerrors.Errorf("unsupported network version")
|
|
}
|
|
}
|
|
|
|
func GetDeclarationsMax(nwVer network.Version) (int, error) {
|
|
v, err := actorstypes.VersionForNetwork(nwVer)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
switch v {
|
|
|
|
case actorstypes.Version0:
|
|
|
|
// TODO: Should we instead error here since the concept doesn't exist yet?
|
|
return miner0.AddressedPartitionsMax, nil
|
|
|
|
case actorstypes.Version2:
|
|
|
|
return miner2.DeclarationsMax, nil
|
|
|
|
case actorstypes.Version3:
|
|
|
|
return miner3.DeclarationsMax, nil
|
|
|
|
case actorstypes.Version4:
|
|
|
|
return miner4.DeclarationsMax, nil
|
|
|
|
case actorstypes.Version5:
|
|
|
|
return miner5.DeclarationsMax, nil
|
|
|
|
case actorstypes.Version6:
|
|
|
|
return miner6.DeclarationsMax, nil
|
|
|
|
case actorstypes.Version7:
|
|
|
|
return miner7.DeclarationsMax, nil
|
|
|
|
case actorstypes.Version8:
|
|
|
|
return miner8.DeclarationsMax, nil
|
|
|
|
case actorstypes.Version9:
|
|
|
|
return miner9.DeclarationsMax, nil
|
|
|
|
case actorstypes.Version10:
|
|
|
|
return miner10.DeclarationsMax, nil
|
|
|
|
case actorstypes.Version11:
|
|
|
|
return miner11.DeclarationsMax, nil
|
|
|
|
case actorstypes.Version12:
|
|
|
|
return miner12.DeclarationsMax, nil
|
|
|
|
case actorstypes.Version13:
|
|
|
|
return miner13.DeclarationsMax, nil
|
|
|
|
default:
|
|
return 0, xerrors.Errorf("unsupported network version")
|
|
}
|
|
}
|
|
|
|
func AggregateProveCommitNetworkFee(nwVer network.Version, aggregateSize int, baseFee abi.TokenAmount) (abi.TokenAmount, error) {
|
|
v, err := actorstypes.VersionForNetwork(nwVer)
|
|
if err != nil {
|
|
return big.Zero(), err
|
|
}
|
|
switch v {
|
|
|
|
case actorstypes.Version0:
|
|
|
|
return big.Zero(), nil
|
|
|
|
case actorstypes.Version2:
|
|
|
|
return big.Zero(), nil
|
|
|
|
case actorstypes.Version3:
|
|
|
|
return big.Zero(), nil
|
|
|
|
case actorstypes.Version4:
|
|
|
|
return big.Zero(), nil
|
|
|
|
case actorstypes.Version5:
|
|
|
|
return miner5.AggregateNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
case actorstypes.Version6:
|
|
|
|
return miner6.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
case actorstypes.Version7:
|
|
|
|
return miner7.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
case actorstypes.Version8:
|
|
|
|
return miner8.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
case actorstypes.Version9:
|
|
|
|
return miner9.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
case actorstypes.Version10:
|
|
|
|
return miner10.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
case actorstypes.Version11:
|
|
|
|
return miner11.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
case actorstypes.Version12:
|
|
|
|
return miner12.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
case actorstypes.Version13:
|
|
|
|
return miner13.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
default:
|
|
return big.Zero(), xerrors.Errorf("unsupported network version")
|
|
}
|
|
}
|
|
|
|
func AggregatePreCommitNetworkFee(nwVer network.Version, aggregateSize int, baseFee abi.TokenAmount) (abi.TokenAmount, error) {
|
|
v, err := actorstypes.VersionForNetwork(nwVer)
|
|
if err != nil {
|
|
return big.Zero(), err
|
|
}
|
|
switch v {
|
|
|
|
case actorstypes.Version0:
|
|
|
|
return big.Zero(), nil
|
|
|
|
case actorstypes.Version2:
|
|
|
|
return big.Zero(), nil
|
|
|
|
case actorstypes.Version3:
|
|
|
|
return big.Zero(), nil
|
|
|
|
case actorstypes.Version4:
|
|
|
|
return big.Zero(), nil
|
|
|
|
case actorstypes.Version5:
|
|
|
|
return big.Zero(), nil
|
|
|
|
case actorstypes.Version6:
|
|
|
|
return miner6.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
case actorstypes.Version7:
|
|
|
|
return miner7.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
case actorstypes.Version8:
|
|
|
|
return miner8.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
case actorstypes.Version9:
|
|
|
|
return miner9.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
case actorstypes.Version10:
|
|
|
|
return miner10.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
case actorstypes.Version11:
|
|
|
|
return miner11.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
case actorstypes.Version12:
|
|
|
|
return miner12.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
case actorstypes.Version13:
|
|
|
|
return miner13.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
|
|
|
default:
|
|
return big.Zero(), xerrors.Errorf("unsupported network version")
|
|
}
|
|
}
|
|
|
|
var PoStToSealMap map[abi.RegisteredPoStProof]abi.RegisteredSealProof
|
|
|
|
func init() {
|
|
PoStToSealMap = make(map[abi.RegisteredPoStProof]abi.RegisteredSealProof)
|
|
for sealProof, info := range abi.SealProofInfos {
|
|
PoStToSealMap[info.WinningPoStProof] = sealProof
|
|
PoStToSealMap[info.WindowPoStProof] = sealProof
|
|
}
|
|
}
|
|
|
|
func GetSealProofFromPoStProof(postProof abi.RegisteredPoStProof) (abi.RegisteredSealProof, error) {
|
|
sealProof, exists := PoStToSealMap[postProof]
|
|
if !exists {
|
|
return 0, xerrors.New("no corresponding RegisteredSealProof for the given RegisteredPoStProof")
|
|
}
|
|
return sealProof, nil
|
|
}
|
|
|
|
func min(a, b int) int {
|
|
if a < b {
|
|
return a
|
|
}
|
|
return b
|
|
}
|