sectorset updates
This commit is contained in:
parent
3394645f7a
commit
9c31f61db4
@ -192,9 +192,8 @@ type Message struct {
|
||||
}
|
||||
|
||||
type ChainSectorInfo struct {
|
||||
SectorID abi.SectorNumber
|
||||
CommD []byte
|
||||
CommR []byte
|
||||
Info miner.SectorOnChainInfo
|
||||
ID abi.SectorNumber
|
||||
}
|
||||
|
||||
type ActorState struct {
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"io/ioutil"
|
||||
"sync/atomic"
|
||||
|
||||
commcid "github.com/filecoin-project/go-fil-commcid"
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||
block "github.com/ipfs/go-block-format"
|
||||
@ -532,10 +533,14 @@ func IsRoundWinner(ctx context.Context, ts *types.TipSet, round int64, miner add
|
||||
|
||||
var sinfos []ffi.PublicSectorInfo
|
||||
for _, s := range pset {
|
||||
cr, err := commcid.CIDToReplicaCommitmentV1(s.Info.Info.SealedCID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var commRa [32]byte
|
||||
copy(commRa[:], s.CommR)
|
||||
copy(commRa[:], cr)
|
||||
sinfos = append(sinfos, ffi.PublicSectorInfo{
|
||||
SectorNum: s.SectorID,
|
||||
SectorNum: s.ID,
|
||||
CommR: commRa,
|
||||
})
|
||||
}
|
||||
|
@ -151,6 +151,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
for pi, preseal := range m.Sectors {
|
||||
// TODO: Maybe check seal (Can just be snark inputs, doesn't go into the genesis file)
|
||||
|
||||
// check deals, get dealWeight
|
||||
dealWeight := big.Zero()
|
||||
{
|
||||
params := &market.VerifyDealsOnSectorProveCommitParams{
|
||||
@ -167,6 +168,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
}
|
||||
}
|
||||
|
||||
// update power claims
|
||||
pledge := big.Zero()
|
||||
{
|
||||
err = vm.MutateState(ctx, builtin.StoragePowerActorAddr, func(cst cbor.IpldStore, st *power.State) error {
|
||||
@ -189,6 +191,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
}
|
||||
}
|
||||
|
||||
// Put sectors to miner sector sets
|
||||
{
|
||||
newSectorInfo := &miner.SectorOnChainInfo{
|
||||
Info: miner.SectorPreCommitInfo{
|
||||
@ -213,6 +216,9 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
st.ProvingSet = st.Sectors
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return cid.Cid{}, xerrors.Errorf("put to sset: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
|
||||
amt "github.com/filecoin-project/go-amt-ipld/v2"
|
||||
commcid "github.com/filecoin-project/go-fil-commcid"
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
@ -149,10 +150,14 @@ func GetSectorsForElectionPost(ctx context.Context, sm *StateManager, ts *types.
|
||||
|
||||
var uselessOtherArray []ffi.PublicSectorInfo
|
||||
for _, s := range sectors {
|
||||
cr, err := commcid.CIDToReplicaCommitmentV1(s.Info.Info.SealedCID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var uselessBuffer [32]byte
|
||||
copy(uselessBuffer[:], s.CommR)
|
||||
copy(uselessBuffer[:], cr)
|
||||
uselessOtherArray = append(uselessOtherArray, ffi.PublicSectorInfo{
|
||||
SectorNum: s.SectorID,
|
||||
SectorNum: s.ID,
|
||||
CommR: uselessBuffer,
|
||||
})
|
||||
}
|
||||
@ -262,14 +267,20 @@ func LoadSectorsFromSet(ctx context.Context, bs blockstore.Blockstore, ssc cid.C
|
||||
|
||||
var sset []*api.ChainSectorInfo
|
||||
if err := a.ForEach(ctx, func(i uint64, v *cbg.Deferred) error {
|
||||
var comms [][]byte
|
||||
if err := cbor.DecodeInto(v.Raw, &comms); err != nil {
|
||||
var oci miner.SectorOnChainInfo
|
||||
if err := cbor.DecodeInto(v.Raw, &oci); err != nil {
|
||||
return err
|
||||
}
|
||||
sset = append(sset, &api.ChainSectorInfo{
|
||||
SectorID: abi.SectorNumber(i),
|
||||
CommR: comms[0],
|
||||
CommD: comms[1],
|
||||
Info: miner.SectorOnChainInfo{
|
||||
Info: miner.SectorPreCommitInfo{},
|
||||
ActivationEpoch: 0,
|
||||
DealWeight: abi.DealWeight{},
|
||||
PledgeRequirement: abi.TokenAmount{},
|
||||
DeclaredFaultEpoch: 0,
|
||||
DeclaredFaultDuration: 0,
|
||||
},
|
||||
ID: abi.SectorNumber(i),
|
||||
})
|
||||
return nil
|
||||
}); err != nil {
|
||||
|
2
go.mod
2
go.mod
@ -23,7 +23,7 @@ require (
|
||||
github.com/filecoin-project/go-paramfetch v0.0.1
|
||||
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200210220012-eb75ec747d6b
|
||||
github.com/filecoin-project/go-statestore v0.1.0
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200218211922-372fea3f131f
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200219191759-7e15e5c89659
|
||||
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
|
||||
github.com/go-ole/go-ole v1.2.4 // indirect
|
||||
github.com/gorilla/mux v1.7.3
|
||||
|
2
go.sum
2
go.sum
@ -130,6 +130,8 @@ github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf h1:f
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200218211922-372fea3f131f h1:xfjeZfwhrNlp9/71gprhfC+HL8htJukplomyGxrdkBY=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200218211922-372fea3f131f/go.mod h1:Ecx+3v6Bn4exCS0NbPu7VjrDCu2J+t1PdEpYin1/qOU=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200219191759-7e15e5c89659 h1:qHn5166bAy0dVEZr1Z4TPoveZNEEcFVz+RumCSM6QqA=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200219191759-7e15e5c89659/go.mod h1:Ecx+3v6Bn4exCS0NbPu7VjrDCu2J+t1PdEpYin1/qOU=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 h1:EzDjxMg43q1tA2c0MV3tNbaontnHLplHyFF6M5KiVP0=
|
||||
|
Loading…
Reference in New Issue
Block a user