79453663b3
* Annotate api,proxy_util,blockstore_badger, policy tests * Annotate splitstore: bsbadger / markset * Annotate splitstore feature * Annotate union/timed blockstore tests * Annotate openrpc, diff_adt tests * Annotate error,drand,events tests * Annotate predicates_test * Fix annotations * Annotate tscache, gen tests * Annotate fundmanager test * Annotate repub and selection tests * Annotate statetree_test * Annotate forks_test * Annotate searchwait_test.go * Fix duplicated @@ symbols * Annotate chain stmgr/store tests * Annotate more (types) tests * More tests annotated * Annotate conformance chaos actor tests * Annotate more integration tests * Annotate journal system tests * Annotate more tests. * Annotate gas,head buffer behaviors * Fix markset annotations * doc: test annotations for the markets dagstore wrapper * Annotate miner_api test in dagstore * Annotate more test files * Remove bad annotations from fsrepo * Annotate wdpost system * Remove bad annotations * Renamce "conformance" to "chaos_actor" tests * doc: stm annotations for blockheader & election proof tests * Annotate remaining "A" tests * annotate: stm for error_test * memrepo_test.go * Annotate "b" file tests * message_test.go * doc: stm annotate for fsrepo_test * Annotate "c" file tests * Annotate "D" test files * message_test.go * doc: stm annotate for chain, node/config & client * docs: stm annotate node_test * Annotate u,v,wl tests * doc: stm annotations for various test files * Annotate "T" test files * doc: stm annotate for proxy_util_test & policy_test * doc: stm annotate for various tests * doc: final few stm annotations * Add mempool unit tests * Add two more memPool Add tests * Update submodules * Add check function tests * Add stm annotations, refactor test helper * Annotate api,proxy_util,blockstore_badger, policy tests * Annotate splitstore: bsbadger / markset solving merge conflicts * Annotate splitstore feature * Annotate union/timed blockstore tests * Annotate openrpc, diff_adt tests * Annotate error,drand,events tests * Annotate predicates_test * Fix annotations * Annotate tscache, gen tests * Annotate fundmanager test * Annotate statetree_test * Annotate forks_test * Annotate searchwait_test.go * Fix duplicated @@ symbols * Annotate chain stmgr/store tests * Annotate more (types) tests * More tests annotated * Annotate conformance chaos actor tests * Annotate more integration tests * Annotate journal system tests * Annotate more tests. * Annotate gas,head buffer behaviors solve merge conflict * Fix markset annotations * Annotate miner_api test in dagstore * Annotate more test files * doc: test annotations for the markets dagstore wrapper * Annotate wdpost system * Renamce "conformance" to "chaos_actor" tests * Annotate remaining "A" tests * doc: stm annotations for blockheader & election proof tests * annotate: stm for error_test * Annotate "b" file tests * memrepo_test.go * Annotate "c" file tests * message_test.go * Annotate "D" test files * doc: stm annotate for fsrepo_test * Annotate u,v,wl tests * message_test.go * doc: stm annotate for chain, node/config & client * docs: stm annotate node_test * Annotate "T" test files * doc: stm annotations for various test files * Add mempool unit tests solve merge conflict * doc: stm annotate for proxy_util_test & policy_test * doc: stm annotate for various tests * doc: final few stm annotations * Add two more memPool Add tests * Update submodules * Add check function tests solve conflict * Add stm annotations, refactor test helper solve merge conflict * Change CLI test kinds to "unit" * Fix double merged test * Fix ccupgrade_test merge * Fix lint issues * Add stm annotation to types_Test * Test vectors submodule * Add file annotation to burn_test Co-authored-by: Nikola Divic <divicnikola@gmail.com> Co-authored-by: TheMenko <themenkoprojects@gmail.com>
87 lines
3.3 KiB
Go
87 lines
3.3 KiB
Go
//stm: #unit
|
|
package policy
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
"github.com/filecoin-project/go-state-types/network"
|
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
|
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
|
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
|
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
|
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
|
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
|
paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych"
|
|
verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg"
|
|
)
|
|
|
|
func TestSupportedProofTypes(t *testing.T) {
|
|
var oldTypes []abi.RegisteredSealProof
|
|
for t := range miner0.SupportedProofTypes {
|
|
oldTypes = append(oldTypes, t)
|
|
}
|
|
//stm: @BLOCKCHAIN_POLICY_SET_MAX_SUPPORTED_PROOF_TYPES_001
|
|
t.Cleanup(func() {
|
|
SetSupportedProofTypes(oldTypes...)
|
|
})
|
|
|
|
SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1)
|
|
require.EqualValues(t,
|
|
miner0.SupportedProofTypes,
|
|
map[abi.RegisteredSealProof]struct{}{
|
|
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
|
},
|
|
)
|
|
//stm: @BLOCKCHAIN_POLICY_ADD_MAX_SUPPORTED_PROOF_TYPES_001
|
|
AddSupportedProofTypes(abi.RegisteredSealProof_StackedDrg8MiBV1)
|
|
require.EqualValues(t,
|
|
miner0.SupportedProofTypes,
|
|
map[abi.RegisteredSealProof]struct{}{
|
|
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
|
abi.RegisteredSealProof_StackedDrg8MiBV1: {},
|
|
},
|
|
)
|
|
}
|
|
|
|
// Tests assumptions about policies being the same between actor versions.
|
|
func TestAssumptions(t *testing.T) {
|
|
//stm: @BLOCKCHAIN_POLICY_ASSUMPTIONS_001
|
|
require.EqualValues(t, miner0.SupportedProofTypes, miner2.PreCommitSealProofTypesV0)
|
|
require.Equal(t, miner0.PreCommitChallengeDelay, miner2.PreCommitChallengeDelay)
|
|
require.Equal(t, miner0.MaxSectorExpirationExtension, miner2.MaxSectorExpirationExtension)
|
|
require.Equal(t, miner0.ChainFinality, miner2.ChainFinality)
|
|
require.Equal(t, miner0.WPoStChallengeWindow, miner2.WPoStChallengeWindow)
|
|
require.Equal(t, miner0.WPoStProvingPeriod, miner2.WPoStProvingPeriod)
|
|
require.Equal(t, miner0.WPoStPeriodDeadlines, miner2.WPoStPeriodDeadlines)
|
|
require.Equal(t, miner0.AddressedSectorsMax, miner2.AddressedSectorsMax)
|
|
require.Equal(t, paych0.SettleDelay, paych2.SettleDelay)
|
|
require.True(t, verifreg0.MinVerifiedDealSize.Equals(verifreg2.MinVerifiedDealSize))
|
|
}
|
|
|
|
func TestPartitionSizes(t *testing.T) {
|
|
//stm: @CHAIN_ACTOR_PARTITION_SIZES_001
|
|
for _, p := range abi.SealProofInfos {
|
|
sizeNew, err := builtin2.PoStProofWindowPoStPartitionSectors(p.WindowPoStProof)
|
|
require.NoError(t, err)
|
|
sizeOld, err := builtin0.PoStProofWindowPoStPartitionSectors(p.WindowPoStProof)
|
|
if err != nil {
|
|
// new proof type.
|
|
continue
|
|
}
|
|
require.Equal(t, sizeOld, sizeNew)
|
|
}
|
|
}
|
|
|
|
func TestPoStSize(t *testing.T) {
|
|
//stm: @BLOCKCHAIN_POLICY_GET_MAX_POST_PARTITIONS_001
|
|
v12PoStSize, err := GetMaxPoStPartitions(network.Version12, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1)
|
|
require.Equal(t, 4, v12PoStSize)
|
|
require.NoError(t, err)
|
|
v13PoStSize, err := GetMaxPoStPartitions(network.Version13, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1)
|
|
require.NoError(t, err)
|
|
require.Equal(t, 10, v13PoStSize)
|
|
}
|