feat: implement FIP-0061
This commit is contained in:
parent
2dd67dc895
commit
6d45c37dc5
@ -718,16 +718,6 @@ workflows:
|
|||||||
suite: itest-mempool
|
suite: itest-mempool
|
||||||
target: "./itests/mempool_test.go"
|
target: "./itests/mempool_test.go"
|
||||||
|
|
||||||
- test:
|
|
||||||
name: test-itest-migration_nv17
|
|
||||||
suite: itest-migration_nv17
|
|
||||||
target: "./itests/migration_nv17_test.go"
|
|
||||||
|
|
||||||
- test:
|
|
||||||
name: test-itest-migration_nv18
|
|
||||||
suite: itest-migration_nv18
|
|
||||||
target: "./itests/migration_nv18_test.go"
|
|
||||||
|
|
||||||
- test:
|
- test:
|
||||||
name: test-itest-mpool_msg_uuid
|
name: test-itest-mpool_msg_uuid
|
||||||
suite: itest-mpool_msg_uuid
|
suite: itest-mpool_msg_uuid
|
||||||
|
@ -175,15 +175,15 @@ func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.Re
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch proof {
|
switch proof {
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1:
|
||||||
return abi.RegisteredSealProof_StackedDrg2KiBV1_1, nil
|
return abi.RegisteredSealProof_StackedDrg2KiBV1_1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1, abi.RegisteredPoStProof_StackedDrgWindow8MiBV1_1:
|
||||||
return abi.RegisteredSealProof_StackedDrg8MiBV1_1, nil
|
return abi.RegisteredSealProof_StackedDrg8MiBV1_1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1, abi.RegisteredPoStProof_StackedDrgWindow512MiBV1_1:
|
||||||
return abi.RegisteredSealProof_StackedDrg512MiBV1_1, nil
|
return abi.RegisteredSealProof_StackedDrg512MiBV1_1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1, abi.RegisteredPoStProof_StackedDrgWindow32GiBV1_1:
|
||||||
return abi.RegisteredSealProof_StackedDrg32GiBV1_1, nil
|
return abi.RegisteredSealProof_StackedDrg32GiBV1_1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1_1:
|
||||||
return abi.RegisteredSealProof_StackedDrg64GiBV1_1, nil
|
return abi.RegisteredSealProof_StackedDrg64GiBV1_1, nil
|
||||||
default:
|
default:
|
||||||
return -1, xerrors.Errorf("unrecognized window post type: %d", proof)
|
return -1, xerrors.Errorf("unrecognized window post type: %d", proof)
|
||||||
@ -192,15 +192,15 @@ func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.Re
|
|||||||
|
|
||||||
func WinningPoStProofTypeFromWindowPoStProofType(nver network.Version, proof abi.RegisteredPoStProof) (abi.RegisteredPoStProof, error) {
|
func WinningPoStProofTypeFromWindowPoStProofType(nver network.Version, proof abi.RegisteredPoStProof) (abi.RegisteredPoStProof, error) {
|
||||||
switch proof {
|
switch proof {
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1:
|
||||||
return abi.RegisteredPoStProof_StackedDrgWinning2KiBV1, nil
|
return abi.RegisteredPoStProof_StackedDrgWinning2KiBV1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1, abi.RegisteredPoStProof_StackedDrgWindow8MiBV1_1:
|
||||||
return abi.RegisteredPoStProof_StackedDrgWinning8MiBV1, nil
|
return abi.RegisteredPoStProof_StackedDrgWinning8MiBV1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1, abi.RegisteredPoStProof_StackedDrgWindow512MiBV1_1:
|
||||||
return abi.RegisteredPoStProof_StackedDrgWinning512MiBV1, nil
|
return abi.RegisteredPoStProof_StackedDrgWinning512MiBV1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1, abi.RegisteredPoStProof_StackedDrgWindow32GiBV1_1:
|
||||||
return abi.RegisteredPoStProof_StackedDrgWinning32GiBV1, nil
|
return abi.RegisteredPoStProof_StackedDrgWinning32GiBV1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1_1:
|
||||||
return abi.RegisteredPoStProof_StackedDrgWinning64GiBV1, nil
|
return abi.RegisteredPoStProof_StackedDrgWinning64GiBV1, nil
|
||||||
default:
|
default:
|
||||||
return -1, xerrors.Errorf("unknown proof type %d", proof)
|
return -1, xerrors.Errorf("unknown proof type %d", proof)
|
||||||
|
@ -229,15 +229,15 @@ func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.Re
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch proof {
|
switch proof {
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1:
|
||||||
return abi.RegisteredSealProof_StackedDrg2KiBV1_1, nil
|
return abi.RegisteredSealProof_StackedDrg2KiBV1_1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1, abi.RegisteredPoStProof_StackedDrgWindow8MiBV1_1:
|
||||||
return abi.RegisteredSealProof_StackedDrg8MiBV1_1, nil
|
return abi.RegisteredSealProof_StackedDrg8MiBV1_1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1, abi.RegisteredPoStProof_StackedDrgWindow512MiBV1_1:
|
||||||
return abi.RegisteredSealProof_StackedDrg512MiBV1_1, nil
|
return abi.RegisteredSealProof_StackedDrg512MiBV1_1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1, abi.RegisteredPoStProof_StackedDrgWindow32GiBV1_1:
|
||||||
return abi.RegisteredSealProof_StackedDrg32GiBV1_1, nil
|
return abi.RegisteredSealProof_StackedDrg32GiBV1_1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1_1:
|
||||||
return abi.RegisteredSealProof_StackedDrg64GiBV1_1, nil
|
return abi.RegisteredSealProof_StackedDrg64GiBV1_1, nil
|
||||||
default:
|
default:
|
||||||
return -1, xerrors.Errorf("unrecognized window post type: %d", proof)
|
return -1, xerrors.Errorf("unrecognized window post type: %d", proof)
|
||||||
@ -246,15 +246,15 @@ func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.Re
|
|||||||
|
|
||||||
func WinningPoStProofTypeFromWindowPoStProofType(nver network.Version, proof abi.RegisteredPoStProof) (abi.RegisteredPoStProof, error) {
|
func WinningPoStProofTypeFromWindowPoStProofType(nver network.Version, proof abi.RegisteredPoStProof) (abi.RegisteredPoStProof, error) {
|
||||||
switch proof {
|
switch proof {
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1:
|
||||||
return abi.RegisteredPoStProof_StackedDrgWinning2KiBV1, nil
|
return abi.RegisteredPoStProof_StackedDrgWinning2KiBV1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1, abi.RegisteredPoStProof_StackedDrgWindow8MiBV1_1:
|
||||||
return abi.RegisteredPoStProof_StackedDrgWinning8MiBV1, nil
|
return abi.RegisteredPoStProof_StackedDrgWinning8MiBV1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1, abi.RegisteredPoStProof_StackedDrgWindow512MiBV1_1:
|
||||||
return abi.RegisteredPoStProof_StackedDrgWinning512MiBV1, nil
|
return abi.RegisteredPoStProof_StackedDrgWinning512MiBV1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1, abi.RegisteredPoStProof_StackedDrgWindow32GiBV1_1:
|
||||||
return abi.RegisteredPoStProof_StackedDrgWinning32GiBV1, nil
|
return abi.RegisteredPoStProof_StackedDrgWinning32GiBV1, nil
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1:
|
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1_1:
|
||||||
return abi.RegisteredPoStProof_StackedDrgWinning64GiBV1, nil
|
return abi.RegisteredPoStProof_StackedDrgWinning64GiBV1, nil
|
||||||
default:
|
default:
|
||||||
return -1, xerrors.Errorf("unknown proof type %d", proof)
|
return -1, xerrors.Errorf("unknown proof type %d", proof)
|
||||||
|
@ -33,18 +33,18 @@ func AllPartSectors(mas State, sget func(Partition) (bitfield.BitField, error))
|
|||||||
// new miner actors and new sectors
|
// new miner actors and new sectors
|
||||||
func SealProofTypeFromSectorSize(ssize abi.SectorSize, nv network.Version) (abi.RegisteredSealProof, error) {
|
func SealProofTypeFromSectorSize(ssize abi.SectorSize, nv network.Version) (abi.RegisteredSealProof, error) {
|
||||||
switch {
|
switch {
|
||||||
case nv < network.Version7:
|
case nv >= network.Version19:
|
||||||
switch ssize {
|
switch ssize {
|
||||||
case 2 << 10:
|
case 2 << 10:
|
||||||
return abi.RegisteredSealProof_StackedDrg2KiBV1, nil
|
return abi.RegisteredSealProof_StackedDrg2KiBV1_1, nil
|
||||||
case 8 << 20:
|
case 8 << 20:
|
||||||
return abi.RegisteredSealProof_StackedDrg8MiBV1, nil
|
return abi.RegisteredSealProof_StackedDrg8MiBV1_1, nil
|
||||||
case 512 << 20:
|
case 512 << 20:
|
||||||
return abi.RegisteredSealProof_StackedDrg512MiBV1, nil
|
return abi.RegisteredSealProof_StackedDrg512MiBV1_1, nil
|
||||||
case 32 << 30:
|
case 32 << 30:
|
||||||
return abi.RegisteredSealProof_StackedDrg32GiBV1, nil
|
return abi.RegisteredSealProof_StackedDrg32GiBV1_1, nil
|
||||||
case 64 << 30:
|
case 64 << 30:
|
||||||
return abi.RegisteredSealProof_StackedDrg64GiBV1, nil
|
return abi.RegisteredSealProof_StackedDrg64GiBV1_1, nil
|
||||||
default:
|
default:
|
||||||
return 0, xerrors.Errorf("unsupported sector size for miner: %v", ssize)
|
return 0, xerrors.Errorf("unsupported sector size for miner: %v", ssize)
|
||||||
}
|
}
|
||||||
@ -63,6 +63,21 @@ func SealProofTypeFromSectorSize(ssize abi.SectorSize, nv network.Version) (abi.
|
|||||||
default:
|
default:
|
||||||
return 0, xerrors.Errorf("unsupported sector size for miner: %v", ssize)
|
return 0, xerrors.Errorf("unsupported sector size for miner: %v", ssize)
|
||||||
}
|
}
|
||||||
|
case nv < network.Version7:
|
||||||
|
switch ssize {
|
||||||
|
case 2 << 10:
|
||||||
|
return abi.RegisteredSealProof_StackedDrg2KiBV1, nil
|
||||||
|
case 8 << 20:
|
||||||
|
return abi.RegisteredSealProof_StackedDrg8MiBV1, nil
|
||||||
|
case 512 << 20:
|
||||||
|
return abi.RegisteredSealProof_StackedDrg512MiBV1, nil
|
||||||
|
case 32 << 30:
|
||||||
|
return abi.RegisteredSealProof_StackedDrg32GiBV1, nil
|
||||||
|
case 64 << 30:
|
||||||
|
return abi.RegisteredSealProof_StackedDrg64GiBV1, nil
|
||||||
|
default:
|
||||||
|
return 0, xerrors.Errorf("unsupported sector size for miner: %v", ssize)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0, xerrors.Errorf("unsupported network version")
|
return 0, xerrors.Errorf("unsupported network version")
|
||||||
|
@ -17,6 +17,7 @@ import (
|
|||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
power11 "github.com/filecoin-project/go-state-types/builtin/v11/power"
|
||||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||||
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||||
@ -27,6 +28,7 @@ import (
|
|||||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||||
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
||||||
|
power2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/power"
|
||||||
reward2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/reward"
|
reward2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/reward"
|
||||||
power4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/power"
|
power4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/power"
|
||||||
reward4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/reward"
|
reward4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/reward"
|
||||||
@ -135,14 +137,32 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
constructorParams := &power0.CreateMinerParams{
|
var params []byte
|
||||||
|
if nv <= network.Version10 {
|
||||||
|
constructorParams := &power2.CreateMinerParams{
|
||||||
Owner: m.Worker,
|
Owner: m.Worker,
|
||||||
Worker: m.Worker,
|
Worker: m.Worker,
|
||||||
Peer: []byte(m.PeerId),
|
Peer: []byte(m.PeerId),
|
||||||
SealProofType: spt,
|
SealProofType: spt,
|
||||||
}
|
}
|
||||||
|
|
||||||
params := mustEnc(constructorParams)
|
params = mustEnc(constructorParams)
|
||||||
|
} else {
|
||||||
|
ppt, err := spt.RegisteredWindowPoStProofByNetworkVersion(nv)
|
||||||
|
if err != nil {
|
||||||
|
return cid.Undef, xerrors.Errorf("failed to convert spt to wpt: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
constructorParams := &power11.CreateMinerParams{
|
||||||
|
Owner: m.Worker,
|
||||||
|
Worker: m.Worker,
|
||||||
|
Peer: []byte(m.PeerId),
|
||||||
|
WindowPoStProofType: ppt,
|
||||||
|
}
|
||||||
|
|
||||||
|
params = mustEnc(constructorParams)
|
||||||
|
}
|
||||||
|
|
||||||
rval, err := doExecValue(ctx, genesisVm, power.Address, m.Owner, m.PowerBalance, power.Methods.CreateMiner, params)
|
rval, err := doExecValue(ctx, genesisVm, power.Address, m.Owner, m.PowerBalance, power.Methods.CreateMiner, params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cid.Undef, xerrors.Errorf("failed to create genesis miner: %w", err)
|
return cid.Undef, xerrors.Errorf("failed to create genesis miner: %w", err)
|
||||||
|
@ -407,8 +407,18 @@ var sealBenchCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
verifyWinningPost2 := time.Now()
|
verifyWinningPost2 := time.Now()
|
||||||
|
|
||||||
|
ppt, err := sealedSectors[0].SealProof.RegisteredWindowPoStProof()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
ppt, err = ppt.ToV1_1PostProof()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
log.Info("computing window post snark (cold)")
|
log.Info("computing window post snark (cold)")
|
||||||
wproof1, _, err := sb.GenerateWindowPoSt(context.TODO(), mid, extendedSealedSectors, challenge[:])
|
wproof1, _, err := sb.GenerateWindowPoSt(context.TODO(), mid, ppt, extendedSealedSectors, challenge[:])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -416,7 +426,7 @@ var sealBenchCmd = &cli.Command{
|
|||||||
windowpost1 := time.Now()
|
windowpost1 := time.Now()
|
||||||
|
|
||||||
log.Info("computing window post snark (hot)")
|
log.Info("computing window post snark (hot)")
|
||||||
wproof2, _, err := sb.GenerateWindowPoSt(context.TODO(), mid, extendedSealedSectors, challenge[:])
|
wproof2, _, err := sb.GenerateWindowPoSt(context.TODO(), mid, ppt, extendedSealedSectors, challenge[:])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
2
extern/filecoin-ffi
vendored
2
extern/filecoin-ffi
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 28e3cd44d91681c074aba362d1e5c954db110ad9
|
Subproject commit cec06f7f9d4c8ffd38caf4f7ac97381b453575ef
|
2
go.mod
2
go.mod
@ -46,7 +46,7 @@ require (
|
|||||||
github.com/filecoin-project/go-legs v0.4.4
|
github.com/filecoin-project/go-legs v0.4.4
|
||||||
github.com/filecoin-project/go-padreader v0.0.1
|
github.com/filecoin-project/go-padreader v0.0.1
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.4
|
github.com/filecoin-project/go-paramfetch v0.0.4
|
||||||
github.com/filecoin-project/go-state-types v0.11.0-alpha-2
|
github.com/filecoin-project/go-state-types v0.11.0-alpha-3.0.20230405192832-39cd7e4a3ed7
|
||||||
github.com/filecoin-project/go-statemachine v1.0.2
|
github.com/filecoin-project/go-statemachine v1.0.2
|
||||||
github.com/filecoin-project/go-statestore v0.2.0
|
github.com/filecoin-project/go-statestore v0.2.0
|
||||||
github.com/filecoin-project/go-storedcounter v0.1.0
|
github.com/filecoin-project/go-storedcounter v0.1.0
|
||||||
|
10
go.sum
10
go.sum
@ -298,7 +298,6 @@ github.com/filecoin-project/dagstore v0.5.2 h1:Nd6oXdnolbbVhpMpkYT5PJHOjQp4OBSnt
|
|||||||
github.com/filecoin-project/dagstore v0.5.2/go.mod h1:mdqKzYrRBHf1pRMthYfMv3n37oOw0Tkx7+TxPt240M0=
|
github.com/filecoin-project/dagstore v0.5.2/go.mod h1:mdqKzYrRBHf1pRMthYfMv3n37oOw0Tkx7+TxPt240M0=
|
||||||
github.com/filecoin-project/go-address v0.0.3/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8=
|
github.com/filecoin-project/go-address v0.0.3/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8=
|
||||||
github.com/filecoin-project/go-address v0.0.5/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8=
|
github.com/filecoin-project/go-address v0.0.5/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8=
|
||||||
github.com/filecoin-project/go-address v0.0.6/go.mod h1:7B0/5DA13n6nHkB8bbGx1gWzG/dbTsZ0fgOJVGsM3TE=
|
|
||||||
github.com/filecoin-project/go-address v1.1.0 h1:ofdtUtEsNxkIxkDw67ecSmvtzaVSdcea4boAmLbnHfE=
|
github.com/filecoin-project/go-address v1.1.0 h1:ofdtUtEsNxkIxkDw67ecSmvtzaVSdcea4boAmLbnHfE=
|
||||||
github.com/filecoin-project/go-address v1.1.0/go.mod h1:5t3z6qPmIADZBtuE9EIzi0EwzcRy2nVhpo0I/c1r0OA=
|
github.com/filecoin-project/go-address v1.1.0/go.mod h1:5t3z6qPmIADZBtuE9EIzi0EwzcRy2nVhpo0I/c1r0OA=
|
||||||
github.com/filecoin-project/go-amt-ipld/v2 v2.1.0 h1:t6qDiuGYYngDqaLc2ZUvdtAg4UNxPeOYaXhBWSNsVaM=
|
github.com/filecoin-project/go-amt-ipld/v2 v2.1.0 h1:t6qDiuGYYngDqaLc2ZUvdtAg4UNxPeOYaXhBWSNsVaM=
|
||||||
@ -354,10 +353,10 @@ github.com/filecoin-project/go-state-types v0.0.0-20200928172055-2df22083d8ab/go
|
|||||||
github.com/filecoin-project/go-state-types v0.0.0-20201102161440-c8033295a1fc/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
github.com/filecoin-project/go-state-types v0.0.0-20201102161440-c8033295a1fc/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
||||||
github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
||||||
github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
||||||
github.com/filecoin-project/go-state-types v0.1.8/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
|
||||||
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.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
||||||
github.com/filecoin-project/go-state-types v0.11.0-alpha-2 h1:LlJHUV0yL5gcP+8QH5JKIEluYC05d6g0DJot3UP47ZE=
|
github.com/filecoin-project/go-state-types v0.11.0-alpha-2.0.20230331142914-3c737db98e58/go.mod h1:aLIas+W8BWAfpLWEPUOGMPBdhcVwoCG4pIQSQk26024=
|
||||||
github.com/filecoin-project/go-state-types v0.11.0-alpha-2/go.mod h1:aLIas+W8BWAfpLWEPUOGMPBdhcVwoCG4pIQSQk26024=
|
github.com/filecoin-project/go-state-types v0.11.0-alpha-3.0.20230405192832-39cd7e4a3ed7 h1:xH2EDAv9s2WltPmRU8arGs8bfCKW8lIwKNZmSijsoXQ=
|
||||||
|
github.com/filecoin-project/go-state-types v0.11.0-alpha-3.0.20230405192832-39cd7e4a3ed7/go.mod h1:SyNPwTsU7I22gL2r0OAPcImvLoTVfgRwdK/Y5rR1zz8=
|
||||||
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
|
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 h1:421SSWBk8GIoCoWYYTE/d+qCWccgmRH0uXotXRDjUbc=
|
||||||
github.com/filecoin-project/go-statemachine v1.0.2/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
|
github.com/filecoin-project/go-statemachine v1.0.2/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
|
||||||
@ -903,6 +902,7 @@ github.com/ipld/go-ipld-prime v0.11.0/go.mod h1:+WIAkokurHmZ/KwzDOMUuoeJgaRQktHt
|
|||||||
github.com/ipld/go-ipld-prime v0.14.0/go.mod h1:9ASQLwUFLptCov6lIYc70GRB4V7UTyLD0IJtrDJe6ZM=
|
github.com/ipld/go-ipld-prime v0.14.0/go.mod h1:9ASQLwUFLptCov6lIYc70GRB4V7UTyLD0IJtrDJe6ZM=
|
||||||
github.com/ipld/go-ipld-prime v0.16.0/go.mod h1:axSCuOCBPqrH+gvXr2w9uAOulJqBPhHPT2PjoiiU1qA=
|
github.com/ipld/go-ipld-prime v0.16.0/go.mod h1:axSCuOCBPqrH+gvXr2w9uAOulJqBPhHPT2PjoiiU1qA=
|
||||||
github.com/ipld/go-ipld-prime v0.17.0/go.mod h1:aYcKm5TIvGfY8P3QBKz/2gKcLxzJ1zDaD+o0bOowhgs=
|
github.com/ipld/go-ipld-prime v0.17.0/go.mod h1:aYcKm5TIvGfY8P3QBKz/2gKcLxzJ1zDaD+o0bOowhgs=
|
||||||
|
github.com/ipld/go-ipld-prime v0.19.0/go.mod h1:Q9j3BaVXwaA3o5JUDNvptDDr/x8+F7FG6XJ8WI3ILg4=
|
||||||
github.com/ipld/go-ipld-prime v0.20.0 h1:Ud3VwE9ClxpO2LkCYP7vWPc0Fo+dYdYzgxUJZ3uRG4g=
|
github.com/ipld/go-ipld-prime v0.20.0 h1:Ud3VwE9ClxpO2LkCYP7vWPc0Fo+dYdYzgxUJZ3uRG4g=
|
||||||
github.com/ipld/go-ipld-prime v0.20.0/go.mod h1:PzqZ/ZR981eKbgdr3y2DJYeD/8bgMawdGVlJDE8kK+M=
|
github.com/ipld/go-ipld-prime v0.20.0/go.mod h1:PzqZ/ZR981eKbgdr3y2DJYeD/8bgMawdGVlJDE8kK+M=
|
||||||
github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5/go.mod h1:gcvzoEDBjwycpXt3LBE061wT9f46szXGHAmj9uoP6fU=
|
github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5/go.mod h1:gcvzoEDBjwycpXt3LBE061wT9f46szXGHAmj9uoP6fU=
|
||||||
@ -1527,6 +1527,7 @@ github.com/multiformats/go-multicodec v0.3.1-0.20210902112759-1539a079fd61/go.mo
|
|||||||
github.com/multiformats/go-multicodec v0.3.1-0.20211210143421-a526f306ed2c/go.mod h1:1Hj/eHRaVWSXiSNNfcEPcwZleTmdNP81xlxDLnWU9GQ=
|
github.com/multiformats/go-multicodec v0.3.1-0.20211210143421-a526f306ed2c/go.mod h1:1Hj/eHRaVWSXiSNNfcEPcwZleTmdNP81xlxDLnWU9GQ=
|
||||||
github.com/multiformats/go-multicodec v0.4.1/go.mod h1:1Hj/eHRaVWSXiSNNfcEPcwZleTmdNP81xlxDLnWU9GQ=
|
github.com/multiformats/go-multicodec v0.4.1/go.mod h1:1Hj/eHRaVWSXiSNNfcEPcwZleTmdNP81xlxDLnWU9GQ=
|
||||||
github.com/multiformats/go-multicodec v0.5.0/go.mod h1:DiY2HFaEp5EhEXb/iYzVAunmyX/aSFMxq2KMKfWEues=
|
github.com/multiformats/go-multicodec v0.5.0/go.mod h1:DiY2HFaEp5EhEXb/iYzVAunmyX/aSFMxq2KMKfWEues=
|
||||||
|
github.com/multiformats/go-multicodec v0.6.0/go.mod h1:GUC8upxSBE4oG+q3kWZRw/+6yC1BqO550bjhWsJbZlw=
|
||||||
github.com/multiformats/go-multicodec v0.8.0 h1:evBmgkbSQux+Ds2IgfhkO38Dl2GDtRW8/Rp6YiSHX/Q=
|
github.com/multiformats/go-multicodec v0.8.0 h1:evBmgkbSQux+Ds2IgfhkO38Dl2GDtRW8/Rp6YiSHX/Q=
|
||||||
github.com/multiformats/go-multicodec v0.8.0/go.mod h1:GUC8upxSBE4oG+q3kWZRw/+6yC1BqO550bjhWsJbZlw=
|
github.com/multiformats/go-multicodec v0.8.0/go.mod h1:GUC8upxSBE4oG+q3kWZRw/+6yC1BqO550bjhWsJbZlw=
|
||||||
github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U=
|
github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U=
|
||||||
@ -2056,6 +2057,7 @@ golang.org/x/crypto v0.0.0-20210813211128-0a44fdfbc16e/go.mod h1:GvvjBRRGRdwPK5y
|
|||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
|
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM=
|
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM=
|
||||||
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
|
@ -1,98 +0,0 @@
|
|||||||
package itests
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
|
||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
|
||||||
"github.com/filecoin-project/go-state-types/builtin"
|
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
|
||||||
"github.com/filecoin-project/go-state-types/network"
|
|
||||||
gstStore "github.com/filecoin-project/go-state-types/store"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/blockstore"
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
|
||||||
builtin2 "github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
||||||
"github.com/filecoin-project/lotus/chain/consensus/filcns"
|
|
||||||
"github.com/filecoin-project/lotus/chain/state"
|
|
||||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types/ethtypes"
|
|
||||||
"github.com/filecoin-project/lotus/chain/vm"
|
|
||||||
"github.com/filecoin-project/lotus/itests/kit"
|
|
||||||
"github.com/filecoin-project/lotus/node/impl"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestMigrationNV18(t *testing.T) {
|
|
||||||
kit.QuietMiningLogs()
|
|
||||||
|
|
||||||
nv18epoch := abi.ChainEpoch(100)
|
|
||||||
testClient, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(),
|
|
||||||
kit.UpgradeSchedule(stmgr.Upgrade{
|
|
||||||
Network: network.Version17,
|
|
||||||
Height: -1,
|
|
||||||
}, stmgr.Upgrade{
|
|
||||||
Network: network.Version18,
|
|
||||||
Height: nv18epoch,
|
|
||||||
Migration: filcns.UpgradeActorsV10,
|
|
||||||
},
|
|
||||||
))
|
|
||||||
|
|
||||||
ens.InterconnectAll().BeginMining(10 * time.Millisecond)
|
|
||||||
|
|
||||||
clientApi := testClient.FullNode.(*impl.FullNodeAPI)
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
testClient.WaitTillChain(ctx, kit.HeightAtLeast(nv18epoch+5))
|
|
||||||
|
|
||||||
// Now that we have upgraded, we need to:
|
|
||||||
// - the EAM exists, has "empty" state
|
|
||||||
// - the EthZeroAddress exists
|
|
||||||
// - all actors have nil Address fields
|
|
||||||
|
|
||||||
bs := blockstore.NewAPIBlockstore(testClient)
|
|
||||||
ctxStore := gstStore.WrapBlockStore(ctx, bs)
|
|
||||||
|
|
||||||
currTs, err := clientApi.ChainHead(ctx)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
newStateTree, err := state.LoadStateTree(ctxStore, currTs.Blocks()[0].ParentStateRoot)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
require.Equal(t, types.StateTreeVersion5, newStateTree.Version())
|
|
||||||
|
|
||||||
codeIDsv10, ok := actors.GetActorCodeIDsFromManifest(actorstypes.Version10)
|
|
||||||
require.True(t, ok)
|
|
||||||
|
|
||||||
// check the EAM actor
|
|
||||||
EAMActor, err := newStateTree.GetActor(builtin.EthereumAddressManagerActorAddr)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, vm.EmptyObjectCid, EAMActor.Head)
|
|
||||||
EAMCodeID, ok := codeIDsv10[manifest.EamKey]
|
|
||||||
require.True(t, ok)
|
|
||||||
require.Equal(t, EAMCodeID, EAMActor.Code)
|
|
||||||
|
|
||||||
// check the EthZeroAddress
|
|
||||||
ethZeroAddr, err := (ethtypes.EthAddress{}).ToFilecoinAddress()
|
|
||||||
require.NoError(t, err)
|
|
||||||
ethZeroAddrID, err := newStateTree.LookupID(ethZeroAddr)
|
|
||||||
require.NoError(t, err)
|
|
||||||
ethZeroActor, err := newStateTree.GetActor(ethZeroAddrID)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.True(t, builtin2.IsEthAccountActor(ethZeroActor.Code))
|
|
||||||
require.Equal(t, vm.EmptyObjectCid, ethZeroActor.Head)
|
|
||||||
|
|
||||||
// check all actor's Address fields
|
|
||||||
require.NoError(t, newStateTree.ForEach(func(address address.Address, actor *types.Actor) error {
|
|
||||||
if address != ethZeroAddrID {
|
|
||||||
require.Nil(t, actor.Address)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}))
|
|
||||||
}
|
|
@ -11,6 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
"github.com/filecoin-project/go-state-types/builtin"
|
"github.com/filecoin-project/go-state-types/builtin"
|
||||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||||
@ -18,12 +19,14 @@ import (
|
|||||||
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||||
verifregst "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
verifregst "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||||
"github.com/filecoin-project/go-state-types/crypto"
|
"github.com/filecoin-project/go-state-types/crypto"
|
||||||
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
"github.com/filecoin-project/go-state-types/network"
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
gstStore "github.com/filecoin-project/go-state-types/store"
|
gstStore "github.com/filecoin-project/go-state-types/store"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/blockstore"
|
"github.com/filecoin-project/lotus/blockstore"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
builtin2 "github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/datacap"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/datacap"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
@ -32,6 +35,8 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/state"
|
"github.com/filecoin-project/lotus/chain/state"
|
||||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
"github.com/filecoin-project/lotus/chain/types/ethtypes"
|
||||||
|
"github.com/filecoin-project/lotus/chain/vm"
|
||||||
"github.com/filecoin-project/lotus/chain/wallet/key"
|
"github.com/filecoin-project/lotus/chain/wallet/key"
|
||||||
"github.com/filecoin-project/lotus/itests/kit"
|
"github.com/filecoin-project/lotus/itests/kit"
|
||||||
"github.com/filecoin-project/lotus/node/impl"
|
"github.com/filecoin-project/lotus/node/impl"
|
||||||
@ -520,3 +525,72 @@ func TestMigrationNV17(t *testing.T) {
|
|||||||
|
|
||||||
require.Nil(t, dc)
|
require.Nil(t, dc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMigrationNV19(t *testing.T) {
|
||||||
|
kit.QuietMiningLogs()
|
||||||
|
|
||||||
|
nv18epoch := abi.ChainEpoch(100)
|
||||||
|
testClient, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(),
|
||||||
|
kit.UpgradeSchedule(stmgr.Upgrade{
|
||||||
|
Network: network.Version17,
|
||||||
|
Height: -1,
|
||||||
|
}, stmgr.Upgrade{
|
||||||
|
Network: network.Version18,
|
||||||
|
Height: nv18epoch,
|
||||||
|
Migration: filcns.UpgradeActorsV10,
|
||||||
|
},
|
||||||
|
))
|
||||||
|
|
||||||
|
ens.InterconnectAll().BeginMining(10 * time.Millisecond)
|
||||||
|
|
||||||
|
clientApi := testClient.FullNode.(*impl.FullNodeAPI)
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
testClient.WaitTillChain(ctx, kit.HeightAtLeast(nv18epoch+5))
|
||||||
|
|
||||||
|
// Now that we have upgraded, we need to:
|
||||||
|
// - the EAM exists, has "empty" state
|
||||||
|
// - the EthZeroAddress exists
|
||||||
|
// - all actors have nil Address fields
|
||||||
|
|
||||||
|
bs := blockstore.NewAPIBlockstore(testClient)
|
||||||
|
ctxStore := gstStore.WrapBlockStore(ctx, bs)
|
||||||
|
|
||||||
|
currTs, err := clientApi.ChainHead(ctx)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
newStateTree, err := state.LoadStateTree(ctxStore, currTs.Blocks()[0].ParentStateRoot)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
require.Equal(t, types.StateTreeVersion5, newStateTree.Version())
|
||||||
|
|
||||||
|
codeIDsv10, ok := actors.GetActorCodeIDsFromManifest(actorstypes.Version10)
|
||||||
|
require.True(t, ok)
|
||||||
|
|
||||||
|
// check the EAM actor
|
||||||
|
EAMActor, err := newStateTree.GetActor(builtin.EthereumAddressManagerActorAddr)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Equal(t, vm.EmptyObjectCid, EAMActor.Head)
|
||||||
|
EAMCodeID, ok := codeIDsv10[manifest.EamKey]
|
||||||
|
require.True(t, ok)
|
||||||
|
require.Equal(t, EAMCodeID, EAMActor.Code)
|
||||||
|
|
||||||
|
// check the EthZeroAddress
|
||||||
|
ethZeroAddr, err := (ethtypes.EthAddress{}).ToFilecoinAddress()
|
||||||
|
require.NoError(t, err)
|
||||||
|
ethZeroAddrID, err := newStateTree.LookupID(ethZeroAddr)
|
||||||
|
require.NoError(t, err)
|
||||||
|
ethZeroActor, err := newStateTree.GetActor(ethZeroAddrID)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.True(t, builtin2.IsEthAccountActor(ethZeroActor.Code))
|
||||||
|
require.Equal(t, vm.EmptyObjectCid, ethZeroActor.Head)
|
||||||
|
|
||||||
|
// check all actor's Address fields
|
||||||
|
require.NoError(t, newStateTree.ForEach(func(address address.Address, actor *types.Actor) error {
|
||||||
|
if address != ethZeroAddrID {
|
||||||
|
require.Nil(t, actor.Address)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}))
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
package itests
|
package itests
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
@ -12,6 +13,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
|
miner11 "github.com/filecoin-project/go-state-types/builtin/v11/miner"
|
||||||
"github.com/filecoin-project/go-state-types/network"
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
@ -343,3 +345,143 @@ waitForProof:
|
|||||||
|
|
||||||
require.NotEqual(t, pmr.GasCost.BaseFeeBurn, big.Zero())
|
require.NotEqual(t, pmr.GasCost.BaseFeeBurn, big.Zero())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tests that V1_1 proofs are generated and accepted in nv19, and V1 proofs are accepted
|
||||||
|
func TestWindowPostV1P1NV19(t *testing.T) {
|
||||||
|
kit.QuietMiningLogs()
|
||||||
|
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
blocktime := 2 * time.Millisecond
|
||||||
|
|
||||||
|
client, miner, ens := kit.EnsembleMinimal(t, kit.GenesisNetworkVersion(network.Version19))
|
||||||
|
ens.InterconnectAll().BeginMining(blocktime)
|
||||||
|
|
||||||
|
maddr, err := miner.ActorAddress(ctx)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
mi, err := client.StateMinerInfo(ctx, maddr, types.EmptyTSK)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||||
|
require.NoError(t, err)
|
||||||
|
en := wact.Nonce
|
||||||
|
|
||||||
|
// wait for a new message to be sent from worker address, it will be a PoSt
|
||||||
|
|
||||||
|
waitForProof:
|
||||||
|
for {
|
||||||
|
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||||
|
require.NoError(t, err)
|
||||||
|
if wact.Nonce > en {
|
||||||
|
break waitForProof
|
||||||
|
}
|
||||||
|
|
||||||
|
build.Clock.Sleep(blocktime)
|
||||||
|
}
|
||||||
|
|
||||||
|
slm, err := client.StateListMessages(ctx, &api.MessageMatch{To: maddr}, types.EmptyTSK, 0)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
pmr, err := client.StateSearchMsg(ctx, types.EmptyTSK, slm[0], -1, false)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
inclTs, err := client.ChainGetTipSet(ctx, pmr.TipSet)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
nv, err := client.StateNetworkVersion(ctx, pmr.TipSet)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Equal(t, network.Version19, nv)
|
||||||
|
|
||||||
|
require.True(t, pmr.Receipt.ExitCode.IsSuccess())
|
||||||
|
|
||||||
|
slmsg, err := client.ChainGetMessage(ctx, slm[0])
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
var params miner11.SubmitWindowedPoStParams
|
||||||
|
require.NoError(t, params.UnmarshalCBOR(bytes.NewBuffer(slmsg.Params)))
|
||||||
|
require.Equal(t, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1, params.Proofs[0].PoStProof)
|
||||||
|
|
||||||
|
// "Turn" this into a V1 proof -- the proof will be invalid, but won't be validated, and so the call should succeed
|
||||||
|
params.Proofs[0].PoStProof = abi.RegisteredPoStProof_StackedDrgWindow2KiBV1
|
||||||
|
v1PostParams := new(bytes.Buffer)
|
||||||
|
require.NoError(t, params.MarshalCBOR(v1PostParams))
|
||||||
|
|
||||||
|
slmsg.Params = v1PostParams.Bytes()
|
||||||
|
|
||||||
|
// Simulate call on inclTs's parents, so that the partition isn't already proven
|
||||||
|
call, err := client.StateCall(ctx, slmsg, inclTs.Parents())
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.True(t, call.MsgRct.ExitCode.IsSuccess())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests that V1_1 proofs are generated and accepted in nv20, and that V1 proofs are NOT
|
||||||
|
func TestWindowPostV1P1NV20(t *testing.T) {
|
||||||
|
kit.QuietMiningLogs()
|
||||||
|
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
blocktime := 2 * time.Millisecond
|
||||||
|
|
||||||
|
client, miner, ens := kit.EnsembleMinimal(t, kit.GenesisNetworkVersion(network.Version20))
|
||||||
|
ens.InterconnectAll().BeginMining(blocktime)
|
||||||
|
|
||||||
|
maddr, err := miner.ActorAddress(ctx)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
mi, err := client.StateMinerInfo(ctx, maddr, types.EmptyTSK)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||||
|
require.NoError(t, err)
|
||||||
|
en := wact.Nonce
|
||||||
|
|
||||||
|
// wait for a new message to be sent from worker address, it will be a PoSt
|
||||||
|
|
||||||
|
waitForProof:
|
||||||
|
for {
|
||||||
|
//stm: @CHAIN_STATE_GET_ACTOR_001
|
||||||
|
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||||
|
require.NoError(t, err)
|
||||||
|
if wact.Nonce > en {
|
||||||
|
break waitForProof
|
||||||
|
}
|
||||||
|
|
||||||
|
build.Clock.Sleep(blocktime)
|
||||||
|
}
|
||||||
|
|
||||||
|
slm, err := client.StateListMessages(ctx, &api.MessageMatch{To: maddr}, types.EmptyTSK, 0)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
pmr, err := client.StateSearchMsg(ctx, types.EmptyTSK, slm[0], -1, false)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
inclTs, err := client.ChainGetTipSet(ctx, pmr.TipSet)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
nv, err := client.StateNetworkVersion(ctx, pmr.TipSet)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Equal(t, network.Version20, nv)
|
||||||
|
|
||||||
|
require.True(t, pmr.Receipt.ExitCode.IsSuccess())
|
||||||
|
|
||||||
|
slmsg, err := client.ChainGetMessage(ctx, slm[0])
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
var params miner11.SubmitWindowedPoStParams
|
||||||
|
require.NoError(t, params.UnmarshalCBOR(bytes.NewBuffer(slmsg.Params)))
|
||||||
|
require.Equal(t, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1, params.Proofs[0].PoStProof)
|
||||||
|
|
||||||
|
// "Turn" this into a V1 proof -- the proof will be invalid, but we won't get that far
|
||||||
|
params.Proofs[0].PoStProof = abi.RegisteredPoStProof_StackedDrgWindow2KiBV1
|
||||||
|
v1PostParams := new(bytes.Buffer)
|
||||||
|
require.NoError(t, params.MarshalCBOR(v1PostParams))
|
||||||
|
|
||||||
|
slmsg.Params = v1PostParams.Bytes()
|
||||||
|
|
||||||
|
// Simulate call on inclTs's parents, so that the partition isn't already proven
|
||||||
|
_, err = client.StateCall(ctx, slmsg, inclTs.Parents())
|
||||||
|
require.ErrorContains(t, err, "expected proof of type StackedDRGWindow2KiBV1P1, got StackedDRGWindow2KiBV1")
|
||||||
|
}
|
||||||
|
@ -97,13 +97,7 @@ func (m *Manager) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
wpp, err := sector.ProofType.RegisteredWindowPoStProof()
|
ch, err := ffi.GeneratePoStFallbackSectorChallenges(pp, sector.ID.Miner, postRand, []abi.SectorNumber{
|
||||||
if err != nil {
|
|
||||||
addBad(sector.ID, fmt.Sprint("can't get proof type"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ch, err := ffi.GeneratePoStFallbackSectorChallenges(wpp, sector.ID.Miner, postRand, []abi.SectorNumber{
|
|
||||||
sector.ID.Number,
|
sector.ID.Number,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -126,7 +120,7 @@ func (m *Manager) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof,
|
|||||||
SealedCID: commr,
|
SealedCID: commr,
|
||||||
Challenge: ch.Challenges[sector.ID.Number],
|
Challenge: ch.Challenges[sector.ID.Number],
|
||||||
Update: update,
|
Update: update,
|
||||||
}, wpp)
|
}, pp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnw("CheckProvable Sector FAULT: generating vanilla proof", "sector", sector, "err", err)
|
log.Warnw("CheckProvable Sector FAULT: generating vanilla proof", "sector", sector, "err", err)
|
||||||
addBad(sector.ID, fmt.Sprintf("generating vanilla proof: %s", err))
|
addBad(sector.ID, fmt.Sprintf("generating vanilla proof: %s", err))
|
||||||
|
@ -190,7 +190,18 @@ func post(t *testing.T, sealer *Sealer, skipped []abi.SectorID, seals ...seal) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proofs, skp, err := sealer.GenerateWindowPoSt(context.TODO(), seals[0].ref.ID.Miner, xsis, randomness)
|
ppt, err := xsis[0].SealProof.RegisteredWindowPoStProof()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%+v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
ppt, err = ppt.ToV1_1PostProof()
|
||||||
|
if err != nil {
|
||||||
|
|
||||||
|
t.Fatalf("%+v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
proofs, skp, err := sealer.GenerateWindowPoSt(context.TODO(), seals[0].ref.ID.Miner, ppt, xsis, randomness)
|
||||||
if len(skipped) > 0 {
|
if len(skipped) > 0 {
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
require.EqualValues(t, skipped, skp)
|
require.EqualValues(t, skipped, skp)
|
||||||
|
@ -18,7 +18,15 @@ import (
|
|||||||
|
|
||||||
func (sb *Sealer) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, error) {
|
func (sb *Sealer) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, error) {
|
||||||
randomness[31] &= 0x3f
|
randomness[31] &= 0x3f
|
||||||
privsectors, skipped, done, err := sb.pubExtendedSectorToPriv(ctx, minerID, sectorInfo, nil, abi.RegisteredSealProof.RegisteredWinningPoStProof) // TODO: FAULTS?
|
if len(sectorInfo) == 0 {
|
||||||
|
return nil, xerrors.Errorf("must provide sectors for winning post")
|
||||||
|
}
|
||||||
|
ppt, err := sectorInfo[0].SealProof.RegisteredWinningPoStProof()
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("failed to convert to winning post proof: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
privsectors, skipped, done, err := sb.pubExtendedSectorToPriv(ctx, minerID, sectorInfo, nil, ppt) // TODO: FAULTS?
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -30,9 +38,9 @@ func (sb *Sealer) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID,
|
|||||||
return ffi.GenerateWinningPoSt(minerID, privsectors, randomness)
|
return ffi.GenerateWinningPoSt(minerID, privsectors, randomness)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sb *Sealer) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, []abi.SectorID, error) {
|
func (sb *Sealer) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, postProofType abi.RegisteredPoStProof, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, []abi.SectorID, error) {
|
||||||
randomness[31] &= 0x3f
|
randomness[31] &= 0x3f
|
||||||
privsectors, skipped, done, err := sb.pubExtendedSectorToPriv(ctx, minerID, sectorInfo, nil, abi.RegisteredSealProof.RegisteredWindowPoStProof)
|
privsectors, skipped, done, err := sb.pubExtendedSectorToPriv(ctx, minerID, sectorInfo, nil, postProofType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, xerrors.Errorf("gathering sector info: %w", err)
|
return nil, nil, xerrors.Errorf("gathering sector info: %w", err)
|
||||||
}
|
}
|
||||||
@ -55,7 +63,7 @@ func (sb *Sealer) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, s
|
|||||||
return proof, faultyIDs, err
|
return proof, faultyIDs, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sb *Sealer) pubExtendedSectorToPriv(ctx context.Context, mid abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, faults []abi.SectorNumber, rpt func(abi.RegisteredSealProof) (abi.RegisteredPoStProof, error)) (ffi.SortedPrivateSectorInfo, []abi.SectorID, func(), error) {
|
func (sb *Sealer) pubExtendedSectorToPriv(ctx context.Context, mid abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, faults []abi.SectorNumber, postProofType abi.RegisteredPoStProof) (ffi.SortedPrivateSectorInfo, []abi.SectorID, func(), error) {
|
||||||
fmap := map[abi.SectorNumber]struct{}{}
|
fmap := map[abi.SectorNumber]struct{}{}
|
||||||
for _, fault := range faults {
|
for _, fault := range faults {
|
||||||
fmap[fault] = struct{}{}
|
fmap[fault] = struct{}{}
|
||||||
@ -106,12 +114,6 @@ func (sb *Sealer) pubExtendedSectorToPriv(ctx context.Context, mid abi.ActorID,
|
|||||||
sealed = paths.Sealed
|
sealed = paths.Sealed
|
||||||
}
|
}
|
||||||
|
|
||||||
postProofType, err := rpt(s.SealProof)
|
|
||||||
if err != nil {
|
|
||||||
done()
|
|
||||||
return ffi.SortedPrivateSectorInfo{}, nil, nil, xerrors.Errorf("acquiring registered PoSt proof from sector info %+v: %w", s, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
ffiInfo := proof.SectorInfo{
|
ffiInfo := proof.SectorInfo{
|
||||||
SealProof: s.SealProof,
|
SealProof: s.SealProof,
|
||||||
SectorNumber: s.SectorNumber,
|
SectorNumber: s.SectorNumber,
|
||||||
|
@ -77,15 +77,15 @@ func (m *Manager) generateWinningPoSt(ctx context.Context, minerID abi.ActorID,
|
|||||||
return proofs, nil
|
return proofs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) (proof []proof.PoStProof, skipped []abi.SectorID, err error) {
|
func (m *Manager) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, postProofType abi.RegisteredPoStProof, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) (proof []proof.PoStProof, skipped []abi.SectorID, err error) {
|
||||||
if !m.disableBuiltinWindowPoSt && !m.windowPoStSched.CanSched(ctx) {
|
if !m.disableBuiltinWindowPoSt && !m.windowPoStSched.CanSched(ctx) {
|
||||||
// if builtin PoSt isn't disabled, and there are no workers, compute the PoSt locally
|
// if builtin PoSt isn't disabled, and there are no workers, compute the PoSt locally
|
||||||
|
|
||||||
log.Info("GenerateWindowPoSt run at lotus-miner")
|
log.Info("GenerateWindowPoSt run at lotus-miner")
|
||||||
return m.localProver.GenerateWindowPoSt(ctx, minerID, sectorInfo, randomness)
|
return m.localProver.GenerateWindowPoSt(ctx, minerID, postProofType, sectorInfo, randomness)
|
||||||
}
|
}
|
||||||
|
|
||||||
return m.generateWindowPoSt(ctx, minerID, sectorInfo, randomness)
|
return m.generateWindowPoSt(ctx, minerID, postProofType, sectorInfo, randomness)
|
||||||
}
|
}
|
||||||
|
|
||||||
func dedupeSectorInfo(sectorInfo []proof.ExtendedSectorInfo) []proof.ExtendedSectorInfo {
|
func dedupeSectorInfo(sectorInfo []proof.ExtendedSectorInfo) []proof.ExtendedSectorInfo {
|
||||||
@ -101,7 +101,7 @@ func dedupeSectorInfo(sectorInfo []proof.ExtendedSectorInfo) []proof.ExtendedSec
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) generateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, []abi.SectorID, error) {
|
func (m *Manager) generateWindowPoSt(ctx context.Context, minerID abi.ActorID, ppt abi.RegisteredPoStProof, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, []abi.SectorID, error) {
|
||||||
var retErr error = nil
|
var retErr error = nil
|
||||||
randomness[31] &= 0x3f
|
randomness[31] &= 0x3f
|
||||||
|
|
||||||
@ -113,11 +113,6 @@ func (m *Manager) generateWindowPoSt(ctx context.Context, minerID abi.ActorID, s
|
|||||||
|
|
||||||
spt := sectorInfo[0].SealProof
|
spt := sectorInfo[0].SealProof
|
||||||
|
|
||||||
ppt, err := spt.RegisteredWindowPoStProof()
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
maxPartitionSize, err := builtin.PoStProofWindowPoStPartitionSectors(ppt) // todo proxy through chain/actors
|
maxPartitionSize, err := builtin.PoStProofWindowPoStPartitionSectors(ppt) // todo proxy through chain/actors
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, xerrors.Errorf("get sectors count of partition failed:%+v", err)
|
return nil, nil, xerrors.Errorf("get sectors count of partition failed:%+v", err)
|
||||||
|
@ -350,10 +350,15 @@ func (mgr *SectorMgr) GenerateWinningPoSt(ctx context.Context, minerID abi.Actor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return generateFakePoSt(sectorInfo, abi.RegisteredSealProof.RegisteredWinningPoStProof, randomness), nil
|
ppt, err := sectorInfo[0].SealProof.RegisteredWinningPoStProof()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return generateFakePoSt(sectorInfo, ppt, randomness), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mgr *SectorMgr) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, xSectorInfo []prooftypes.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]prooftypes.PoStProof, []abi.SectorID, error) {
|
func (mgr *SectorMgr) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, ppt abi.RegisteredPoStProof, xSectorInfo []prooftypes.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]prooftypes.PoStProof, []abi.SectorID, error) {
|
||||||
mgr.lk.Lock()
|
mgr.lk.Lock()
|
||||||
defer mgr.lk.Unlock()
|
defer mgr.lk.Unlock()
|
||||||
|
|
||||||
@ -396,7 +401,7 @@ func (mgr *SectorMgr) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return generateFakePoSt(sectorInfo, abi.RegisteredSealProof.RegisteredWindowPoStProof, randomness), skipped, nil
|
return generateFakePoSt(sectorInfo, ppt, randomness), skipped, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateFakePoStProof(sectorInfo []prooftypes.SectorInfo, randomness abi.PoStRandomness) []byte {
|
func generateFakePoStProof(sectorInfo []prooftypes.SectorInfo, randomness abi.PoStRandomness) []byte {
|
||||||
@ -414,15 +419,10 @@ func generateFakePoStProof(sectorInfo []prooftypes.SectorInfo, randomness abi.Po
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateFakePoSt(sectorInfo []prooftypes.SectorInfo, rpt func(abi.RegisteredSealProof) (abi.RegisteredPoStProof, error), randomness abi.PoStRandomness) []prooftypes.PoStProof {
|
func generateFakePoSt(sectorInfo []prooftypes.SectorInfo, ppt abi.RegisteredPoStProof, randomness abi.PoStRandomness) []prooftypes.PoStProof {
|
||||||
wp, err := rpt(sectorInfo[0].SealProof)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return []prooftypes.PoStProof{
|
return []prooftypes.PoStProof{
|
||||||
{
|
{
|
||||||
PoStProof: wp,
|
PoStProof: ppt,
|
||||||
ProofBytes: generateFakePoStProof(sectorInfo, randomness),
|
ProofBytes: generateFakePoStProof(sectorInfo, randomness),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ var NoSectorRef = SectorRef{}
|
|||||||
|
|
||||||
type ProverPoSt interface {
|
type ProverPoSt interface {
|
||||||
GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, error)
|
GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, error)
|
||||||
GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) (proof []proof.PoStProof, skipped []abi.SectorID, err error)
|
GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, ppt abi.RegisteredPoStProof, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) (proof []proof.PoStProof, skipped []abi.SectorID, err error)
|
||||||
|
|
||||||
GenerateWinningPoStWithVanilla(ctx context.Context, proofType abi.RegisteredPoStProof, minerID abi.ActorID, randomness abi.PoStRandomness, proofs [][]byte) ([]proof.PoStProof, error)
|
GenerateWinningPoStWithVanilla(ctx context.Context, proofType abi.RegisteredPoStProof, minerID abi.ActorID, randomness abi.PoStRandomness, proofs [][]byte) ([]proof.PoStProof, error)
|
||||||
GenerateWindowPoStWithVanilla(ctx context.Context, proofType abi.RegisteredPoStProof, minerID abi.ActorID, randomness abi.PoStRandomness, proofs [][]byte, partitionIdx int) (proof.PoStProof, error)
|
GenerateWindowPoStWithVanilla(ctx context.Context, proofType abi.RegisteredPoStProof, minerID abi.ActorID, randomness abi.PoStRandomness, proofs [][]byte, partitionIdx int) (proof.PoStProof, error)
|
||||||
|
@ -33,7 +33,7 @@ func (t *testExec) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID,
|
|||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *testExec) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) (miner []proof.PoStProof, skipped []abi.SectorID, err error) {
|
func (t *testExec) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, ppt abi.RegisteredPoStProof, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) (miner []proof.PoStProof, skipped []abi.SectorID, err error) {
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,12 +189,12 @@ func (s *WindowPoStScheduler) runSubmitPoST(
|
|||||||
func (s *WindowPoStScheduler) checkSectors(ctx context.Context, check bitfield.BitField, tsk types.TipSetKey) (bitfield.BitField, error) {
|
func (s *WindowPoStScheduler) checkSectors(ctx context.Context, check bitfield.BitField, tsk types.TipSetKey) (bitfield.BitField, error) {
|
||||||
mid, err := address.IDFromAddress(s.actor)
|
mid, err := address.IDFromAddress(s.actor)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return bitfield.BitField{}, err
|
return bitfield.BitField{}, xerrors.Errorf("failed to convert to ID addr: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sectorInfos, err := s.api.StateMinerSectors(ctx, s.actor, &check, tsk)
|
sectorInfos, err := s.api.StateMinerSectors(ctx, s.actor, &check, tsk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return bitfield.BitField{}, err
|
return bitfield.BitField{}, xerrors.Errorf("failed to get sector infos: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
type checkSector struct {
|
type checkSector struct {
|
||||||
@ -218,7 +218,20 @@ func (s *WindowPoStScheduler) checkSectors(ctx context.Context, check bitfield.B
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
bad, err := s.faultTracker.CheckProvable(ctx, s.proofType, tocheck, func(ctx context.Context, id abi.SectorID) (cid.Cid, bool, error) {
|
nv, err := s.api.StateNetworkVersion(ctx, types.EmptyTSK)
|
||||||
|
if err != nil {
|
||||||
|
return bitfield.BitField{}, xerrors.Errorf("failed to get network version: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
pp := s.proofType
|
||||||
|
if nv >= network.Version19 {
|
||||||
|
pp, err = pp.ToV1_1PostProof()
|
||||||
|
if err != nil {
|
||||||
|
return bitfield.BitField{}, xerrors.Errorf("failed to convert to v1_1 post proof: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bad, err := s.faultTracker.CheckProvable(ctx, pp, tocheck, func(ctx context.Context, id abi.SectorID) (cid.Cid, bool, error) {
|
||||||
s, ok := sectors[id.Number]
|
s, ok := sectors[id.Number]
|
||||||
if !ok {
|
if !ok {
|
||||||
return cid.Undef, false, xerrors.Errorf("sealed CID not found")
|
return cid.Undef, false, xerrors.Errorf("sealed CID not found")
|
||||||
@ -407,7 +420,12 @@ func (s *WindowPoStScheduler) runPoStCycle(ctx context.Context, manual bool, di
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
postOut, ps, err := s.prover.GenerateWindowPoSt(ctx, abi.ActorID(mid), xsinfos, append(abi.PoStRandomness{}, rand...))
|
ppt, err := xsinfos[0].SealProof.RegisteredWindowPoStProofByNetworkVersion(nv)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("failed to get window post type: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
postOut, ps, err := s.prover.GenerateWindowPoSt(ctx, abi.ActorID(mid), ppt, xsinfos, append(abi.PoStRandomness{}, rand...))
|
||||||
elapsed := time.Since(tsStart)
|
elapsed := time.Since(tsStart)
|
||||||
log.Infow("computing window post", "batch", batchIdx, "elapsed", elapsed, "skip", len(ps), "err", err)
|
log.Infow("computing window post", "batch", batchIdx, "elapsed", elapsed, "skip", len(ps), "err", err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -125,10 +125,10 @@ func (m *mockProver) GenerateWinningPoSt(context.Context, abi.ActorID, []proofty
|
|||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockProver) GenerateWindowPoSt(ctx context.Context, aid abi.ActorID, sis []prooftypes.ExtendedSectorInfo, pr abi.PoStRandomness) ([]prooftypes.PoStProof, []abi.SectorID, error) {
|
func (m *mockProver) GenerateWindowPoSt(ctx context.Context, aid abi.ActorID, ppt abi.RegisteredPoStProof, sis []prooftypes.ExtendedSectorInfo, pr abi.PoStRandomness) ([]prooftypes.PoStProof, []abi.SectorID, error) {
|
||||||
return []prooftypes.PoStProof{
|
return []prooftypes.PoStProof{
|
||||||
{
|
{
|
||||||
PoStProof: abi.RegisteredPoStProof_StackedDrgWindow2KiBV1,
|
PoStProof: ppt,
|
||||||
ProofBytes: []byte("post-proof"),
|
ProofBytes: []byte("post-proof"),
|
||||||
},
|
},
|
||||||
}, nil, nil
|
}, nil, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user