From f43ce746041e2a50346288c42d91a37d4f24e7cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 21 Apr 2020 16:32:17 +0200 Subject: [PATCH] Update specs-actors --- chain/gen/genesis/miners.go | 19 ++++++++++------- chain/gen/genesis/t04_power.go | 1 - chain/stmgr/utils.go | 37 +++++++++------------------------- go.mod | 2 +- go.sum | 2 ++ 5 files changed, 25 insertions(+), 36 deletions(-) diff --git a/chain/gen/genesis/miners.go b/chain/gen/genesis/miners.go index 5c1b6618e..ad16e0958 100644 --- a/chain/gen/genesis/miners.go +++ b/chain/gen/genesis/miners.go @@ -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 diff --git a/chain/gen/genesis/t04_power.go b/chain/gen/genesis/t04_power.go index 2450003e8..136026977 100644 --- a/chain/gen/genesis/t04_power.go +++ b/chain/gen/genesis/t04_power.go @@ -29,7 +29,6 @@ func SetupStoragePowerActor(bs bstore.Blockstore) (*types.Actor, error) { MinerCount: 0, CronEventQueue: emptyhamt, LastEpochTick: 0, - PoStDetectedFaultMiners: emptyhamt, Claims: emptyhamt, NumMinersMeetingMinPower: 0, } diff --git a/chain/stmgr/utils.go b/chain/stmgr/utils.go index 5381f9c47..04c0fe713 100644 --- a/chain/stmgr/utils.go +++ b/chain/stmgr/utils.go @@ -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) { diff --git a/go.mod b/go.mod index 1a49ed277..8c09b989e 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index bec3c1f63..4b89051ea 100644 --- a/go.sum +++ b/go.sum @@ -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=