Merge pull request #6372 from filecoin-project/fix/nv11-tests
Fix nv13 1.11 tests
This commit is contained in:
commit
2a787dd4a3
@ -63,7 +63,7 @@ func TestDeadlineToggling(t *testing.T, b APIBuilder, blocktime time.Duration) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
n, sn := b(t, []FullNodeOpts{FullNodeWithLatestActorsAt(upgradeH)}, OneMiner)
|
||||
n, sn := b(t, []FullNodeOpts{FullNodeWithNetworkUpgradeAt(network.Version12, upgradeH)}, OneMiner)
|
||||
|
||||
client := n[0].FullNode.(*impl.FullNodeAPI)
|
||||
minerA := sn[0]
|
||||
|
@ -122,14 +122,12 @@ var OneFull = DefaultFullOpts(1)
|
||||
var TwoFull = DefaultFullOpts(2)
|
||||
|
||||
var FullNodeWithLatestActorsAt = func(upgradeHeight abi.ChainEpoch) FullNodeOpts {
|
||||
if upgradeHeight == -1 {
|
||||
// Attention: Update this when introducing new actor versions or your tests will be sad
|
||||
upgradeHeight = 4
|
||||
}
|
||||
return FullNodeWithNetworkUpgradeAt(network.Version13, upgradeHeight)
|
||||
}
|
||||
|
||||
return FullNodeOpts{
|
||||
Opts: func(nodes []TestNode) node.Option {
|
||||
return node.Override(new(stmgr.UpgradeSchedule), stmgr.UpgradeSchedule{{
|
||||
var FullNodeWithNetworkUpgradeAt = func(version network.Version, upgradeHeight abi.ChainEpoch) FullNodeOpts {
|
||||
fullSchedule := stmgr.UpgradeSchedule{{
|
||||
// prepare for upgrade.
|
||||
Network: network.Version9,
|
||||
Height: 1,
|
||||
@ -144,9 +142,26 @@ var FullNodeWithLatestActorsAt = func(upgradeHeight abi.ChainEpoch) FullNodeOpts
|
||||
Migration: stmgr.UpgradeActorsV4,
|
||||
}, {
|
||||
Network: network.Version13,
|
||||
Height: upgradeHeight,
|
||||
Height: 4,
|
||||
Migration: stmgr.UpgradeActorsV5,
|
||||
}})
|
||||
}}
|
||||
|
||||
schedule := stmgr.UpgradeSchedule{}
|
||||
for _, upgrade := range fullSchedule {
|
||||
if upgrade.Network > version {
|
||||
break
|
||||
}
|
||||
|
||||
schedule = append(schedule, upgrade)
|
||||
}
|
||||
|
||||
if upgradeHeight > 0 {
|
||||
schedule[len(schedule)-1].Height = upgradeHeight
|
||||
}
|
||||
|
||||
return FullNodeOpts{
|
||||
Opts: func(nodes []TestNode) node.Option {
|
||||
return node.Override(new(stmgr.UpgradeSchedule), schedule)
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -170,31 +185,6 @@ var FullNodeWithSDRAt = func(calico, persian abi.ChainEpoch) FullNodeOpts {
|
||||
}
|
||||
}
|
||||
|
||||
var FullNodeWithV4ActorsAt = func(upgradeHeight abi.ChainEpoch) FullNodeOpts {
|
||||
if upgradeHeight == -1 {
|
||||
upgradeHeight = 3
|
||||
}
|
||||
|
||||
return FullNodeOpts{
|
||||
Opts: func(nodes []TestNode) node.Option {
|
||||
return node.Override(new(stmgr.UpgradeSchedule), stmgr.UpgradeSchedule{{
|
||||
// prepare for upgrade.
|
||||
Network: network.Version9,
|
||||
Height: 1,
|
||||
Migration: stmgr.UpgradeActorsV2,
|
||||
}, {
|
||||
Network: network.Version10,
|
||||
Height: 2,
|
||||
Migration: stmgr.UpgradeActorsV3,
|
||||
}, {
|
||||
Network: network.Version12,
|
||||
Height: upgradeHeight,
|
||||
Migration: stmgr.UpgradeActorsV4,
|
||||
}})
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
var MineNext = miner.MineReq{
|
||||
InjectNulls: 0,
|
||||
Done: func(bool, abi.ChainEpoch, error) {},
|
||||
|
@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
@ -19,8 +21,10 @@ import (
|
||||
)
|
||||
|
||||
func AddVerifiedClient(t *testing.T, b APIBuilder) {
|
||||
test := func(nv network.Version, shouldWork bool) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
|
||||
nodes, miners := b(t, []FullNodeOpts{FullNodeWithLatestActorsAt(-1)}, OneMiner)
|
||||
nodes, miners := b(t, []FullNodeOpts{FullNodeWithNetworkUpgradeAt(nv, -1)}, OneMiner)
|
||||
api := nodes[0].FullNode.(*impl.FullNodeAPI)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
@ -120,7 +124,17 @@ func AddVerifiedClient(t *testing.T, b APIBuilder) {
|
||||
Value: big.Zero(),
|
||||
}
|
||||
|
||||
if _, err = api.MpoolPushMessage(ctx, msg, nil); !strings.Contains(err.Error(), "verified client already exists") {
|
||||
t.Fatal("Add datacap to an exist verified client should fail")
|
||||
_, err = api.MpoolPushMessage(ctx, msg, nil)
|
||||
if shouldWork && err != nil {
|
||||
t.Fatal("expected nil err", err)
|
||||
}
|
||||
|
||||
if !shouldWork && (err == nil || !strings.Contains(err.Error(), "verified client already exists")) {
|
||||
t.Fatal("Add datacap to an existing verified client should fail")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
t.Run("nv12", test(network.Version12, false))
|
||||
t.Run("nv13", test(network.Version13, true))
|
||||
}
|
||||
|
@ -152,6 +152,8 @@ func VersionForNetwork(ver network.Version) (types.StateTreeVersion, error) {
|
||||
return types.StateTreeVersion2, nil
|
||||
case network.Version12:
|
||||
return types.StateTreeVersion3, nil
|
||||
case network.Version13:
|
||||
return types.StateTreeVersion4, nil
|
||||
default:
|
||||
panic(fmt.Sprintf("unsupported network version %d", ver))
|
||||
}
|
||||
@ -162,7 +164,7 @@ func NewStateTree(cst cbor.IpldStore, ver types.StateTreeVersion) (*StateTree, e
|
||||
switch ver {
|
||||
case types.StateTreeVersion0:
|
||||
// info is undefined
|
||||
case types.StateTreeVersion1, types.StateTreeVersion2, types.StateTreeVersion3:
|
||||
case types.StateTreeVersion1, types.StateTreeVersion2, types.StateTreeVersion3, types.StateTreeVersion4:
|
||||
var err error
|
||||
info, err = cst.Put(context.TODO(), new(types.StateInfo0))
|
||||
if err != nil {
|
||||
|
@ -1533,8 +1533,8 @@ USAGE:
|
||||
lotus-miner sectors batching command [command options] [arguments...]
|
||||
|
||||
COMMANDS:
|
||||
pending-commit list sectors waiting in commit batch queue
|
||||
pending-precommit list sectors waiting in precommit batch queue
|
||||
commit list sectors waiting in commit batch queue
|
||||
precommit list sectors waiting in precommit batch queue
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
@ -1543,13 +1543,13 @@ OPTIONS:
|
||||
|
||||
```
|
||||
|
||||
#### lotus-miner sectors batching pending-commit
|
||||
#### lotus-miner sectors batching commit
|
||||
```
|
||||
NAME:
|
||||
lotus-miner sectors batching pending-commit - list sectors waiting in commit batch queue
|
||||
lotus-miner sectors batching commit - list sectors waiting in commit batch queue
|
||||
|
||||
USAGE:
|
||||
lotus-miner sectors batching pending-commit [command options] [arguments...]
|
||||
lotus-miner sectors batching commit [command options] [arguments...]
|
||||
|
||||
OPTIONS:
|
||||
--publish-now send a batch now (default: false)
|
||||
@ -1557,13 +1557,13 @@ OPTIONS:
|
||||
|
||||
```
|
||||
|
||||
#### lotus-miner sectors batching pending-precommit
|
||||
#### lotus-miner sectors batching precommit
|
||||
```
|
||||
NAME:
|
||||
lotus-miner sectors batching pending-precommit - list sectors waiting in precommit batch queue
|
||||
lotus-miner sectors batching precommit - list sectors waiting in precommit batch queue
|
||||
|
||||
USAGE:
|
||||
lotus-miner sectors batching pending-precommit [command options] [arguments...]
|
||||
lotus-miner sectors batching precommit [command options] [arguments...]
|
||||
|
||||
OPTIONS:
|
||||
--publish-now send a batch now (default: false)
|
||||
|
Loading…
Reference in New Issue
Block a user