lotus/itests/kit/ensemble_opts_nv.go
Phi 8b5da86727 feat: introduce local nv21 skeleton
Introduce nv21 skeleton for local testing:

- Use local go-state-types with actor_version_checklist changes: https://github.com/filecoin-project/go-state-types/blob/master/actors_version_checklist.md
- Imports mock v12-actors bundle
- Define upgrade heights
- Generate adapters
- Add upgrade schedule and migration
- Add actorstype to the NewActorRegistry in /chain/consensus/computestate.go
- Add upgrade field to api/types.go/ForkUpgradeParams
- Add upgrade to node/impl/full/state.go
- Add network version to chain/state/statetree.go
- make jen
- make docsgen-cli
2023-08-16 20:01:48 +02:00

72 lines
1.8 KiB
Go

package kit
import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/chain/consensus/filcns"
"github.com/filecoin-project/lotus/chain/stmgr"
)
func UpgradeSchedule(upgrades ...stmgr.Upgrade) EnsembleOpt {
return func(opts *ensembleOpts) error {
opts.upgradeSchedule = upgrades
return opts.upgradeSchedule.Validate()
}
}
// GenesisNetworkVersion sets the network version of genesis.
func GenesisNetworkVersion(nv network.Version) EnsembleOpt {
return UpgradeSchedule(stmgr.Upgrade{
Network: nv,
Height: -1,
})
}
func SDRUpgradeAt(calico, persian abi.ChainEpoch) EnsembleOpt {
return UpgradeSchedule(stmgr.Upgrade{
Network: network.Version6,
Height: -1,
}, stmgr.Upgrade{
Network: network.Version7,
Height: calico,
Migration: filcns.UpgradeCalico,
}, stmgr.Upgrade{
Network: network.Version8,
Height: persian,
})
}
func LatestActorsAt(upgradeHeight abi.ChainEpoch) EnsembleOpt {
/* inline-gen template
return UpgradeSchedule(stmgr.Upgrade{
Network: network.Version{{add .latestNetworkVersion -1}},
Height: -1,
}, stmgr.Upgrade{
Network: network.Version{{.latestNetworkVersion}},
Height: upgradeHeight,
Migration: filcns.UpgradeActorsV{{.latestActorsVersion}},
})
/* inline-gen start */
return UpgradeSchedule(stmgr.Upgrade{
Network: network.Version20,
Height: -1,
}, stmgr.Upgrade{
Network: network.Version21,
Height: upgradeHeight,
Migration: filcns.UpgradeActorsV12,
})
/* inline-gen end */
}
func TurboUpgradeAt(upgradeHeight abi.ChainEpoch) EnsembleOpt {
return UpgradeSchedule(stmgr.Upgrade{
Network: network.Version11,
Height: -1,
}, stmgr.Upgrade{
Network: network.Version12,
Height: upgradeHeight,
Migration: filcns.UpgradeActorsV4,
})
}