diff --git a/venus-sector-manager/cmd/venus-sector-manager/internal/util_miner.go b/venus-sector-manager/cmd/venus-sector-manager/internal/util_miner.go index f1086bd9e..23f880bad 100644 --- a/venus-sector-manager/cmd/venus-sector-manager/internal/util_miner.go +++ b/venus-sector-manager/cmd/venus-sector-manager/internal/util_miner.go @@ -163,11 +163,6 @@ var utilMinerCreateCmd = &cli.Command{ return fmt.Errorf("invalid sector size %d: %w", ssize, err) } - postProof, err := sealProof.RegisteredWindowPoStProof() - if err != nil { - return fmt.Errorf("invalid seal proof type %d: %w", sealProof, err) - } - ts, err := api.Chain.ChainHead(gctx) if err != nil { return fmt.Errorf("get chain head: %w", err) @@ -239,6 +234,15 @@ var utilMinerCreateCmd = &cli.Command{ multiaddrs = append(multiaddrs, maddrNop2p.Bytes()) } + nv, err := api.Chain.StateNetworkVersion(gctx, tsk) + if err != nil { + return fmt.Errorf("get network version: %w", err) + } + postProof, err := sealProof.RegisteredWindowPoStProofByNetworkVersion(nv) + if err != nil { + return fmt.Errorf("invalid seal proof type %d: %w", sealProof, err) + } + params, err := actors.SerializeParams(&core.CreateMinerParams{ Owner: owner, Worker: worker, diff --git a/venus-sector-manager/cmd/venus-sector-manager/internal/util_sealer_proving.go b/venus-sector-manager/cmd/venus-sector-manager/internal/util_sealer_proving.go index fea627954..3a35b5327 100644 --- a/venus-sector-manager/cmd/venus-sector-manager/internal/util_sealer_proving.go +++ b/venus-sector-manager/cmd/venus-sector-manager/internal/util_sealer_proving.go @@ -588,6 +588,12 @@ var utilSealerProvingCheckProvableCmd = &cli.Command{ slow := cctx.Bool("slow") stateCheck := cctx.Bool("state-check") + + nv, err := api.Chain.StateNetworkVersion(ctx, types.EmptyTSK) + if err != nil { + return fmt.Errorf("failed to load network version: %w", err) + } + for parIdx, par := range partitions { sectors := make(map[abi.SectorNumber]struct{}) @@ -612,7 +618,16 @@ var utilSealerProvingCheckProvableCmd = &cli.Command{ tocheck = append(tocheck, util.SectorOnChainInfoToExtended(info)) } - bad, err := api.Sealer.CheckProvable(ctx, abi.ActorID(mid), tocheck, slow, stateCheck) + if len(tocheck) == 0 { + continue + } + + postProofType, err := tocheck[0].SealProof.RegisteredWindowPoStProofByNetworkVersion(nv) + if err != nil { + return fmt.Errorf("invalid seal proof type %d: %w", tocheck[0].SealProof, err) + } + + bad, err := api.Sealer.CheckProvable(ctx, abi.ActorID(mid), postProofType, tocheck, slow, stateCheck) if err != nil { return err } @@ -724,7 +739,20 @@ var utilSealerProvingSimulateWdPoStCmd = &cli.Command{ rand = append(rand, 0) } - err = api.Sealer.SimulateWdPoSt(ctx, maddr, proofSectors, rand) + if len(proofSectors) == 0 { + return fmt.Errorf("no lived sector in that partition") + } + + nv, err := api.Chain.StateNetworkVersion(ctx, ts.Key()) + if err != nil { + return fmt.Errorf("getting network version: %w", err) + } + ppt, err := proofSectors[0].SealProof.RegisteredWindowPoStProofByNetworkVersion(nv) + if err != nil { + return fmt.Errorf("convert to winning post proof: %w", err) + } + + err = api.Sealer.SimulateWdPoSt(ctx, maddr, ppt, proofSectors, rand) if err != nil { return err } diff --git a/venus-sector-manager/core/api.go b/venus-sector-manager/core/api.go index bb432754e..ade08a333 100644 --- a/venus-sector-manager/core/api.go +++ b/venus-sector-manager/core/api.go @@ -79,9 +79,9 @@ type SealerCliAPI interface { RestoreSector(ctx context.Context, sid abi.SectorID, forced bool) (Meta, error) - CheckProvable(ctx context.Context, mid abi.ActorID, sectors []builtin.ExtendedSectorInfo, strict, stateCheck bool) (map[abi.SectorNumber]string, error) + CheckProvable(ctx context.Context, mid abi.ActorID, postProofType abi.RegisteredPoStProof, sectors []builtin.ExtendedSectorInfo, strict, stateCheck bool) (map[abi.SectorNumber]string, error) - SimulateWdPoSt(context.Context, address.Address, []builtin.ExtendedSectorInfo, abi.PoStRandomness) error + SimulateWdPoSt(context.Context, address.Address, abi.RegisteredPoStProof, []builtin.ExtendedSectorInfo, abi.PoStRandomness) error SnapUpPreFetch(ctx context.Context, mid abi.ActorID, dlindex *uint64) (*SnapUpFetchResult, error) diff --git a/venus-sector-manager/core/client.go b/venus-sector-manager/core/client.go index bcfe3625c..a3f8ca8cb 100644 --- a/venus-sector-manager/core/client.go +++ b/venus-sector-manager/core/client.go @@ -35,11 +35,11 @@ var UnavailableSealerCliClient = SealerCliClient{ ReportAborted: func(context.Context, abi.SectorID, string) (Meta, error) { panic("sealer client unavailable") }, - CheckProvable: func(ctx context.Context, mid abi.ActorID, sectors []builtin.ExtendedSectorInfo, strict, stateCheck bool) (map[abi.SectorNumber]string, error) { + CheckProvable: func(ctx context.Context, mid abi.ActorID, postProofType abi.RegisteredPoStProof, sectors []builtin.ExtendedSectorInfo, strict, stateCheck bool) (map[abi.SectorNumber]string, error) { panic("sealer client unavailable") }, - SimulateWdPoSt: func(context.Context, address.Address, []builtin.ExtendedSectorInfo, abi.PoStRandomness) error { + SimulateWdPoSt: func(context.Context, address.Address, abi.RegisteredPoStProof, []builtin.ExtendedSectorInfo, abi.PoStRandomness) error { panic("sealer client unavailable") }, @@ -128,9 +128,9 @@ type SealerCliClient struct { ReportAborted func(context.Context, abi.SectorID, string) (Meta, error) - CheckProvable func(ctx context.Context, mid abi.ActorID, sectors []builtin.ExtendedSectorInfo, strict, stateCheck bool) (map[abi.SectorNumber]string, error) + CheckProvable func(ctx context.Context, mid abi.ActorID, postProofType abi.RegisteredPoStProof, sectors []builtin.ExtendedSectorInfo, strict, stateCheck bool) (map[abi.SectorNumber]string, error) - SimulateWdPoSt func(context.Context, address.Address, []builtin.ExtendedSectorInfo, abi.PoStRandomness) error + SimulateWdPoSt func(context.Context, address.Address, abi.RegisteredPoStProof, []builtin.ExtendedSectorInfo, abi.PoStRandomness) error SnapUpPreFetch func(ctx context.Context, mid abi.ActorID, dlindex *uint64) (*SnapUpFetchResult, error) diff --git a/venus-sector-manager/core/ifaces.go b/venus-sector-manager/core/ifaces.go index ec8df1421..857d7c688 100644 --- a/venus-sector-manager/core/ifaces.go +++ b/venus-sector-manager/core/ifaces.go @@ -61,9 +61,9 @@ type SectorIndexer interface { type SectorTracker interface { SinglePubToPrivateInfo(ctx context.Context, mid abi.ActorID, sectorInfo builtin.ExtendedSectorInfo, locator SectorLocator) (PrivateSectorInfo, error) SinglePrivateInfo(ctx context.Context, sref SectorRef, upgrade bool, locator SectorLocator) (PrivateSectorInfo, error) - SingleProvable(ctx context.Context, sref SectorRef, upgrade bool, locator SectorLocator, strict, stateCheck bool) error - Provable(ctx context.Context, mid abi.ActorID, sectors []builtin.ExtendedSectorInfo, strict, stateCheck bool) (map[abi.SectorNumber]string, error) - PubToPrivate(ctx context.Context, mid abi.ActorID, sectorInfo []builtin.ExtendedSectorInfo, typer SectorPoStTyper) ([]FFIPrivateSectorInfo, error) + SingleProvable(ctx context.Context, postProofType abi.RegisteredPoStProof, sref SectorRef, upgrade bool, locator SectorLocator, strict, stateCheck bool) error + Provable(ctx context.Context, mid abi.ActorID, postProofType abi.RegisteredPoStProof, sectors []builtin.ExtendedSectorInfo, strict, stateCheck bool) (map[abi.SectorNumber]string, error) + PubToPrivate(ctx context.Context, mid abi.ActorID, postProofType abi.RegisteredPoStProof, sectorInfo []builtin.ExtendedSectorInfo) ([]FFIPrivateSectorInfo, error) } type SnapUpSectorManager interface { diff --git a/venus-sector-manager/core/types_sector_state.go b/venus-sector-manager/core/types_sector_state.go index 15875570f..8cd6bfaf3 100644 --- a/venus-sector-manager/core/types_sector_state.go +++ b/venus-sector-manager/core/types_sector_state.go @@ -13,16 +13,6 @@ type SectorStateChangeHook func(st *SectorState) (bool, error) // returns the persist instance name, existence type SectorLocator func(ctx context.Context, sid abi.SectorID) (SectorAccessStores, bool, error) -type SectorPoStTyper func(proofType abi.RegisteredSealProof) (abi.RegisteredPoStProof, error) - -func SectorWindowPoSt(proofType abi.RegisteredSealProof) (abi.RegisteredPoStProof, error) { - return proofType.RegisteredWindowPoStProof() -} - -func SectorWinningPoSt(proofType abi.RegisteredSealProof) (abi.RegisteredPoStProof, error) { - return proofType.RegisteredWinningPoStProof() -} - type SectorFinalized bool type SectorUpgraded bool type SectorRemoved bool diff --git a/venus-sector-manager/extern/filecoin-ffi b/venus-sector-manager/extern/filecoin-ffi index 1bc8bf8b4..cec06a79d 160000 --- a/venus-sector-manager/extern/filecoin-ffi +++ b/venus-sector-manager/extern/filecoin-ffi @@ -1 +1 @@ -Subproject commit 1bc8bf8b482b2ef34cbce17bfc3a7ec68c047461 +Subproject commit cec06a79dc858f221f6542cff264b92b4f99c25d diff --git a/venus-sector-manager/go.mod b/venus-sector-manager/go.mod index c0182b6fd..96e1e3abf 100644 --- a/venus-sector-manager/go.mod +++ b/venus-sector-manager/go.mod @@ -17,7 +17,7 @@ require ( github.com/filecoin-project/go-fil-commcid v0.1.0 github.com/filecoin-project/go-jsonrpc v0.2.1 github.com/filecoin-project/go-paramfetch v0.0.4 - github.com/filecoin-project/go-state-types v0.10.0 + github.com/filecoin-project/go-state-types v0.11.0-rc1 github.com/filecoin-project/lotus v1.20.0 github.com/filecoin-project/specs-actors/v2 v2.3.6 github.com/filecoin-project/specs-storage v0.4.1 diff --git a/venus-sector-manager/go.sum b/venus-sector-manager/go.sum index e0c5e5d12..db81b9fe6 100644 --- a/venus-sector-manager/go.sum +++ b/venus-sector-manager/go.sum @@ -251,7 +251,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/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.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/go.mod h1:5t3z6qPmIADZBtuE9EIzi0EwzcRy2nVhpo0I/c1r0OA= github.com/filecoin-project/go-amt-ipld/v2 v2.1.0/go.mod h1:nfFPoGyX0CU9SkXX8EoCcSuHN1XcbN0c6KBh7yvP5fs= @@ -303,10 +302,9 @@ github.com/filecoin-project/go-state-types v0.0.0-20201102161440-c8033295a1fc/go 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.4/go.mod h1:xCA/WfKlC2zcn3fUmDv4IrzznwS98X5XW/irUP3Lhxg= 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.10.0 h1:vsSThZIaPmOxNGG59+8D/HnlWRtlbdOjduH6ye+v8f0= -github.com/filecoin-project/go-state-types v0.10.0/go.mod h1:aLIas+W8BWAfpLWEPUOGMPBdhcVwoCG4pIQSQk26024= +github.com/filecoin-project/go-state-types v0.11.0-rc1 h1:UvifFHZ+S/jbshCjRHgAUuZ1qAEyeItsNywh2tsSpY4= +github.com/filecoin-project/go-state-types v0.11.0-rc1/go.mod h1:SyNPwTsU7I22gL2r0OAPcImvLoTVfgRwdK/Y5rR1zz8= 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-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI= @@ -486,6 +484,7 @@ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -788,6 +787,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.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.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/go.mod h1:PzqZ/ZR981eKbgdr3y2DJYeD/8bgMawdGVlJDE8kK+M= github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5/go.mod h1:gcvzoEDBjwycpXt3LBE061wT9f46szXGHAmj9uoP6fU= @@ -1279,6 +1279,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.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.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/go.mod h1:GUC8upxSBE4oG+q3kWZRw/+6yC1BqO550bjhWsJbZlw= github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= @@ -1634,6 +1635,7 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= @@ -1748,9 +1750,10 @@ golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5 golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/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-20211108221036-ceb1ce70b4fa/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-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-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1798,6 +1801,7 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1864,6 +1868,8 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1990,20 +1996,23 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210903071746-97244b99971b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211209171907-798191bca915/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -2012,6 +2021,7 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2091,6 +2101,7 @@ golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE= golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/venus-sector-manager/modules/impl/mock/sealer.go b/venus-sector-manager/modules/impl/mock/sealer.go index e51c4fa67..efb1c9cfb 100644 --- a/venus-sector-manager/modules/impl/mock/sealer.go +++ b/venus-sector-manager/modules/impl/mock/sealer.go @@ -151,11 +151,11 @@ func (s *Sealer) ReportAborted(ctx context.Context, sid abi.SectorID, reason str return core.Empty, nil } -func (s *Sealer) CheckProvable(ctx context.Context, mid abi.ActorID, sectors []builtin.ExtendedSectorInfo, strict, sateCheck bool) (map[abi.SectorNumber]string, error) { +func (s *Sealer) CheckProvable(ctx context.Context, mid abi.ActorID, postProofType abi.RegisteredPoStProof, sectors []builtin.ExtendedSectorInfo, strict, sateCheck bool) (map[abi.SectorNumber]string, error) { return nil, nil } -func (s *Sealer) SimulateWdPoSt(context.Context, address.Address, []builtin.ExtendedSectorInfo, abi.PoStRandomness) error { +func (s *Sealer) SimulateWdPoSt(context.Context, address.Address, abi.RegisteredPoStProof, []builtin.ExtendedSectorInfo, abi.PoStRandomness) error { return nil } diff --git a/venus-sector-manager/modules/impl/sectors/snapup_commit.go b/venus-sector-manager/modules/impl/sectors/snapup_commit.go index 8bda7d687..db5073bca 100644 --- a/venus-sector-manager/modules/impl/sectors/snapup_commit.go +++ b/venus-sector-manager/modules/impl/sectors/snapup_commit.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/builtin" stminer "github.com/filecoin-project/go-state-types/builtin/v9/miner" "github.com/filecoin-project/go-state-types/exitcode" + "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/venus/venus-shared/actors/builtin/miner" "github.com/filecoin-project/venus/venus-shared/actors/policy" "github.com/filecoin-project/venus/venus-shared/types" @@ -420,7 +421,13 @@ func (h *snapupCommitHandler) calcCollateral(tsk types.TipSetKey, proofType abi. if err != nil { return big.Int{}, fmt.Errorf("StateNetworkVersion: %w", err) } - + // TODO: Drop after nv19 comes and goes + if nv >= network.Version19 { + proofType, err = proofType.ToV1_1PostProof() + if err != nil { + return big.Int{}, fmt.Errorf("convert to v1_1 post proof: %w", err) + } + } sealType, err := miner.PreferredSealProofTypeFromWindowPoStType(nv, proofType) if err != nil { return big.Int{}, fmt.Errorf("get seal proof type: %w", err) diff --git a/venus-sector-manager/modules/impl/sectors/tracker.go b/venus-sector-manager/modules/impl/sectors/tracker.go index 3c4848f12..6356bd1b1 100644 --- a/venus-sector-manager/modules/impl/sectors/tracker.go +++ b/venus-sector-manager/modules/impl/sectors/tracker.go @@ -97,7 +97,7 @@ func (t *Tracker) SinglePrivateInfo(ctx context.Context, sref core.SectorRef, up return privateInfo, nil } -func (t *Tracker) SingleProvable(ctx context.Context, sref core.SectorRef, upgrade bool, locator core.SectorLocator, strict, stateCheck bool) error { +func (t *Tracker) SingleProvable(ctx context.Context, postProofType abi.RegisteredPoStProof, sref core.SectorRef, upgrade bool, locator core.SectorLocator, strict, stateCheck bool) error { ssize, err := sref.ProofType.SectorSize() if err != nil { return fmt.Errorf("get sector size: %w", err) @@ -149,11 +149,6 @@ func (t *Tracker) SingleProvable(ctx context.Context, sref core.SectorRef, upgra return nil } - proofType, err := sref.ProofType.RegisteredWindowPoStProof() - if err != nil { - return err - } - addr, err := address.NewIDAddress(uint64(sref.ID.Miner)) if err != nil { return err @@ -190,7 +185,7 @@ func (t *Tracker) SingleProvable(ctx context.Context, sref core.SectorRef, upgra SealProof: sref.ProofType, SectorNumber: sref.ID.Number, SealedCID: sinfo.SealedCID, - }, proofType) + }, postProofType) scCtx := ctx if t.singleCheckTimeout > 0 { @@ -209,7 +204,7 @@ func (t *Tracker) SingleProvable(ctx context.Context, sref core.SectorRef, upgra return nil } -func (t *Tracker) Provable(ctx context.Context, mid abi.ActorID, sectors []builtin.ExtendedSectorInfo, strict, stateCheck bool) (map[abi.SectorNumber]string, error) { +func (t *Tracker) Provable(ctx context.Context, mid abi.ActorID, postProofType abi.RegisteredPoStProof, sectors []builtin.ExtendedSectorInfo, strict, stateCheck bool) (map[abi.SectorNumber]string, error) { limit := t.parallelCheckLimit if limit <= 0 { limit = len(sectors) @@ -251,7 +246,7 @@ func (t *Tracker) Provable(ctx context.Context, mid abi.ActorID, sectors []built ID: abi.SectorID{Miner: mid, Number: sector.SectorNumber}, ProofType: sector.SealProof, } - err := t.SingleProvable(ctx, sref, sector.SectorKey != nil, nil, strict, stateCheck) + err := t.SingleProvable(ctx, postProofType, sref, sector.SectorKey != nil, nil, strict, stateCheck) if err == nil { return } @@ -273,23 +268,18 @@ func (t *Tracker) Provable(ctx context.Context, mid abi.ActorID, sectors []built return bad, nil } -func (t *Tracker) PubToPrivate(ctx context.Context, aid abi.ActorID, sectorInfo []builtin.ExtendedSectorInfo, typer core.SectorPoStTyper) ([]core.FFIPrivateSectorInfo, error) { +func (t *Tracker) PubToPrivate(ctx context.Context, aid abi.ActorID, postProofType abi.RegisteredPoStProof, sectorInfo []builtin.ExtendedSectorInfo) ([]core.FFIPrivateSectorInfo, error) { if len(sectorInfo) == 0 { return []core.FFIPrivateSectorInfo{}, nil } out := make([]core.FFIPrivateSectorInfo, 0, len(sectorInfo)) - proofType, err := typer(sectorInfo[0].SealProof) - if err != nil { - return nil, fmt.Errorf("get PoSt proof type: %w", err) - } - for _, sector := range sectorInfo { priv, err := t.SinglePubToPrivateInfo(ctx, aid, sector, nil) if err != nil { return nil, fmt.Errorf("construct private info for %d: %w", sector.SectorNumber, err) } - out = append(out, priv.ToFFI(util.SectorExtendedToNormal(sector), proofType)) + out = append(out, priv.ToFFI(util.SectorExtendedToNormal(sector), postProofType)) } return out, nil diff --git a/venus-sector-manager/modules/miner/proof_event.go b/venus-sector-manager/modules/miner/proof_event.go index 5fd9c6020..ed370f79b 100644 --- a/venus-sector-manager/modules/miner/proof_event.go +++ b/venus-sector-manager/modules/miner/proof_event.go @@ -139,7 +139,14 @@ func (pe *ProofEvent) processComputeProof(ctx context.Context, reqID vtypes.UUID } func (pe *ProofEvent) sectorsPubToPrivate(ctx context.Context, sectorInfo []builtin.ExtendedSectorInfo) (core.SortedPrivateSectorInfo, error) { - out, err := pe.tracker.PubToPrivate(ctx, pe.actor.ID, sectorInfo, core.SectorWinningPoSt) + if len(sectorInfo) == 0 { + return core.SortedPrivateSectorInfo{}, fmt.Errorf("must provide sectors for winning post") + } + ppt, err := sectorInfo[0].SealProof.RegisteredWinningPoStProof() + if err != nil { + return core.SortedPrivateSectorInfo{}, fmt.Errorf("failed to convert to winning post proof: %w", err) + } + out, err := pe.tracker.PubToPrivate(ctx, pe.actor.ID, ppt, sectorInfo) if err != nil { return core.SortedPrivateSectorInfo{}, fmt.Errorf("convert to private infos: %w", err) } diff --git a/venus-sector-manager/modules/poster/poster.go b/venus-sector-manager/modules/poster/poster.go index 1e621cc60..7bb26940f 100644 --- a/venus-sector-manager/modules/poster/poster.go +++ b/venus-sector-manager/modules/poster/poster.go @@ -367,7 +367,7 @@ func (p *PoSter) handleHeadChange(ctx context.Context, revert *types.TipSet, adv minfo, err := p.deps.minfo.Get(ctx, mid) if err != nil { - mdLog.Warnf("get miner info: %v", err) + mdLog.Errorf("get miner info: %w", err) continue } diff --git a/venus-sector-manager/modules/poster/runner.go b/venus-sector-manager/modules/poster/runner.go index a6ecf0d25..4b1ce8881 100644 --- a/venus-sector-manager/modules/poster/runner.go +++ b/venus-sector-manager/modules/poster/runner.go @@ -311,7 +311,17 @@ func (pr *postRunner) generatePoStForPartitionBatch(glog *logging.ZapLogger, ran tsStart := pr.deps.clock.Now() - privSectors, err := pr.deps.sectorTracker.PubToPrivate(pr.ctx, pr.mid, xsinfos, core.SectorWindowPoSt) + // TODO: Drop after nv19 comes and goes + nv, err := pr.deps.chain.StateNetworkVersion(pr.ctx, types.EmptyTSK) + if err != nil { + return true, fmt.Errorf("get network version: %w", err) + } + + pp, err := xsinfos[0].SealProof.RegisteredWindowPoStProofByNetworkVersion(nv) + if err != nil { + return false, fmt.Errorf("convert to v1_1 post proof: %w", err) + } + privSectors, err := pr.deps.sectorTracker.PubToPrivate(pr.ctx, pr.mid, pp, xsinfos) if err != nil { return true, fmt.Errorf("turn public sector infos into private: %w", err) } @@ -753,7 +763,21 @@ func (pr *postRunner) checkSectors(clog *logging.ZapLogger, check bitfield.BitFi tocheck = append(tocheck, util.SectorOnChainInfoToExtended(info)) } - bad, err := pr.deps.sectorTracker.Provable(pr.ctx, pr.mid, tocheck, pr.startCtx.pcfg.StrictCheck, false) + // TODO: Drop after nv19 comes and goes + nv, err := pr.deps.chain.StateNetworkVersion(pr.ctx, types.EmptyTSK) + if err != nil { + return bitfield.BitField{}, fmt.Errorf("failed to get network version: %w", err) + } + + pp := pr.proofType + if nv >= network.Version19 { + pp, err = pp.ToV1_1PostProof() + if err != nil { + return bitfield.BitField{}, fmt.Errorf("failed to convert to v1_1 post proof: %w", err) + } + } + + bad, err := pr.deps.sectorTracker.Provable(pr.ctx, pr.mid, pp, tocheck, pr.startCtx.pcfg.StrictCheck, false) if err != nil { return bitfield.BitField{}, fmt.Errorf("checking provable sectors: %w", err) } diff --git a/venus-sector-manager/modules/sealer/sealer.go b/venus-sector-manager/modules/sealer/sealer.go index ec29e0f12..13067a111 100644 --- a/venus-sector-manager/modules/sealer/sealer.go +++ b/venus-sector-manager/modules/sealer/sealer.go @@ -588,8 +588,15 @@ func (s *Sealer) checkPersistedFiles(ctx context.Context, sid abi.SectorID, proo CacheDir: instance, }, true, nil }) - - err := s.sectorTracker.SingleProvable(ctx, core.SectorRef{ID: sid, ProofType: proofType}, upgrade, locator, false, false) + nv, err := s.capi.StateNetworkVersion(ctx, types.EmptyTSK) + if err != nil { + return false, fmt.Errorf("get network version: %w", err) + } + ppt, err := proofType.RegisteredWindowPoStProofByNetworkVersion(nv) + if err != nil { + return false, fmt.Errorf("convert to v1_1 post proof: %w", err) + } + err = s.sectorTracker.SingleProvable(ctx, ppt, core.SectorRef{ID: sid, ProofType: proofType}, upgrade, locator, false, false) if err != nil { if errors.Is(err, objstore.ErrObjectNotFound) { return false, nil diff --git a/venus-sector-manager/modules/sealer/sealer_cli.go b/venus-sector-manager/modules/sealer/sealer_cli.go index 39e794c37..c1f3d6109 100644 --- a/venus-sector-manager/modules/sealer/sealer_cli.go +++ b/venus-sector-manager/modules/sealer/sealer_cli.go @@ -52,17 +52,17 @@ func (s *Sealer) RestoreSector(ctx context.Context, sid abi.SectorID, forced boo return core.Empty, nil } -func (s *Sealer) CheckProvable(ctx context.Context, mid abi.ActorID, sectors []builtin.ExtendedSectorInfo, strict, stateCheck bool) (map[abi.SectorNumber]string, error) { - return s.sectorTracker.Provable(ctx, mid, sectors, strict, stateCheck) +func (s *Sealer) CheckProvable(ctx context.Context, mid abi.ActorID, postProofType abi.RegisteredPoStProof, sectors []builtin.ExtendedSectorInfo, strict, stateCheck bool) (map[abi.SectorNumber]string, error) { + return s.sectorTracker.Provable(ctx, mid, postProofType, sectors, strict, stateCheck) } -func (s *Sealer) SimulateWdPoSt(ctx context.Context, maddr address.Address, sis []builtin.ExtendedSectorInfo, rand abi.PoStRandomness) error { +func (s *Sealer) SimulateWdPoSt(ctx context.Context, maddr address.Address, postProofType abi.RegisteredPoStProof, sis []builtin.ExtendedSectorInfo, rand abi.PoStRandomness) error { mid, err := address.IDFromAddress(maddr) if err != nil { return err } - privSectors, err := s.sectorTracker.PubToPrivate(ctx, abi.ActorID(mid), sis, core.SectorWindowPoSt) + privSectors, err := s.sectorTracker.PubToPrivate(ctx, abi.ActorID(mid), postProofType, sis) if err != nil { return fmt.Errorf("turn public sector infos into private: %w", err) } diff --git a/venus-sector-manager/pkg/chain/miner_api.go b/venus-sector-manager/pkg/chain/miner_api.go index c89958ecc..d00bec203 100644 --- a/venus-sector-manager/pkg/chain/miner_api.go +++ b/venus-sector-manager/pkg/chain/miner_api.go @@ -24,7 +24,6 @@ func NewMinerInfoAPI(capi API) *MinerInfoAPI { } type MinerInfoAPI struct { - // TODO: miner info cache chain API cacheMu sync.RWMutex cache map[abi.ActorID]*core.MinerInfo diff --git a/venus-sector-manager/pkg/extproc/stage/ext_window_post.go b/venus-sector-manager/pkg/extproc/stage/ext_window_post.go index bcbf03595..a927b8822 100644 --- a/venus-sector-manager/pkg/extproc/stage/ext_window_post.go +++ b/venus-sector-manager/pkg/extproc/stage/ext_window_post.go @@ -31,6 +31,16 @@ func ProofType2String(proofType abi.RegisteredPoStProof) string { return "StackedDrgWindow32GiBV1" case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1: return "StackedDrgWindow64GiBV1" + case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1: + return "StackedDrgWindow2KiBV1_1" + case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1_1: + return "StackedDrgWindow8MiBV1_1" + case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1_1: + return "StackedDrgWindow512MiBV1_1" + case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1_1: + return "StackedDrgWindow32GiBV1_1" + case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1_1: + return "StackedDrgWindow64GiBV1_1" default: return fmt.Sprintf("Unknown RegisteredPoStProof %d", proofType)