Integrate the v9 migration

This commit is contained in:
Aayush 2022-10-04 11:29:27 -04:00 committed by Geoff Stuart
parent 2a60cbe66d
commit de95667a6a
5 changed files with 13 additions and 10 deletions

View File

@ -56,7 +56,7 @@ var UpgradeOhSnapHeight = abi.ChainEpoch(-18)
var UpgradeSkyrHeight = abi.ChainEpoch(-19)
var UpgradeV17Height = abi.ChainEpoch(99999999999999)
var UpgradeV17Height = abi.ChainEpoch(100)
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandMainnet,

View File

@ -1,12 +1,12 @@
package datacap
import (
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/builtin/v9/datacap"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
@ -34,7 +34,7 @@ func getDataCap(store adt.Store, ver actors.Version, root rootFunc, addr address
return false, big.Zero(), nil
}
return true, big.Div(dcap, datacap.DatacapGranularity), nil
return true, big.Div(dcap, verifreg9.DataCapGranularity), nil
}
func forEachCap(store adt.Store, ver actors.Version, root rootFunc, cb func(addr address.Address, dcap abi.StoragePower) error) error {
@ -48,6 +48,6 @@ func forEachCap(store adt.Store, ver actors.Version, root rootFunc, cb func(addr
if err != nil {
return err
}
return cb(a, big.Div(dcap, datacap.DatacapGranularity))
return cb(a, big.Div(dcap, verifreg9.DataCapGranularity))
})
}

View File

@ -22,8 +22,8 @@ import (
)
var migrationsCmd = &cli.Command{
Name: "migrate-nv16",
Description: "Run the nv16 migration",
Name: "migrate-nv17",
Description: "Run the nv17 migration",
ArgsUsage: "[block to look back from]",
Flags: []cli.Flag{
&cli.StringFlag{
@ -100,7 +100,7 @@ var migrationsCmd = &cli.Command{
startTime := time.Now()
err = filcns.PreUpgradeActorsV8(ctx, sm, cache, ts1.ParentState(), ts1.Height()-1, ts1)
err = filcns.PreUpgradeActorsV9(ctx, sm, cache, ts1.ParentState(), ts1.Height()-1, ts1)
if err != nil {
return err
}
@ -108,7 +108,7 @@ var migrationsCmd = &cli.Command{
fmt.Println("completed round 1, took ", time.Since(startTime))
startTime = time.Now()
newCid1, err := filcns.UpgradeActorsV8(ctx, sm, cache, nil, blk.ParentStateRoot, blk.Height-1, migrationTs)
newCid1, err := filcns.UpgradeActorsV9(ctx, sm, cache, nil, blk.ParentStateRoot, blk.Height-1, migrationTs)
if err != nil {
return err
}
@ -116,13 +116,14 @@ var migrationsCmd = &cli.Command{
fmt.Println("new cid", newCid1)
newCid2, err := filcns.UpgradeActorsV8(ctx, sm, nv15.NewMemMigrationCache(), nil, blk.ParentStateRoot, blk.Height-1, migrationTs)
newCid2, err := filcns.UpgradeActorsV9(ctx, sm, nv15.NewMemMigrationCache(), nil, blk.ParentStateRoot, blk.Height-1, migrationTs)
if err != nil {
return err
}
fmt.Println("completed round actual (without cache), took ", time.Since(startTime))
fmt.Println("new cid", newCid2)
return nil
},
}

2
go.mod
View File

@ -42,7 +42,7 @@ require (
github.com/filecoin-project/go-legs v0.4.4
github.com/filecoin-project/go-padreader v0.0.1
github.com/filecoin-project/go-paramfetch v0.0.4
github.com/filecoin-project/go-state-types v0.1.12
github.com/filecoin-project/go-state-types v0.1.13-0.20221004152844-60ff2344a55e
github.com/filecoin-project/go-statemachine v1.0.2
github.com/filecoin-project/go-statestore v0.2.0
github.com/filecoin-project/go-storedcounter v0.1.0

2
go.sum
View File

@ -345,6 +345,8 @@ github.com/filecoin-project/go-state-types v0.1.8/go.mod h1:UwGVoMsULoCK+bWjEdd/
github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.12 h1:KsC820XAwhhlcS7Fu6Yq7Bim53NbVe+4rWKS+81h+LM=
github.com/filecoin-project/go-state-types v0.1.12/go.mod h1:n/kujdC9JphvYTrmaD1+vJpvDPy/DwzckoMzP0nBKWI=
github.com/filecoin-project/go-state-types v0.1.13-0.20221004152844-60ff2344a55e h1:vmBYH93NV8Q8CCPvg8ZjFrBEabtv3y42e38E0zMA5xM=
github.com/filecoin-project/go-state-types v0.1.13-0.20221004152844-60ff2344a55e/go.mod h1:+HCZifUV+e8TlQkgll22Ucuiq8OrVJkK+4Kh4u75iiw=
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
github.com/filecoin-project/go-statemachine v1.0.2 h1:421SSWBk8GIoCoWYYTE/d+qCWccgmRH0uXotXRDjUbc=
github.com/filecoin-project/go-statemachine v1.0.2/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=