From 41daf5ad28aa90808f1e7d90115afe61470c4246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 8 Feb 2020 03:18:37 +0100 Subject: [PATCH] gofmt --- api/apistruct/struct.go | 48 ++++++++++++++--------------- chain/actors/actor_miner.go | 4 +-- chain/actors/actor_storagemarket.go | 2 -- chain/actors/cbor_gen.go | 3 -- chain/gen/gen.go | 2 +- chain/store/store.go | 2 +- chain/types/cbor_gen.go | 1 - chain/validation/message.go | 2 +- cmd/lotus-seed/seed/seed.go | 4 +-- storage/sealing/garbage.go | 6 ++-- storage/sealing/utils.go | 2 +- 11 files changed, 35 insertions(+), 41 deletions(-) diff --git a/api/apistruct/struct.go b/api/apistruct/struct.go index 6fa1376e3..9394752a0 100644 --- a/api/apistruct/struct.go +++ b/api/apistruct/struct.go @@ -50,7 +50,7 @@ type FullNodeStruct struct { ChainGetBlockMessages func(context.Context, cid.Cid) (*api.BlockMessages, error) `perm:"read"` ChainGetParentReceipts func(context.Context, cid.Cid) ([]*types.MessageReceipt, error) `perm:"read"` ChainGetParentMessages func(context.Context, cid.Cid) ([]api.Message, error) `perm:"read"` - ChainGetTipSetByHeight func(context.Context, abi.ChainEpoch, *types.TipSet) (*types.TipSet, error) `perm:"read"` + ChainGetTipSetByHeight func(context.Context, abi.ChainEpoch, *types.TipSet) (*types.TipSet, error) `perm:"read"` ChainReadObj func(context.Context, cid.Cid) ([]byte, error) `perm:"read"` ChainHasObj func(context.Context, cid.Cid) (bool, error) `perm:"read"` ChainSetHead func(context.Context, *types.TipSet) error `perm:"admin"` @@ -95,30 +95,30 @@ type FullNodeStruct struct { ClientRetrieve func(ctx context.Context, order api.RetrievalOrder, path string) error `perm:"admin"` ClientQueryAsk func(ctx context.Context, p peer.ID, miner address.Address) (*types.SignedStorageAsk, error) `perm:"read"` - StateMinerSectors func(context.Context, address.Address, *types.TipSet) ([]*api.ChainSectorInfo, error) `perm:"read"` - StateMinerProvingSet func(context.Context, address.Address, *types.TipSet) ([]*api.ChainSectorInfo, error) `perm:"read"` - StateMinerPower func(context.Context, address.Address, *types.TipSet) (api.MinerPower, error) `perm:"read"` - StateMinerWorker func(context.Context, address.Address, *types.TipSet) (address.Address, error) `perm:"read"` - StateMinerPeerID func(ctx context.Context, m address.Address, ts *types.TipSet) (peer.ID, error) `perm:"read"` - StateMinerElectionPeriodStart func(ctx context.Context, actor address.Address, ts *types.TipSet) (uint64, error) `perm:"read"` + StateMinerSectors func(context.Context, address.Address, *types.TipSet) ([]*api.ChainSectorInfo, error) `perm:"read"` + StateMinerProvingSet func(context.Context, address.Address, *types.TipSet) ([]*api.ChainSectorInfo, error) `perm:"read"` + StateMinerPower func(context.Context, address.Address, *types.TipSet) (api.MinerPower, error) `perm:"read"` + StateMinerWorker func(context.Context, address.Address, *types.TipSet) (address.Address, error) `perm:"read"` + StateMinerPeerID func(ctx context.Context, m address.Address, ts *types.TipSet) (peer.ID, error) `perm:"read"` + StateMinerElectionPeriodStart func(ctx context.Context, actor address.Address, ts *types.TipSet) (uint64, error) `perm:"read"` StateMinerSectorSize func(context.Context, address.Address, *types.TipSet) (abi.SectorSize, error) `perm:"read"` - StateMinerFaults func(context.Context, address.Address, *types.TipSet) ([]uint64, error) `perm:"read"` - StateCall func(context.Context, *types.Message, *types.TipSet) (*api.MethodCall, error) `perm:"read"` - StateReplay func(context.Context, *types.TipSet, cid.Cid) (*api.ReplayResults, error) `perm:"read"` - StateGetActor func(context.Context, address.Address, *types.TipSet) (*types.Actor, error) `perm:"read"` - StateReadState func(context.Context, *types.Actor, *types.TipSet) (*api.ActorState, error) `perm:"read"` - StatePledgeCollateral func(context.Context, *types.TipSet) (types.BigInt, error) `perm:"read"` - StateWaitMsg func(context.Context, cid.Cid) (*api.MsgWait, error) `perm:"read"` - StateListMiners func(context.Context, *types.TipSet) ([]address.Address, error) `perm:"read"` - StateListActors func(context.Context, *types.TipSet) ([]address.Address, error) `perm:"read"` - StateMarketBalance func(context.Context, address.Address, *types.TipSet) (api.MarketBalance, error) `perm:"read"` - StateMarketParticipants func(context.Context, *types.TipSet) (map[string]api.MarketBalance, error) `perm:"read"` - StateMarketDeals func(context.Context, *types.TipSet) (map[string]market.DealProposal, error) `perm:"read"` - StateMarketStorageDeal func(context.Context, abi.DealID, *types.TipSet) (*market.DealProposal, error) `perm:"read"` - StateLookupID func(ctx context.Context, addr address.Address, ts *types.TipSet) (address.Address, error) `perm:"read"` - StateChangedActors func(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error) `perm:"read"` - StateGetReceipt func(context.Context, cid.Cid, *types.TipSet) (*types.MessageReceipt, error) `perm:"read"` - StateMinerSectorCount func(context.Context, address.Address, *types.TipSet) (api.MinerSectors, error) `perm:"read"` + StateMinerFaults func(context.Context, address.Address, *types.TipSet) ([]uint64, error) `perm:"read"` + StateCall func(context.Context, *types.Message, *types.TipSet) (*api.MethodCall, error) `perm:"read"` + StateReplay func(context.Context, *types.TipSet, cid.Cid) (*api.ReplayResults, error) `perm:"read"` + StateGetActor func(context.Context, address.Address, *types.TipSet) (*types.Actor, error) `perm:"read"` + StateReadState func(context.Context, *types.Actor, *types.TipSet) (*api.ActorState, error) `perm:"read"` + StatePledgeCollateral func(context.Context, *types.TipSet) (types.BigInt, error) `perm:"read"` + StateWaitMsg func(context.Context, cid.Cid) (*api.MsgWait, error) `perm:"read"` + StateListMiners func(context.Context, *types.TipSet) ([]address.Address, error) `perm:"read"` + StateListActors func(context.Context, *types.TipSet) ([]address.Address, error) `perm:"read"` + StateMarketBalance func(context.Context, address.Address, *types.TipSet) (api.MarketBalance, error) `perm:"read"` + StateMarketParticipants func(context.Context, *types.TipSet) (map[string]api.MarketBalance, error) `perm:"read"` + StateMarketDeals func(context.Context, *types.TipSet) (map[string]market.DealProposal, error) `perm:"read"` + StateMarketStorageDeal func(context.Context, abi.DealID, *types.TipSet) (*market.DealProposal, error) `perm:"read"` + StateLookupID func(ctx context.Context, addr address.Address, ts *types.TipSet) (address.Address, error) `perm:"read"` + StateChangedActors func(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error) `perm:"read"` + StateGetReceipt func(context.Context, cid.Cid, *types.TipSet) (*types.MessageReceipt, error) `perm:"read"` + StateMinerSectorCount func(context.Context, address.Address, *types.TipSet) (api.MinerSectors, error) `perm:"read"` StateListMessages func(ctx context.Context, match *types.Message, ts *types.TipSet, toht abi.ChainEpoch) ([]cid.Cid, error) `perm:"read"` StateCompute func(context.Context, abi.ChainEpoch, []*types.Message, *types.TipSet) (cid.Cid, error) `perm:"read"` diff --git a/chain/actors/actor_miner.go b/chain/actors/actor_miner.go index a16b5d66d..77a5fe949 100644 --- a/chain/actors/actor_miner.go +++ b/chain/actors/actor_miner.go @@ -283,7 +283,7 @@ func (sma StorageMinerActor) ProveCommitSector(act *types.Actor, vmctx types.VMC return nil, aerrors.New(1, "no pre-commitment found for sector") } - if us.ReceivedEpoch+build.InteractivePoRepDelay >= uint64(vmctx.BlockHeight()){ + if us.ReceivedEpoch+build.InteractivePoRepDelay >= uint64(vmctx.BlockHeight()) { return nil, aerrors.New(2, "too early for proof submission") } @@ -973,7 +973,7 @@ func onSuccessfulPoSt2(self *StorageMinerActorState, vmctx types.VMContext, acti if !(oldPower.IsZero() && newPower.IsZero()) { enc, err := SerializeParams(&UpdateStorageParams{ Delta: delta, - NextSlashDeadline: uint64(vmctx.BlockHeight())+ build.SlashablePowerDelay, + NextSlashDeadline: uint64(vmctx.BlockHeight()) + build.SlashablePowerDelay, PreviousSlashDeadline: prevSlashingDeadline, }) if err != nil { diff --git a/chain/actors/actor_storagemarket.go b/chain/actors/actor_storagemarket.go index d02820b4e..15cc96fba 100644 --- a/chain/actors/actor_storagemarket.go +++ b/chain/actors/actor_storagemarket.go @@ -4,7 +4,6 @@ import ( "github.com/filecoin-project/specs-actors/actors/builtin/market" ) - type smaMethods struct { Constructor uint64 WithdrawBalance uint64 @@ -44,7 +43,6 @@ type ActivateStorageDealsParams = market.VerifyDealsOnSectorProveCommitParams type ComputeDataCommitmentParams = market.ComputeDataCommitmentParams - /* func (sma StorageMarketActor) HandleCronAction(act *types.Actor, vmctx types.VMContext, params *struct{}) ([]byte, ActorError) { diff --git a/chain/actors/cbor_gen.go b/chain/actors/cbor_gen.go index 9b27dffb2..98c7c99e2 100644 --- a/chain/actors/cbor_gen.go +++ b/chain/actors/cbor_gen.go @@ -501,7 +501,6 @@ func (t *StorageMinerConstructorParams) MarshalCBOR(w io.Writer) error { return nil } - func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) @@ -1763,7 +1762,6 @@ func (t *CreateStorageMinerParams) MarshalCBOR(w io.Writer) error { return nil } - func (t *PowerLookupParams) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) @@ -2056,7 +2054,6 @@ func (t *MinerSlashConsensusFault) UnmarshalCBOR(r io.Reader) error { } // t.AtHeight (uint64) (uint64) - // t.SlashedCollateral (types.BigInt) (struct) { diff --git a/chain/gen/gen.go b/chain/gen/gen.go index 53b194278..bc110ad04 100644 --- a/chain/gen/gen.go +++ b/chain/gen/gen.go @@ -348,7 +348,7 @@ func (cg *ChainGen) makeBlock(parents *types.TipSet, m address.Address, eproof * if cg.Timestamper != nil { ts = cg.Timestamper(parents, height-parents.Height()) } else { - ts = parents.MinTimestamp() + uint64((height - parents.Height()) * build.BlockDelay) + ts = parents.MinTimestamp() + uint64((height-parents.Height())*build.BlockDelay) } fblk, err := MinerCreateBlock(context.TODO(), cg.sm, cg.w, m, parents, ticket, eproof, msgs, height, ts) diff --git a/chain/store/store.go b/chain/store/store.go index 3d0375c8b..3a3bc9d48 100644 --- a/chain/store/store.go +++ b/chain/store/store.go @@ -835,7 +835,7 @@ func (cs *ChainStore) Blockstore() bstore.Blockstore { func ActorStore(ctx context.Context, bs blockstore.Blockstore) adt.Store { return &astore{ - cst: cbor.NewCborStore(bs), + cst: cbor.NewCborStore(bs), ctx: ctx, } } diff --git a/chain/types/cbor_gen.go b/chain/types/cbor_gen.go index 8024eb533..07a30ce33 100644 --- a/chain/types/cbor_gen.go +++ b/chain/types/cbor_gen.go @@ -193,7 +193,6 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { } // t.Height (uint64) (uint64) - // t.ParentMessageReceipts (cid.Cid) (struct) { diff --git a/chain/validation/message.go b/chain/validation/message.go index d0f6201ea..01030bfd0 100644 --- a/chain/validation/message.go +++ b/chain/validation/message.go @@ -10,8 +10,8 @@ import ( vaddress "github.com/filecoin-project/chain-validation/pkg/state/address" vtypes "github.com/filecoin-project/chain-validation/pkg/state/types" - "github.com/filecoin-project/specs-actors/actors/builtin" "github.com/filecoin-project/go-address" + "github.com/filecoin-project/specs-actors/actors/builtin" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/types" diff --git a/cmd/lotus-seed/seed/seed.go b/cmd/lotus-seed/seed/seed.go index 29391ea46..79221fcb7 100644 --- a/cmd/lotus-seed/seed/seed.go +++ b/cmd/lotus-seed/seed/seed.go @@ -160,8 +160,8 @@ func createDeals(m *genesis.GenesisMiner, k *wallet.Key, maddr address.Address, StartEpoch: 1, // TODO: allow setting EndEpoch: 9001, StoragePricePerEpoch: big.Zero(), - ProviderCollateral: big.Zero(), - ClientCollateral: big.Zero(), + ProviderCollateral: big.Zero(), + ClientCollateral: big.Zero(), } sector.Deal = *proposal diff --git a/storage/sealing/garbage.go b/storage/sealing/garbage.go index 52f2eb9cb..b55f0c56a 100644 --- a/storage/sealing/garbage.go +++ b/storage/sealing/garbage.go @@ -52,14 +52,14 @@ func (m *Sealing) pledgeSector(ctx context.Context, sectorID abi.SectorNumber, e PieceSize: size.Padded(), Client: m.worker, Provider: m.maddr, - StartEpoch: math.MaxInt64, + StartEpoch: math.MaxInt64, EndEpoch: math.MaxInt64, StoragePricePerEpoch: types.NewInt(0), - ProviderCollateral: types.NewInt(0), + ProviderCollateral: types.NewInt(0), } deals[i] = market.ClientDealProposal{ - Proposal: sdp, + Proposal: sdp, } } diff --git a/storage/sealing/utils.go b/storage/sealing/utils.go index d03393405..967e2c9a2 100644 --- a/storage/sealing/utils.go +++ b/storage/sealing/utils.go @@ -71,7 +71,7 @@ func (m *Sealing) fastPledgeCommitment(size abi.UnpaddedPieceSize, parts uint64) err = multierror.Append(err, perr) } out[i] = sectorbuilder.PublicPieceInfo{ - Size: uint64(piece), + Size: uint64(piece), CommP: commP, } lk.Unlock()