Update specs-actors

This commit is contained in:
Łukasz Magiera 2020-04-21 16:32:17 +02:00
parent 00eb0e6378
commit f43ce74604
5 changed files with 25 additions and 36 deletions

View File

@ -71,7 +71,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
var ma power.CreateMinerReturn
if err := ma.UnmarshalCBOR(bytes.NewReader(rval)); err != nil {
return cid.Undef, err
return cid.Undef, xerrors.Errorf("unmarshaling CreateMinerReturn: %w", err)
}
expma := MinerAddress(uint64(i))
@ -111,7 +111,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
}
var ids market.PublishStorageDealsReturn
if err := ids.UnmarshalCBOR(bytes.NewReader(ret)); err != nil {
return err
return xerrors.Errorf("unmarsahling publishStorageDeals result: %w", err)
}
dealIDs = append(dealIDs, ids.IDs...)
@ -156,7 +156,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
// TODO: Maybe check seal (Can just be snark inputs, doesn't go into the genesis file)
// check deals, get dealWeight
dealWeight := big.Zero()
var dealWeight market.VerifyDealsOnSectorProveCommitReturn
{
params := &market.VerifyDealsOnSectorProveCommitParams{
DealIDs: []abi.DealID{dealIDs[pi]},
@ -169,7 +169,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
return cid.Undef, xerrors.Errorf("failed to verify preseal deals miner: %w", err)
}
if err := dealWeight.UnmarshalCBOR(bytes.NewReader(ret)); err != nil {
return cid.Undef, err
return cid.Undef, xerrors.Errorf("unmarshaling market onProveCommit result: %w", err)
}
}
@ -179,7 +179,8 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
weight := &power.SectorStorageWeightDesc{
SectorSize: m.SectorSize,
Duration: preseal.Deal.Duration(),
DealWeight: dealWeight,
DealWeight: dealWeight.DealWeight,
VerifiedDealWeight: dealWeight.VerifiedDealWeight,
}
qapower := power.QAPowerForWeight(weight)
@ -208,7 +209,8 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
Expiration: preseal.Deal.EndEpoch,
},
ActivationEpoch: 0, // TODO: REVIEW: Correct?
DealWeight: dealWeight,
DealWeight: dealWeight.DealWeight,
VerifiedDealWeight: dealWeight.VerifiedDealWeight,
}
err = vm.MutateState(ctx, maddr, func(cst cbor.IpldStore, st *miner.State) error {
@ -239,7 +241,10 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
})
c, err := vm.Flush(ctx)
return c, err
if err != nil {
return cid.Cid{}, xerrors.Errorf("flushing vm: %w", err)
}
return c, nil
}
// TODO: copied from actors test harness, deduplicate or remove from here

View File

@ -29,7 +29,6 @@ func SetupStoragePowerActor(bs bstore.Blockstore) (*types.Actor, error) {
MinerCount: 0,
CronEventQueue: emptyhamt,
LastEpochTick: 0,
PoStDetectedFaultMiners: emptyhamt,
Claims: emptyhamt,
NumMinersMeetingMinPower: 0,
}

View File

@ -205,34 +205,17 @@ func GetMinerSlashed(ctx context.Context, sm *StateManager, ts *types.TipSet, ma
store := sm.cs.Store(ctx)
{
claims, err := adt.AsMap(store, spas.Claims)
if err != nil {
return false, err
}
ok, err := claims.Get(power.AddrKey(maddr), nil)
if err != nil {
return false, err
}
if !ok {
return true, nil
}
claims, err := adt.AsMap(store, spas.Claims)
if err != nil {
return false, err
}
{
detectedFaulty, err := adt.AsMap(store, spas.PoStDetectedFaultMiners)
if err != nil {
return false, err
}
ok, err := detectedFaulty.Get(power.AddrKey(maddr), nil)
if err != nil {
return false, err
}
if ok {
return true, nil
}
ok, err := claims.Get(power.AddrKey(maddr), nil)
if err != nil {
return false, err
}
if !ok {
return true, nil
}
return false, nil
@ -245,7 +228,7 @@ func GetMinerDeadlines(ctx context.Context, sm *StateManager, ts *types.TipSet,
return nil, xerrors.Errorf("(get ssize) failed to load miner actor state: %w", err)
}
return miner.LoadDeadlines(sm.cs.Store(ctx), &mas)
return mas.LoadDeadlines(sm.cs.Store(ctx))
}
func GetMinerFaults(ctx context.Context, sm *StateManager, ts *types.TipSet, maddr address.Address) ([]abi.SectorNumber, error) {

2
go.mod
View File

@ -24,7 +24,7 @@ require (
github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663
github.com/filecoin-project/go-statestore v0.1.0
github.com/filecoin-project/sector-storage v0.0.0-20200417225459-e75536581a08
github.com/filecoin-project/specs-actors v0.0.0-20200420172552-09dec8ff055a
github.com/filecoin-project/specs-actors v0.0.0-20200421050142-ac4b5a003498
github.com/filecoin-project/specs-storage v0.0.0-20200417134612-61b2d91a6102
github.com/filecoin-project/storage-fsm v0.0.0-20200420183220-1515cffb5d13
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1

2
go.sum
View File

@ -182,6 +182,8 @@ github.com/filecoin-project/specs-actors v0.0.0-20200416213853-1bd9b52a4621 h1:c
github.com/filecoin-project/specs-actors v0.0.0-20200416213853-1bd9b52a4621/go.mod h1:qNIpwxs7WCtxbcbG4ZiS+Wf3qn36eyfqktlXJhi46X4=
github.com/filecoin-project/specs-actors v0.0.0-20200420172552-09dec8ff055a h1:xmXbRbOoiD/vYEChgiVmigvxCbegqfDZGrCEB3Wowik=
github.com/filecoin-project/specs-actors v0.0.0-20200420172552-09dec8ff055a/go.mod h1:qNIpwxs7WCtxbcbG4ZiS+Wf3qn36eyfqktlXJhi46X4=
github.com/filecoin-project/specs-actors v0.0.0-20200421050142-ac4b5a003498 h1:ENX34+le/y+G9krubK/Zjfh4CuaVGryOFjz+rDG7iOU=
github.com/filecoin-project/specs-actors v0.0.0-20200421050142-ac4b5a003498/go.mod h1:nQYnFbQ7Y0bHZyq6HDEuVlCPR+U3z5Q3wMOQ+2aiV+Y=
github.com/filecoin-project/specs-storage v0.0.0-20200410185809-9fbaaa08f275 h1:6OTcpsTQBQM0f/A67oEi4E4YtYd6fzkMqbU8cPIWMMs=
github.com/filecoin-project/specs-storage v0.0.0-20200410185809-9fbaaa08f275/go.mod h1:xJ1/xl9+8zZeSSSFmDC3Wr6uusCTxyYPI0VeNVSFmPE=
github.com/filecoin-project/specs-storage v0.0.0-20200417134612-61b2d91a6102 h1:T3f/zkuvgtgqcXrb0NO3BicuveGOxxUAMPa/Yif2kuE=