wip gengen fixing

This commit is contained in:
Łukasz Magiera 2020-02-11 04:31:28 +01:00
parent 4d5c4d89ce
commit 3343e82307
2 changed files with 20 additions and 17 deletions

View File

@ -6,7 +6,11 @@ import (
"fmt" "fmt"
amt "github.com/filecoin-project/go-amt-ipld/v2" amt "github.com/filecoin-project/go-amt-ipld/v2"
"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" "github.com/filecoin-project/specs-actors/actors/builtin/market"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/specs-actors/actors/builtin/power"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
hamt "github.com/ipfs/go-hamt-ipld" hamt "github.com/ipfs/go-hamt-ipld"
@ -176,16 +180,14 @@ func SetupStoragePowerActor(bs bstore.Blockstore) (*types.Actor, error) {
return nil, err return nil, err
} }
blks := cbor.NewCborStore(bs) sms := &power.State{
emptyamt, err := amt.FromArray(ctx, blks, nil) TotalNetworkPower: big.Zero(),
if err != nil { MinerCount: 0,
return nil, xerrors.Errorf("amt build failed: %w", err) EscrowTable: emptyhamt,
} CronEventQueue: emptyhamt,
PoStDetectedFaultMiners: emptyhamt,
sms := &actors.StoragePowerState{ Claims: emptyhamt,
Miners: emptyhamt, NumMinersMeetingMinPower: 0,
ProvingBuckets: emptyamt,
TotalStorage: types.NewInt(0),
} }
stcid, err := cst.Put(ctx, sms) stcid, err := cst.Put(ctx, sms)
@ -310,18 +312,18 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
return cid.Undef, nil, xerrors.Errorf("no preseal for miner %s", maddr) return cid.Undef, nil, xerrors.Errorf("no preseal for miner %s", maddr)
} }
minerParams := &actors.CreateStorageMinerParams{ minerParams := &miner.ConstructorParams{
Owner: ps.Owner, OwnerAddr: ps.Owner,
Worker: ps.Worker, WorkerAddr: ps.Worker,
SectorSize: ps.SectorSize, SectorSize: ps.SectorSize,
PeerID: gmcfg.PeerIDs[i], // TODO: grab from preseal too PeerId: gmcfg.PeerIDs[i], // TODO: grab from preseal too
} }
params := mustEnc(minerParams) params := mustEnc(minerParams)
// TODO: hardcoding 6500 here is a little fragile, it changes any // TODO: hardcoding 6500 here is a little fragile, it changes any
// time anyone changes the initial account allocations // time anyone changes the initial account allocations
rval, err := doExecValue(ctx, vm, actors.StoragePowerAddress, ps.Worker, types.FromFil(6500), actors.SPAMethods.CreateStorageMiner, params) rval, err := doExecValue(ctx, vm, actors.StoragePowerAddress, ps.Worker, types.FromFil(6500), actors.SPAMethods.CreateMiner, params)
if err != nil { if err != nil {
return cid.Undef, nil, xerrors.Errorf("failed to create genesis miner: %w", err) return cid.Undef, nil, xerrors.Errorf("failed to create genesis miner: %w", err)
} }
@ -540,7 +542,7 @@ func doExec(ctx context.Context, vm *vm.VM, to, from address.Address, method uin
return doExecValue(ctx, vm, to, from, types.NewInt(0), method, params) return doExecValue(ctx, vm, to, from, types.NewInt(0), method, params)
} }
func doExecValue(ctx context.Context, vm *vm.VM, to, from address.Address, value types.BigInt, method uint64, params []byte) ([]byte, error) { func doExecValue(ctx context.Context, vm *vm.VM, to, from address.Address, value types.BigInt, method abi.MethodNum, params []byte) ([]byte, error) {
act, err := vm.StateTree().GetActor(from) act, err := vm.StateTree().GetActor(from)
if err != nil { if err != nil {
return nil, xerrors.Errorf("doExec failed to get from actor: %w", err) return nil, xerrors.Errorf("doExec failed to get from actor: %w", err)

View File

@ -5,6 +5,7 @@ import (
"github.com/filecoin-project/go-sectorbuilder/fs" "github.com/filecoin-project/go-sectorbuilder/fs"
"github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
@ -95,7 +96,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
} }
} }
params := &actors.SectorPreCommitInfo{ params := &miner.PreCommitSectorParams{
SectorNumber: sector.SectorID, SectorNumber: sector.SectorID,
CommR: sector.CommR, CommR: sector.CommR,