f929ae17d7
* enable storing events (#11712) * fix: commit batch: Always go through commit batcher (#11704) * fix: commit batch: Always go through commit batcher * fix sealing fsm tests * sealing pipeline: Fix panic on padding pieces in WaitDeals (#11708) * sealing pipeline: Fix panic on padding pieces in WaitDeals * sealing pipeline: Catch panics * sealing pipeline: Output DDO pieces in SectorStatus (#11709) * sealing pipeline: Fix failing ProveCommit3 aggregate (#11710) * itests: Repro failing ProveCommit3 aggregate * commit batch: Correctly sort sectors in processBatchV2 * fix imports * ci: Bigger instance for sector_pledge test * itests: Use Must-Post mining in TestPledgeBatching --------- Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com> Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com>
74 lines
1.8 KiB
Go
74 lines
1.8 KiB
Go
package kit
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
|
|
"github.com/filecoin-project/lotus/build"
|
|
"github.com/filecoin-project/lotus/chain/stmgr"
|
|
"github.com/filecoin-project/lotus/chain/wallet/key"
|
|
)
|
|
|
|
type EnsembleOpt func(opts *ensembleOpts) error
|
|
|
|
type genesisAccount struct {
|
|
key *key.Key
|
|
initialBalance abi.TokenAmount
|
|
}
|
|
|
|
type ensembleOpts struct {
|
|
pastOffset time.Duration
|
|
verifiedRoot genesisAccount
|
|
accounts []genesisAccount
|
|
mockProofs bool
|
|
|
|
upgradeSchedule stmgr.UpgradeSchedule
|
|
}
|
|
|
|
var DefaultEnsembleOpts = ensembleOpts{
|
|
pastOffset: 10000000 * time.Second, // time sufficiently in the past to trigger catch-up mining.
|
|
upgradeSchedule: stmgr.UpgradeSchedule{{
|
|
Height: -1,
|
|
Network: build.TestNetworkVersion,
|
|
}},
|
|
}
|
|
|
|
// MockProofs activates mock proofs for the entire ensemble.
|
|
func MockProofs(e ...bool) EnsembleOpt {
|
|
if len(e) > 0 && !e[0] {
|
|
return func(opts *ensembleOpts) error {
|
|
return nil
|
|
}
|
|
}
|
|
|
|
return func(opts *ensembleOpts) error {
|
|
opts.mockProofs = true
|
|
// since we're using mock proofs, we don't need to download
|
|
// proof parameters
|
|
build.DisableBuiltinAssets = true
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// RootVerifier specifies the key to be enlisted as the verified registry root,
|
|
// as well as the initial balance to be attributed during genesis.
|
|
func RootVerifier(key *key.Key, balance abi.TokenAmount) EnsembleOpt {
|
|
return func(opts *ensembleOpts) error {
|
|
opts.verifiedRoot.key = key
|
|
opts.verifiedRoot.initialBalance = balance
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// Account sets up an account at genesis with the specified key and balance.
|
|
func Account(key *key.Key, balance abi.TokenAmount) EnsembleOpt {
|
|
return func(opts *ensembleOpts) error {
|
|
opts.accounts = append(opts.accounts, genesisAccount{
|
|
key: key,
|
|
initialBalance: balance,
|
|
})
|
|
return nil
|
|
}
|
|
}
|