lotus/itests/kit/ensemble_opts_nv.go
TippyFlits 4313f990ce [WIP] feat: Add nv22 skeleton
Addition of Network Version 22 skeleton
2024-01-11 10:54:24 -05:00

47 lines
1.2 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 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.Version21,
Height: -1,
}, stmgr.Upgrade{
Network: network.Version22,
Height: upgradeHeight,
Migration: filcns.UpgradeActorsV13,
})
/* inline-gen end */
}