diff --git a/.github/workflows/baisc_checks.yml b/.github/workflows/baisc_checks.yml index 8acd6e80af..3895adfbba 100644 --- a/.github/workflows/baisc_checks.yml +++ b/.github/workflows/baisc_checks.yml @@ -18,7 +18,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.18 - name: install deps run: | @@ -34,7 +34,7 @@ jobs: - name: Lint run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.44.2 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.0 golangci-lint run --timeout 10m - name: Compatible all diff --git a/.github/workflows/common_build_upload.yml b/.github/workflows/common_build_upload.yml index d588ba5b37..b02c8ee487 100644 --- a/.github/workflows/common_build_upload.yml +++ b/.github/workflows/common_build_upload.yml @@ -111,7 +111,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.18 - name: install deps if: ${{ !inputs.has_ffi }} diff --git a/.github/workflows/common_go.yml b/.github/workflows/common_go.yml index 2cf09c97cb..ada3deb650 100644 --- a/.github/workflows/common_go.yml +++ b/.github/workflows/common_go.yml @@ -22,7 +22,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.18 - name: vars id: vars @@ -47,7 +47,7 @@ jobs: - name: Lint run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.44.2 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.0 golangci-lint run --timeout 10m - name: Detect changes diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8490bb107a..794975815d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.18 - name: install deps run: | diff --git a/app/node/builder_getter.go b/app/node/builder_getter.go index 13088104e1..9d11acbb07 100644 --- a/app/node/builder_getter.go +++ b/app/node/builder_getter.go @@ -30,7 +30,7 @@ func (b builder) GenesisRoot() cid.Cid { return b.genBlk.ParentStateRoot } -//todo remove block time +// todo remove block time // BlockTime get chain block time func (b builder) BlockTime() time.Duration { return b.blockTime diff --git a/app/submodule/chain/account_api.go b/app/submodule/chain/account_api.go index a29cdeae5b..0b9f1408d7 100644 --- a/app/submodule/chain/account_api.go +++ b/app/submodule/chain/account_api.go @@ -16,7 +16,7 @@ type accountAPI struct { chain *ChainSubmodule } -//NewAccountAPI create a new account api +// NewAccountAPI create a new account api func NewAccountAPI(chain *ChainSubmodule) v1api.IAccount { return &accountAPI{chain: chain} } diff --git a/app/submodule/chain/actor_api.go b/app/submodule/chain/actor_api.go index 31766de332..6aa7b68a72 100644 --- a/app/submodule/chain/actor_api.go +++ b/app/submodule/chain/actor_api.go @@ -14,7 +14,7 @@ type actorAPI struct { chain *ChainSubmodule } -//NewActorAPI new actor api +// NewActorAPI new actor api func NewActorAPI(chain *ChainSubmodule) v1api.IActor { return &actorAPI{chain: chain} } diff --git a/app/submodule/chain/chain_submodule.go b/app/submodule/chain/chain_submodule.go index 7c39ceded5..10f4ad2b24 100644 --- a/app/submodule/chain/chain_submodule.go +++ b/app/submodule/chain/chain_submodule.go @@ -101,12 +101,12 @@ func (chain *ChainSubmodule) Start(ctx context.Context) error { return chain.Fork.Start(ctx) } -//Stop stop the chain head event +// Stop stop the chain head event func (chain *ChainSubmodule) Stop(ctx context.Context) { chain.ChainReader.Stop() } -//API chain module api implement +// API chain module api implement func (chain *ChainSubmodule) API() v1api.IChain { return &chainAPI{ IAccount: NewAccountAPI(chain), diff --git a/app/submodule/config/config.go b/app/submodule/config/config.go index d789ff9be3..7841d0dd63 100644 --- a/app/submodule/config/config.go +++ b/app/submodule/config/config.go @@ -41,7 +41,7 @@ func (s *ConfigModule) Get(dottedKey string) (interface{}, error) { return s.repo.Config().Get(dottedKey) } -//API create a new config api implement +// API create a new config api implement func (s *ConfigModule) API() IConfig { return &configAPI{config: s} } diff --git a/app/submodule/mining/mining_api.go b/app/submodule/mining/mining_api.go index 9969559caf..90acf8e787 100644 --- a/app/submodule/mining/mining_api.go +++ b/app/submodule/mining/mining_api.go @@ -32,7 +32,7 @@ type MiningAPI struct { //nolint Ming *MiningModule } -//MinerGetBaseInfo get current miner information +// MinerGetBaseInfo get current miner information func (miningAPI *MiningAPI) MinerGetBaseInfo(ctx context.Context, maddr address.Address, round abi.ChainEpoch, tsk types.TipSetKey) (*types.MiningBaseInfo, error) { chainStore := miningAPI.Ming.ChainModule.ChainReader ts, err := chainStore.GetTipSet(ctx, tsk) @@ -146,7 +146,7 @@ func (miningAPI *MiningAPI) MinerGetBaseInfo(ctx context.Context, maddr address. }, nil } -//MinerCreateBlock create block base on template +// MinerCreateBlock create block base on template func (miningAPI *MiningAPI) MinerCreateBlock(ctx context.Context, bt *types.BlockTemplate) (*types.BlockMsg, error) { fblk, err := miningAPI.minerCreateBlock(ctx, bt) if err != nil { diff --git a/app/submodule/mining/mining_submodule.go b/app/submodule/mining/mining_submodule.go index 5a9901a45e..6a9b3e035f 100644 --- a/app/submodule/mining/mining_submodule.go +++ b/app/submodule/mining/mining_submodule.go @@ -30,7 +30,7 @@ type MiningModule struct { //nolint Stmgr *statemanger.Stmgr } -//API create new miningAPi implement +// API create new miningAPi implement func (miningModule *MiningModule) API() v1api.IMining { return &MiningAPI{Ming: miningModule} } @@ -39,7 +39,7 @@ func (miningModule *MiningModule) V0API() v0api.IMining { return &MiningAPI{Ming: miningModule} } -//NewMiningModule create new mining module +// NewMiningModule create new mining module func NewMiningModule( stmgr *statemanger.Stmgr, conf miningConfig, diff --git a/app/submodule/multisig/multisig_submodule.go b/app/submodule/multisig/multisig_submodule.go index 3487a0b982..398fed72c3 100644 --- a/app/submodule/multisig/multisig_submodule.go +++ b/app/submodule/multisig/multisig_submodule.go @@ -18,7 +18,7 @@ func NewMultiSigSubmodule(chainState v1api.IChain, msgPool v1api.IMessagePool, s return &MultiSigSubmodule{state: chainState, mpool: msgPool, store: store} } -//API create a new multisig implement +// API create a new multisig implement func (sb *MultiSigSubmodule) API() v1api.IMultiSig { return newMultiSig(sb) } diff --git a/app/submodule/paych/paych_submodule.go b/app/submodule/paych/paych_submodule.go index a061c8a151..67b937588f 100644 --- a/app/submodule/paych/paych_submodule.go +++ b/app/submodule/paych/paych_submodule.go @@ -11,7 +11,7 @@ import ( v1api "github.com/filecoin-project/venus/venus-shared/api/chain/v1" ) -//PaychSubmodule support paych related functions, including paych construction, extraction, query and other functions +// PaychSubmodule support paych related functions, including paych construction, extraction, query and other functions type PaychSubmodule struct { //nolint pmgr *paychmgr.Manager } @@ -30,7 +30,7 @@ func (ps *PaychSubmodule) Stop() { ps.pmgr.Stop() } -//API create a new paych implement +// API create a new paych implement func (ps *PaychSubmodule) API() v1api.IPaychan { return NewPaychAPI(ps.pmgr) } diff --git a/app/submodule/storagenetworking/storage_networking_submodule.go b/app/submodule/storagenetworking/storage_networking_submodule.go index e83817e94f..bcb9db2d15 100644 --- a/app/submodule/storagenetworking/storage_networking_submodule.go +++ b/app/submodule/storagenetworking/storage_networking_submodule.go @@ -21,7 +21,7 @@ func NewStorgeNetworkingSubmodule(ctx context.Context, network *network.NetworkS }, nil } -//API create a new storage implement +// API create a new storage implement func (storageNetworking *StorageNetworkingSubmodule) API() IStorageNetworking { return &storageNetworkingAPI{storageNetworking: storageNetworking} } diff --git a/app/submodule/syncer/syncer_submodule.go b/app/submodule/syncer/syncer_submodule.go index 7c6a27fdea..23af00b799 100644 --- a/app/submodule/syncer/syncer_submodule.go +++ b/app/submodule/syncer/syncer_submodule.go @@ -287,7 +287,7 @@ func (syncer *SyncerSubmodule) Stop(ctx context.Context) { } } -//API create a new sync api implement +// API create a new sync api implement func (syncer *SyncerSubmodule) API() v1api.ISyncer { return &syncerAPI{syncer: syncer} } diff --git a/app/submodule/wallet/wallet_submodule.go b/app/submodule/wallet/wallet_submodule.go index dad6d4a284..e956c4c568 100644 --- a/app/submodule/wallet/wallet_submodule.go +++ b/app/submodule/wallet/wallet_submodule.go @@ -74,7 +74,7 @@ func NewWalletSubmodule(ctx context.Context, }, nil } -//API create a new wallet api implement +// API create a new wallet api implement func (wallet *WalletSubmodule) API() v1api.IWallet { return &WalletAPI{ walletModule: wallet, diff --git a/cmd/tablewriter/tablewriter.go b/cmd/tablewriter/tablewriter.go index 0bce40d704..a84d8ddb60 100755 --- a/cmd/tablewriter/tablewriter.go +++ b/cmd/tablewriter/tablewriter.go @@ -35,7 +35,8 @@ func NewLineCol(name string) Column { } // Unlike text/tabwriter, this works with CLI escape codes, and allows for info -// in separate lines +// +// in separate lines func New(cols ...Column) *TableWriter { return &TableWriter{ cols: cols, diff --git a/pkg/beacon/drand.go b/pkg/beacon/drand.go index ec61c247f6..72be816736 100644 --- a/pkg/beacon/drand.go +++ b/pkg/beacon/drand.go @@ -50,7 +50,7 @@ type DrandHTTPClient interface { SetUserAgent(string) } -//NewDrandBeacon create new beacon client from config, genesis block time and block delay +// NewDrandBeacon create new beacon client from config, genesis block time and block delay func NewDrandBeacon(genTimeStamp, interval uint64, config cfg.DrandConf) (*DrandBeacon, error) { drandChain, err := dchain.InfoFromJSON(bytes.NewReader([]byte(config.ChainInfoJSON))) if err != nil { @@ -103,7 +103,7 @@ func NewDrandBeacon(genTimeStamp, interval uint64, config cfg.DrandConf) (*Drand return db, nil } -//Entry get a beacon value of specify block height, +// Entry get a beacon value of specify block height, func (db *DrandBeacon) Entry(ctx context.Context, round uint64) <-chan Response { out := make(chan Response, 1) if round != 0 { diff --git a/pkg/beacon/drand_test.go b/pkg/beacon/drand_test.go index 75d13ec0dd..61230f4402 100644 --- a/pkg/beacon/drand_test.go +++ b/pkg/beacon/drand_test.go @@ -1,5 +1,5 @@ -//stm: ignore -//Only tests external library behavior, therefore it should not be annotated +// stm: ignore +// Only tests external library behavior, therefore it should not be annotated package beacon import ( diff --git a/pkg/beacon/schedule.go b/pkg/beacon/schedule.go index 376002f9bf..e063878d67 100644 --- a/pkg/beacon/schedule.go +++ b/pkg/beacon/schedule.go @@ -11,7 +11,7 @@ import ( type Schedule []BeaconPoint -//BeaconForEpoch select beacon at specify epoch +// BeaconForEpoch select beacon at specify epoch func (bs Schedule) BeaconForEpoch(e abi.ChainEpoch) RandomBeacon { for i := len(bs) - 1; i >= 0; i-- { bp := bs[i] @@ -22,7 +22,7 @@ func (bs Schedule) BeaconForEpoch(e abi.ChainEpoch) RandomBeacon { return bs[0].Beacon } -//DrandConfigSchedule create new beacon schedule , used to select beacon server at specify chain height +// DrandConfigSchedule create new beacon schedule , used to select beacon server at specify chain height func DrandConfigSchedule(genTimeStamp uint64, blockDelay uint64, drandSchedule map[abi.ChainEpoch]cfg.DrandEnum) (Schedule, error) { shd := Schedule{} diff --git a/pkg/chain/chain_index.go b/pkg/chain/chain_index.go index 38f8a318f5..c6d0c1cc70 100644 --- a/pkg/chain/chain_index.go +++ b/pkg/chain/chain_index.go @@ -11,7 +11,7 @@ import ( var DefaultChainIndexCacheSize = 32 << 10 -//ChainIndex tipset height index, used to getting tipset by height quickly +// ChainIndex tipset height index, used to getting tipset by height quickly type ChainIndex struct { //nolint skipCache *lru.ARCCache @@ -20,7 +20,7 @@ type ChainIndex struct { //nolint skipLength abi.ChainEpoch } -//NewChainIndex return a new chain index with arc cache +// NewChainIndex return a new chain index with arc cache func NewChainIndex(lts loadTipSetFunc) *ChainIndex { sc, _ := lru.NewARC(DefaultChainIndexCacheSize) return &ChainIndex{ @@ -74,7 +74,7 @@ func (ci *ChainIndex) GetTipSetByHeight(ctx context.Context, from *types.TipSet, } } -//GetTipsetByHeightWithoutCache get the tipset of specific height by reading the database directly +// GetTipsetByHeightWithoutCache get the tipset of specific height by reading the database directly func (ci *ChainIndex) GetTipsetByHeightWithoutCache(ctx context.Context, from *types.TipSet, to abi.ChainEpoch) (*types.TipSet, error) { return ci.walkBack(ctx, from, to) } diff --git a/pkg/chain/circulating_supply.go b/pkg/chain/circulating_supply.go index e68e2a1c3b..a5608fc1be 100644 --- a/pkg/chain/circulating_supply.go +++ b/pkg/chain/circulating_supply.go @@ -30,7 +30,7 @@ type ICirculatingSupplyCalcualtor interface { GetFilVested(ctx context.Context, height abi.ChainEpoch) (abi.TokenAmount, error) } -//CirculatingSupplyCalculator used to calculate the funds at a specific block height +// CirculatingSupplyCalculator used to calculate the funds at a specific block height type CirculatingSupplyCalculator struct { bstore blockstoreutil.Blockstore genesisRoot cid.Cid @@ -47,12 +47,12 @@ type CirculatingSupplyCalculator struct { upgradeConfig *config.ForkUpgradeConfig } -//NewCirculatingSupplyCalculator create new circulating supply calculator +// NewCirculatingSupplyCalculator create new circulating supply calculator func NewCirculatingSupplyCalculator(bstore blockstoreutil.Blockstore, genesisRoot cid.Cid, upgradeConfig *config.ForkUpgradeConfig) *CirculatingSupplyCalculator { return &CirculatingSupplyCalculator{bstore: bstore, genesisRoot: genesisRoot, upgradeConfig: upgradeConfig} } -//GetCirculatingSupplyDetailed query contract and calculate circulation status at specific height and tree state +// GetCirculatingSupplyDetailed query contract and calculate circulation status at specific height and tree state func (caculator *CirculatingSupplyCalculator) GetCirculatingSupplyDetailed(ctx context.Context, height abi.ChainEpoch, st tree.Tree) (types.CirculatingSupply, error) { filVested, err := caculator.GetFilVested(ctx, height) if err != nil { @@ -356,7 +356,7 @@ func (caculator *CirculatingSupplyCalculator) GetFilReserveDisbursed(ctx context return big.Sub(big.NewFromGo(constants.InitialFilReserved), ract.Balance), nil } -//GetFilMined query reward contract to get amount of mined fil +// GetFilMined query reward contract to get amount of mined fil func GetFilMined(ctx context.Context, st tree.Tree) (abi.TokenAmount, error) { ractor, found, err := st.GetActor(ctx, reward.Address) if !found || err != nil { @@ -371,7 +371,7 @@ func GetFilMined(ctx context.Context, st tree.Tree) (abi.TokenAmount, error) { return rst.TotalStoragePowerReward() } -//GetFilBurnt query burnt contract to get amount of burnt fil +// GetFilBurnt query burnt contract to get amount of burnt fil func GetFilBurnt(ctx context.Context, st tree.Tree) (abi.TokenAmount, error) { burnt, found, err := st.GetActor(ctx, builtin.BurntFundsActorAddr) if !found || err != nil { @@ -381,7 +381,7 @@ func GetFilBurnt(ctx context.Context, st tree.Tree) (abi.TokenAmount, error) { return burnt.Balance, nil } -//GetFilLocked query the market contract and power contract to get the amount of locked fils +// GetFilLocked query the market contract and power contract to get the amount of locked fils func (caculator *CirculatingSupplyCalculator) GetFilLocked(ctx context.Context, st tree.Tree) (abi.TokenAmount, error) { filMarketLocked, err := getFilMarketLocked(ctx, st) diff --git a/pkg/chain/coalescer.go b/pkg/chain/coalescer.go index 5e35961446..7869345c97 100644 --- a/pkg/chain/coalescer.go +++ b/pkg/chain/coalescer.go @@ -9,12 +9,17 @@ import ( // WrapHeadChangeCoalescer wraps a ReorgNotifee with a head change coalescer. // minDelay is the minimum coalesce delay; when a head change is first received, the coalescer will -// wait for that long to coalesce more head changes. +// +// wait for that long to coalesce more head changes. +// // maxDelay is the maximum coalesce delay; the coalescer will not delay delivery of a head change -// more than that. +// +// more than that. +// // mergeInterval is the interval that triggers additional coalesce delay; if the last head change was -// within the merge interval when the coalesce timer fires, then the coalesce time is extended -// by min delay and up to max delay total. +// +// within the merge interval when the coalesce timer fires, then the coalesce time is extended +// by min delay and up to max delay total. func WrapHeadChangeCoalescer(fn ReorgNotifee, minDelay, maxDelay, mergeInterval time.Duration) ReorgNotifee { c := NewHeadChangeCoalescer(fn, minDelay, maxDelay, mergeInterval) return c.HeadChange diff --git a/pkg/chain/message_store.go b/pkg/chain/message_store.go index a940de921a..0559919938 100644 --- a/pkg/chain/message_store.go +++ b/pkg/chain/message_store.go @@ -93,7 +93,7 @@ func (ms *MessageStore) LoadMetaMessages(ctx context.Context, metaCid cid.Cid) ( return secpMsgs, blsMsgs, nil } -//ReadMsgMetaCids load messager from message meta cid +// ReadMsgMetaCids load messager from message meta cid func (ms *MessageStore) ReadMsgMetaCids(ctx context.Context, mmc cid.Cid) ([]cid.Cid, []cid.Cid, error) { meta, err := ms.LoadTxMeta(ctx, mmc) if err != nil { @@ -111,8 +111,8 @@ func (ms *MessageStore) ReadMsgMetaCids(ctx context.Context, mmc cid.Cid) ([]cid return blsCids, secpCids, nil } -//LoadMessage load message of specify message cid -//First get the unsigned message. If it is not found, then get the signed message. If still not found, an error will be returned +// LoadMessage load message of specify message cid +// First get the unsigned message. If it is not found, then get the signed message. If still not found, an error will be returned func (ms *MessageStore) LoadMessage(ctx context.Context, mid cid.Cid) (types.ChainMsg, error) { m, err := ms.LoadUnsignedMessage(ctx, mid) if err == nil { @@ -126,7 +126,7 @@ func (ms *MessageStore) LoadMessage(ctx context.Context, mid cid.Cid) (types.Cha return ms.LoadSignedMessage(ctx, mid) } -//LoadUnsignedMessage load unsigned messages in tipset +// LoadUnsignedMessage load unsigned messages in tipset func (ms *MessageStore) LoadUnsignedMessage(ctx context.Context, mid cid.Cid) (*types.Message, error) { messageBlock, err := ms.bs.Get(ctx, mid) if err != nil { @@ -139,7 +139,7 @@ func (ms *MessageStore) LoadUnsignedMessage(ctx context.Context, mid cid.Cid) (* return message, nil } -//LoadUnsignedMessagesFromCids load unsigned messages of cid array +// LoadUnsignedMessagesFromCids load unsigned messages of cid array func (ms *MessageStore) LoadSignedMessage(ctx context.Context, mid cid.Cid) (*types.SignedMessage, error) { messageBlock, err := ms.bs.Get(ctx, mid) if err != nil { @@ -154,7 +154,7 @@ func (ms *MessageStore) LoadSignedMessage(ctx context.Context, mid cid.Cid) (*ty return message, nil } -//LoadUnsignedMessagesFromCids load unsigned messages of cid array +// LoadUnsignedMessagesFromCids load unsigned messages of cid array func (ms *MessageStore) LoadUnsignedMessagesFromCids(ctx context.Context, blsCids []cid.Cid) ([]*types.Message, error) { blsMsgs := make([]*types.Message, len(blsCids)) for i, c := range blsCids { @@ -167,7 +167,7 @@ func (ms *MessageStore) LoadUnsignedMessagesFromCids(ctx context.Context, blsCid return blsMsgs, nil } -//LoadSignedMessagesFromCids load signed messages of cid array +// LoadSignedMessagesFromCids load signed messages of cid array func (ms *MessageStore) LoadSignedMessagesFromCids(ctx context.Context, secpCids []cid.Cid) ([]*types.SignedMessage, error) { secpMsgs := make([]*types.SignedMessage, len(secpCids)) for i, c := range secpCids { @@ -228,7 +228,7 @@ func (ms *MessageStore) StoreMessages(ctx context.Context, secpMessages []*types return ms.StoreTxMeta(ctx, ret) } -//load message from tipset NOTICE skip message with the same nonce +// load message from tipset NOTICE skip message with the same nonce func (ms *MessageStore) LoadTipSetMesssages(ctx context.Context, ts *types.TipSet) ([][]*types.SignedMessage, [][]*types.Message, error) { var secpMessages [][]*types.SignedMessage var blsMessages [][]*types.Message @@ -387,7 +387,7 @@ func (ms *MessageStore) LoadTxMeta(ctx context.Context, c cid.Cid) (types.Messag return meta, nil } -//LoadTipSetMessage message from tipset NOTICE skip message with the same nonce +// LoadTipSetMessage message from tipset NOTICE skip message with the same nonce func (ms *MessageStore) LoadTipSetMessage(ctx context.Context, ts *types.TipSet) ([]types.BlockMessagesInfo, error) { //gather message applied := make(map[address.Address]uint64) @@ -462,7 +462,7 @@ func (ms *MessageStore) LoadTipSetMessage(ctx context.Context, ts *types.TipSet) return blockMsg, nil } -//MessagesForTipset return of message ( bls message + secp message) of tipset +// MessagesForTipset return of message ( bls message + secp message) of tipset func (ms *MessageStore) MessagesForTipset(ts *types.TipSet) ([]types.ChainMsg, error) { bmsgs, err := ms.LoadTipSetMessage(context.TODO(), ts) if err != nil { @@ -478,7 +478,7 @@ func (ms *MessageStore) MessagesForTipset(ts *types.TipSet) ([]types.ChainMsg, e return out, nil } -//StoreMessage put message(include signed message and unsigned message) to database +// StoreMessage put message(include signed message and unsigned message) to database func (ms *MessageStore) StoreMessage(message types.ChainMsg) (cid.Cid, error) { return cbor.NewCborStore(ms.bs).Put(context.TODO(), message) } @@ -503,7 +503,7 @@ func MakeBlock(obj cbor2.Marshaler) (blocks.Block, error) { return blocks.NewBlockWithCid(data, c) } -//todo move to a more suitable position +// todo move to a more suitable position func ComputeNextBaseFee(baseFee abi.TokenAmount, gasLimitUsed int64, noOfBlocks int, epoch abi.ChainEpoch, upgrade *config.ForkUpgradeConfig) abi.TokenAmount { // deta := gasLimitUsed/noOfBlocks - constants.BlockGasTarget // change := baseFee * deta / BlockGasTarget @@ -538,7 +538,7 @@ func ComputeNextBaseFee(baseFee abi.TokenAmount, gasLimitUsed int64, noOfBlocks return nextBaseFee } -//todo move to a more suitable position +// todo move to a more suitable position func (ms *MessageStore) ComputeBaseFee(ctx context.Context, ts *types.TipSet, upgrade *config.ForkUpgradeConfig) (abi.TokenAmount, error) { zero := abi.NewTokenAmount(0) baseHeight := ts.Height() diff --git a/pkg/chain/randomness.go b/pkg/chain/randomness.go index 602f9f0b86..371141cbe3 100644 --- a/pkg/chain/randomness.go +++ b/pkg/chain/randomness.go @@ -268,7 +268,7 @@ func (c *ChainRandomnessSource) extractBeaconEntryForEpoch(ctx context.Context, return nil, fmt.Errorf("didn't find beacon for round %d (epoch %d)", round, filecoinEpoch) } -//BlendEntropy get randomness with chain value. sha256(buf(tag, seed, epoch, entropy)) +// BlendEntropy get randomness with chain value. sha256(buf(tag, seed, epoch, entropy)) func BlendEntropy(tag crypto.DomainSeparationTag, seed RandomSeed, epoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error) { buffer := bytes.Buffer{} err := binary.Write(&buffer, binary.BigEndian, int64(tag)) diff --git a/pkg/chainsync/dispatcher/dispatcher.go b/pkg/chainsync/dispatcher/dispatcher.go index bd241d8c23..e97c65bf25 100644 --- a/pkg/chainsync/dispatcher/dispatcher.go +++ b/pkg/chainsync/dispatcher/dispatcher.go @@ -151,7 +151,7 @@ func (d *Dispatcher) processIncoming(ctx context.Context) { } } -//SetConcurrent set the max goroutine to syncing target +// SetConcurrent set the max goroutine to syncing target func (d *Dispatcher) SetConcurrent(number int64) { d.lk.Lock() defer d.lk.Unlock() @@ -169,7 +169,7 @@ func (d *Dispatcher) SetConcurrent(number int64) { } } -//Concurrent get current max syncing goroutine +// Concurrent get current max syncing goroutine func (d *Dispatcher) Concurrent() int64 { d.lk.Lock() defer d.lk.Unlock() diff --git a/pkg/chainsync/slashfilter/slashfilter.go b/pkg/chainsync/slashfilter/slashfilter.go index 7e65b87699..eb8cb54cdf 100644 --- a/pkg/chainsync/slashfilter/slashfilter.go +++ b/pkg/chainsync/slashfilter/slashfilter.go @@ -12,18 +12,18 @@ import ( "github.com/filecoin-project/venus/venus-shared/types" ) -//ISlashFilter used to detect whether the miner mined a invalidated block , support local db and mysql storage +// ISlashFilter used to detect whether the miner mined a invalidated block , support local db and mysql storage type ISlashFilter interface { MinedBlock(ctx context.Context, bh *types.BlockHeader, parentEpoch abi.ChainEpoch) error } -//LocalSlashFilter use badger db to save mined block for detect slash consensus block +// LocalSlashFilter use badger db to save mined block for detect slash consensus block type LocalSlashFilter struct { byEpoch ds.Datastore // double-fork mining faults, parent-grinding fault byParents ds.Datastore // time-offset mining faults } -//NewLocalSlashFilter create a slash filter base on badger db +// NewLocalSlashFilter create a slash filter base on badger db func NewLocalSlashFilter(dstore ds.Batching) ISlashFilter { return &LocalSlashFilter{ byEpoch: namespace.Wrap(dstore, ds.NewKey("/slashfilter/epoch")), @@ -31,7 +31,7 @@ func NewLocalSlashFilter(dstore ds.Batching) ISlashFilter { } } -//MinedBlock check whether the block mined is slash +// MinedBlock check whether the block mined is slash func (f *LocalSlashFilter) MinedBlock(ctx context.Context, bh *types.BlockHeader, parentEpoch abi.ChainEpoch) error { epochKey := ds.NewKey(fmt.Sprintf("/%s/%d", bh.Miner, bh.Height)) { diff --git a/pkg/chainsync/syncer/syncer.go b/pkg/chainsync/syncer/syncer.go index 23071187b1..86ff241445 100644 --- a/pkg/chainsync/syncer/syncer.go +++ b/pkg/chainsync/syncer/syncer.go @@ -75,7 +75,7 @@ type StateProcessor interface { RunStateTransition(ctx context.Context, ts *types.TipSet) (root cid.Cid, receipt cid.Cid, err error) } -//BlockValidator used to validate full block +// BlockValidator used to validate full block type BlockValidator interface { ValidateFullBlock(ctx context.Context, blk *types.BlockHeader) error } @@ -94,7 +94,7 @@ type ChainReaderWriter interface { GetGenesisBlock(context.Context) (*types.BlockHeader, error) } -//messageStore used to save and load message from db +// messageStore used to save and load message from db type messageStore interface { LoadTipSetMessage(ctx context.Context, ts *types.TipSet) ([]types.BlockMessagesInfo, error) LoadMetaMessages(context.Context, cid.Cid) ([]*types.SignedMessage, []*types.Message, error) @@ -111,9 +111,9 @@ type ChainSelector interface { Weight(ctx context.Context, ts *types.TipSet) (big.Int, error) } -//Syncer used to synchronize the block from the specified target, including acquiring the relevant block data and message data, -//verifying the block machine messages one by one and calculating them, checking the weight of the target after the calculation, -//and check whether it can become the latest tipset +// Syncer used to synchronize the block from the specified target, including acquiring the relevant block data and message data, +// verifying the block machine messages one by one and calculating them, checking the weight of the target after the calculation, +// and check whether it can become the latest tipset type Syncer struct { exchangeClient exchange.Client // BadTipSetCache is used to filter out collections of invalid blocks. @@ -185,7 +185,7 @@ func NewSyncer(stmgr *statemanger.Stmgr, // in order to validate the tipset. In the case the input tipset is valid, // syncOne calls into consensus to check its weight, and then updates the head // of the bsstore if this tipset is the heaviest. -//todo mark bad-block +// todo mark bad-block func (syncer *Syncer) syncOne(ctx context.Context, parent, next *types.TipSet) error { logSyncer.Infof("syncOne tipset, height:%d, blocks:%s", next.Height(), next.Key().String()) priorHeadKey := syncer.chainStore.GetHead() @@ -342,7 +342,7 @@ func (syncer *Syncer) syncSegement(ctx context.Context, target *syncTypes.Target } } -//fetchChainBlocks get the block data, from targettip to knowntip. +// fetchChainBlocks get the block data, from targettip to knowntip. // if local db has the block used that block // if local db not exist, get block from network(libp2p), // if there is a fork, get the common root tipset of knowntip and targettip, and return the block data from root tipset to targettip @@ -458,7 +458,6 @@ loop: // D->E-F(targetTip) // A => D->E>F // B-C(knownTip) -// func (syncer *Syncer) syncFork(ctx context.Context, incoming *types.TipSet, known *types.TipSet) ([]*types.TipSet, error) { // TODO: Does this mean we always ask for ForkLengthThreshold blocks from the network, even if we just need, like, 2? // Would it not be better to ask in smaller chunks, given that an ~ForkLengthThreshold is very rare? @@ -502,7 +501,7 @@ func (syncer *Syncer) syncFork(ctx context.Context, incoming *types.TipSet, know return nil, ErrForkTooLong } -//fetchSegMessage get message in tipset +// fetchSegMessage get message in tipset func (syncer *Syncer) fetchSegMessage(ctx context.Context, segTipset []*types.TipSet) ([]*types.FullTipSet, error) { //get message from local bsstore if len(segTipset) == 0 { @@ -584,7 +583,7 @@ func (syncer *Syncer) getFullBlock(ctx context.Context, tipset *types.TipSet) (* return types.NewFullTipSet(fullBlocks), nil } -//processTipSetSegment process a batch of tipset in turn, +// processTipSetSegment process a batch of tipset in turn, func (syncer *Syncer) processTipSetSegment(ctx context.Context, target *syncTypes.Target, parent *types.TipSet, segTipset []*types.TipSet) (*types.TipSet, error) { for i, ts := range segTipset { err := syncer.syncOne(ctx, parent, ts) @@ -603,12 +602,12 @@ func (syncer *Syncer) processTipSetSegment(ctx context.Context, target *syncType return parent, nil } -//Head get latest head from chain store +// Head get latest head from chain store func (syncer *Syncer) Head() *types.TipSet { return syncer.chainStore.GetHead() } -//SetHead try to sethead after complete tipset syncing, +// SetHead try to sethead after complete tipset syncing, // if the current target weight is heavier than chain store. change a new head func (syncer *Syncer) SetHead(ctx context.Context, ts *types.TipSet) error { syncer.headLock.Lock() @@ -640,8 +639,9 @@ func (syncer *Syncer) SetHead(ctx context.Context, ts *types.TipSet) error { // The "fast forward" case is covered in this logic as a valid fork of length 0. // // FIXME: We may want to replace some of the logic in `syncFork()` with this. -// `syncFork()` counts the length on both sides of the fork at the moment (we -// need to settle on that) but here we just enforce it on the `synced` side. +// +// `syncFork()` counts the length on both sides of the fork at the moment (we +// need to settle on that) but here we just enforce it on the `synced` side. func (syncer *Syncer) exceedsForkLength(ctx context.Context, synced, external *types.TipSet) (bool, error) { if synced == nil || external == nil { // FIXME: If `cs.heaviest` is nil we should just bypass the entire diff --git a/pkg/chainsync/types/syncstate.go b/pkg/chainsync/types/syncstate.go index f569b4e5a4..36cb5d1b29 100644 --- a/pkg/chainsync/types/syncstate.go +++ b/pkg/chainsync/types/syncstate.go @@ -2,7 +2,7 @@ package types import "fmt" -//just compatible code lotus +// just compatible code lotus type SyncStateStage int const ( diff --git a/pkg/chainsync/types/target_tracker.go b/pkg/chainsync/types/target_tracker.go index cb5c24e494..cddb8ca17e 100644 --- a/pkg/chainsync/types/target_tracker.go +++ b/pkg/chainsync/types/target_tracker.go @@ -33,8 +33,8 @@ type Target struct { types.ChainInfo } -//IsNeighbor the target t is neighbor or not -//the same height, the same weight, the same parent is neighbor target. the can merge +// IsNeighbor the target t is neighbor or not +// the same height, the same weight, the same parent is neighbor target. the can merge func (target *Target) IsNeighbor(t *Target) bool { if target.Head.Height() != t.Head.Height() { return false @@ -52,13 +52,13 @@ func (target *Target) IsNeighbor(t *Target) bool { return true } -//HasChild is another is a child target of current. -//if the t' blocks in a subset of current target ,the t is a child of current target +// HasChild is another is a child target of current. +// if the t' blocks in a subset of current target ,the t is a child of current target func (target *Target) HasChild(t *Target) bool { return target.Head.Key().ContainsAll(t.Head.Key()) } -//Key return identity of target . key=weight+height+parent +// Key return identity of target . key=weight+height+parent func (target *Target) Key() string { weightIn := target.Head.ParentWeight() return weightIn.String() + @@ -259,7 +259,7 @@ func (tq *TargetTracker) Add(t *Target) bool { return true } -//sort by weight and than sort by block number in target buckets +// sort by weight and than sort by block number in target buckets func sortTarget(target TargetBuckets) { //use weight as group key groups := make(map[string][]*Target) @@ -375,8 +375,8 @@ func (tq *TargetTracker) Select() (*Target, bool) { return toSyncTarget, true } -//Remove remote a target after sync completed -//First remove target from live queue, add the target to history. +// Remove remote a target after sync completed +// First remove target from live queue, add the target to history. func (tq *TargetTracker) Remove(t *Target) { tq.lk.Lock() defer tq.lk.Unlock() @@ -395,7 +395,7 @@ func (tq *TargetTracker) Remove(t *Target) { tq.history.PushBack(t) } -//History return sync history +// History return sync history func (tq *TargetTracker) History() []*Target { tq.lk.Lock() defer tq.lk.Unlock() diff --git a/pkg/config/beacon_config.go b/pkg/config/beacon_config.go index 7fd6fa0fe7..677baa65a9 100644 --- a/pkg/config/beacon_config.go +++ b/pkg/config/beacon_config.go @@ -16,7 +16,7 @@ type DrandConf struct { ChainInfoJSON string } -//DrandConfigs a set of drand config +// DrandConfigs a set of drand config var DrandConfigs = map[DrandEnum]DrandConf{ DrandMainnet: { Servers: []string{ diff --git a/pkg/consensus/block_validator.go b/pkg/consensus/block_validator.go index 68111658d8..627adb4c88 100644 --- a/pkg/consensus/block_validator.go +++ b/pkg/consensus/block_validator.go @@ -49,7 +49,7 @@ var ErrTemporal = errors.New("temporal error") var ErrSoftFailure = errors.New("soft validation failure") var ErrInsufficientPower = errors.New("incoming block's miner does not have minimum power") -//BlockValidator used to validate a block is ok or not +// BlockValidator used to validate a block is ok or not type BlockValidator struct { // TicketValidator validates ticket generation tv TicketValidator @@ -80,7 +80,7 @@ type BlockValidator struct { Stmgr StateTransformer } -//NewBlockValidator create a new block validator +// NewBlockValidator create a new block validator func NewBlockValidator(tv TicketValidator, bstore blockstoreutil.Blockstore, messageStore *chain.MessageStore, @@ -111,7 +111,7 @@ func NewBlockValidator(tv TicketValidator, } } -//ValidateBlockMsg used to validate block from incoming. check message, signature , wincount. +// ValidateBlockMsg used to validate block from incoming. check message, signature , wincount. // if give a reject error. local node reject this block. if give a ignore error. recheck this block in latest notify func (bv *BlockValidator) ValidateBlockMsg(ctx context.Context, blk *types.BlockMsg) pubsub.ValidationResult { validationStart := time.Now() @@ -122,7 +122,7 @@ func (bv *BlockValidator) ValidateBlockMsg(ctx context.Context, blk *types.Block return bv.validateBlockMsg(ctx, blk) } -//ValidateFullBlock should match up with 'Semantical Validation' in validation.md in the spec +// ValidateFullBlock should match up with 'Semantical Validation' in validation.md in the spec func (bv *BlockValidator) ValidateFullBlock(ctx context.Context, blk *types.BlockHeader) error { validationStart := time.Now() diff --git a/pkg/consensus/message_validator.go b/pkg/consensus/message_validator.go index b44e619af3..b6dbbafeab 100644 --- a/pkg/consensus/message_validator.go +++ b/pkg/consensus/message_validator.go @@ -150,7 +150,8 @@ func NewMessageSignatureValidator(api signatureValidatorAPI) *MessageSignatureVa } // Validate validates the signed message signature. Errors probably mean the -// validation failed, but possibly indicate a failure to retrieve state. +// +// validation failed, but possibly indicate a failure to retrieve state. func (v *MessageSignatureValidator) Validate(ctx context.Context, smsg *types.SignedMessage) error { head := v.api.GetHead() view, err := v.api.AccountView(head) diff --git a/pkg/consensus/proof_verifier.go b/pkg/consensus/proof_verifier.go index c771fd67fe..69980f1cae 100644 --- a/pkg/consensus/proof_verifier.go +++ b/pkg/consensus/proof_verifier.go @@ -47,7 +47,7 @@ func VerifyVRF(ctx context.Context, worker address.Address, vrfBase, vrfproof [] return nil } -//VerifyElectionPoStVRF verify election post value in block +// VerifyElectionPoStVRF verify election post value in block func VerifyElectionPoStVRF(ctx context.Context, worker address.Address, rand []byte, evrf []byte) error { if constants.InsecurePoStValidation { return nil diff --git a/pkg/constants/registered_proofs.go b/pkg/constants/registered_proofs.go index 51509485c4..dc192ac5f7 100644 --- a/pkg/constants/registered_proofs.go +++ b/pkg/constants/registered_proofs.go @@ -2,7 +2,7 @@ package constants import "github.com/filecoin-project/go-state-types/abi" -//just for test +// just for test var DevRegisteredSealProof = abi.RegisteredSealProof_StackedDrg2KiBV1 var DevRegisteredWinningPoStProof = abi.RegisteredPoStProof_StackedDrgWinning2KiBV1 diff --git a/pkg/events/utils.go b/pkg/events/utils.go index 4dd87d121c..69cf9b6ae5 100644 --- a/pkg/events/utils.go +++ b/pkg/events/utils.go @@ -38,7 +38,7 @@ func (me *messageEvents) CheckMsg(smsg types.ChainMsg, hnd MsgHandler) CheckFunc } } -//MatchMsg check that a specific message is in a block message +// MatchMsg check that a specific message is in a block message func (me *messageEvents) MatchMsg(inmsg *types.Message) MsgMatchFunc { return func(msg *types.Message) (matched bool, err error) { if msg.From == inmsg.From && msg.Nonce == inmsg.Nonce && !inmsg.Equals(msg) { diff --git a/pkg/fork/mock.go b/pkg/fork/mock.go index e157a233f6..2c14a84d1e 100644 --- a/pkg/fork/mock.go +++ b/pkg/fork/mock.go @@ -15,7 +15,7 @@ var _ = IFork((*MockFork)(nil)) type MockFork struct{} -//NewMockFork mock for test +// NewMockFork mock for test func NewMockFork() *MockFork { return &MockFork{} } diff --git a/pkg/gen/gen.go b/pkg/gen/gen.go index 535406849e..84e46893e2 100644 --- a/pkg/gen/gen.go +++ b/pkg/gen/gen.go @@ -9,7 +9,7 @@ import ( "github.com/filecoin-project/venus/pkg/gen/genesis" ) -//CarWalkFunc get each child node under the node (nd) +// CarWalkFunc get each child node under the node (nd) func CarWalkFunc(nd format.Node) (out []*format.Link, err error) { for _, link := range nd.Links() { pref := link.Cid.Prefix() diff --git a/pkg/genesis/genesis.go b/pkg/genesis/genesis.go index 1da00f4005..604bae68f3 100644 --- a/pkg/genesis/genesis.go +++ b/pkg/genesis/genesis.go @@ -58,7 +58,7 @@ type VM interface { Flush(ctx context.Context) (tree.Root, error) } -//MakeGenesis return a func to construct a genesis block +// MakeGenesis return a func to construct a genesis block func MakeGenesis(ctx context.Context, rep repo.Repo, outFile, genesisTemplate string, para *config.ForkUpgradeConfig) InitFunc { return func(_ cbor.IpldStore, bs blockstoreutil.Blockstore) (*types.BlockHeader, error) { glog.Warn("Generating new random genesis block, note that this SHOULD NOT happen unless you are setting up new network") diff --git a/pkg/net/exchange/doc.go b/pkg/net/exchange/doc.go index b20ee0c1fe..21abc38c4b 100644 --- a/pkg/net/exchange/doc.go +++ b/pkg/net/exchange/doc.go @@ -10,8 +10,8 @@ // A client can also pass options, encoded as a 64-bit bitfield. Lotus supports // two options at the moment: // -// - include block contents -// - include block messages +// - include block contents +// - include block messages // // The response will include a status code, an optional message, and the // response payload in case of success. The payload is a slice of serialized diff --git a/pkg/paychmgr/util.go b/pkg/paychmgr/util.go index 0dc478ec8c..1f03d2c818 100644 --- a/pkg/paychmgr/util.go +++ b/pkg/paychmgr/util.go @@ -13,7 +13,7 @@ type BestSpendableAPI interface { PaychVoucherCheckSpendable(context.Context, address.Address, *paych.SignedVoucher, []byte, []byte) (bool, error) } -//BestSpendableByLane return spendable voucher in channel address +// BestSpendableByLane return spendable voucher in channel address func BestSpendableByLane(ctx context.Context, api BestSpendableAPI, ch address.Address) (map[uint64]*paych.SignedVoucher, error) { vouchers, err := api.PaychVoucherList(ctx, ch) if err != nil { diff --git a/pkg/state/signer.go b/pkg/state/signer.go index b6a6a3dff4..eaf0d07a8c 100644 --- a/pkg/state/signer.go +++ b/pkg/state/signer.go @@ -9,7 +9,7 @@ import ( "github.com/filecoin-project/venus/venus-shared/types" ) -//todo remove Account view a nd headsignerview +// todo remove Account view a nd headsignerview type AccountView interface { ResolveToKeyAddr(ctx context.Context, address address.Address) (address.Address, error) } diff --git a/pkg/state/sigval.go b/pkg/state/sigval.go index 8c3bb8191a..797fe6d553 100644 --- a/pkg/state/sigval.go +++ b/pkg/state/sigval.go @@ -10,9 +10,7 @@ import ( "github.com/filecoin-project/venus/venus-shared/types" ) -// // SignatureValidator resolves account actor addresses to their pubkey-style address for signature validation. -// type SignatureValidator struct { signerView AccountView } @@ -21,7 +19,7 @@ func NewSignatureValidator(signerView AccountView) *SignatureValidator { return &SignatureValidator{signerView: signerView} } -//ValidateSignature check the signature is valid or not +// ValidateSignature check the signature is valid or not func (v *SignatureValidator) ValidateSignature(ctx context.Context, data []byte, signer address.Address, sig crypto.Signature) error { signerAddress, err := v.signerView.ResolveToKeyAddr(ctx, signer) if err != nil { @@ -30,13 +28,13 @@ func (v *SignatureValidator) ValidateSignature(ctx context.Context, data []byte, return crypto.Verify(&sig, signerAddress, data) } -//ValidateSignature check the signature of message is valid or not. first get the cid of message and than checkout signature of messager cid and address +// ValidateSignature check the signature of message is valid or not. first get the cid of message and than checkout signature of messager cid and address func (v *SignatureValidator) ValidateMessageSignature(ctx context.Context, msg *types.SignedMessage) error { mCid := msg.Message.Cid() return v.ValidateSignature(ctx, mCid.Bytes(), msg.Message.From, msg.Signature) } -//ValidateBLSMessageAggregate validate bls aggregate message +// ValidateBLSMessageAggregate validate bls aggregate message func (v *SignatureValidator) ValidateBLSMessageAggregate(ctx context.Context, msgs []*types.Message, sig *crypto.Signature) error { if sig == nil { if len(msgs) > 0 { diff --git a/pkg/util/dag/oldpath/oldresolver/resolver.go b/pkg/util/dag/oldpath/oldresolver/resolver.go index 3d1b71e9b3..b4d1228fc1 100644 --- a/pkg/util/dag/oldpath/oldresolver/resolver.go +++ b/pkg/util/dag/oldpath/oldresolver/resolver.go @@ -39,7 +39,8 @@ type ResolveOnce func(ctx context.Context, ds ipld.NodeGetter, nd ipld.Node, nam // Resolver provides path resolution to IPFS // It has a pointer to a DAGService, which is uses to resolve nodes. // TODO: now that this is more modular, try to unify this code with the -// the resolvers in namesys +// +// the resolvers in namesys type Resolver struct { DAG ipld.NodeGetter diff --git a/pkg/util/dag/oldpath/path.go b/pkg/util/dag/oldpath/path.go index fe4bd67a24..619f513d24 100644 --- a/pkg/util/dag/oldpath/path.go +++ b/pkg/util/dag/oldpath/path.go @@ -27,10 +27,10 @@ func (e *pathError) Path() string { } // A Path represents an ipfs content path: -// * //path/to/file -// * /ipfs/ -// * /ipns//path/to/folder -// * etc +// - //path/to/file +// - /ipfs/ +// - /ipns//path/to/folder +// - etc type Path string // ^^^ diff --git a/pkg/util/ffiwrapper/impl/unseal_ranges.go b/pkg/util/ffiwrapper/impl/unseal_ranges.go index cc2f6028fe..2e4041bbd1 100644 --- a/pkg/util/ffiwrapper/impl/unseal_ranges.go +++ b/pkg/util/ffiwrapper/impl/unseal_ranges.go @@ -10,7 +10,7 @@ import ( ) // merge gaps between ranges which are close to each other -// TODO: more benchmarking to come up with more optimal number +// TODO: more benchmarking to come up with more optimal number const mergeGaps = 32 << 20 // TODO const expandRuns = 16 << 20 // unseal more than requested for future requests diff --git a/pkg/vm/gas/burn.go b/pkg/vm/gas/burn.go index 321481c4c5..7cf80af1ce 100644 --- a/pkg/vm/gas/burn.go +++ b/pkg/vm/gas/burn.go @@ -10,7 +10,7 @@ const ( gasOveruseDenom = 10 ) -//GasOutputs detail of gas after message executed +// GasOutputs detail of gas after message executed type GasOutputs struct { //nolint BaseFeeBurn abi.TokenAmount OverEstimationBurn abi.TokenAmount @@ -68,7 +68,7 @@ func ComputeGasOverestimationBurn(gasUsed, gasLimit int64) (int64, int64) { return gasLimit - gasUsed - gasToBurn.Int64(), gasToBurn.Int64() } -//ComputeGasOutputs compute gas outputs base on message gas parameters and gasUsed after executed +// ComputeGasOutputs compute gas outputs base on message gas parameters and gasUsed after executed func ComputeGasOutputs(gasUsed, gasLimit int64, baseFee, feeCap, gasPremium abi.TokenAmount, chargeNetworkFee bool) GasOutputs { gasUsedBig := big.NewInt(gasUsed) out := ZeroGasOutputs() diff --git a/pkg/vm/gas/gascost.go b/pkg/vm/gas/gascost.go index b116324c84..f0f95bf70d 100644 --- a/pkg/vm/gas/gascost.go +++ b/pkg/vm/gas/gascost.go @@ -11,7 +11,7 @@ import ( "github.com/filecoin-project/venus/pkg/crypto" ) -//GasCharge amount of gas consumed at one time +// GasCharge amount of gas consumed at one time type GasCharge struct { //nolint Name string Extra interface{} @@ -23,7 +23,7 @@ type GasCharge struct { //nolint VirtualStorage int64 } -//Total return all gas in one time +// Total return all gas in one time func (g GasCharge) Total() int64 { return g.ComputeGas + g.StorageGas } @@ -81,12 +81,12 @@ type Pricelist interface { OnVerifyConsensusFault() GasCharge } -//PricesSchedule schedule gas prices for different network version +// PricesSchedule schedule gas prices for different network version type PricesSchedule struct { prices map[abi.ChainEpoch]Pricelist } -//NewPricesSchedule new gasprice schedule from forkParams parameters +// NewPricesSchedule new gasprice schedule from forkParams parameters func NewPricesSchedule(forkParams *config.ForkUpgradeConfig) *PricesSchedule { var prices = map[abi.ChainEpoch]Pricelist{ abi.ChainEpoch(0): &pricelistV0{ diff --git a/pkg/vm/vmcontext/gas_charge_ipld.go b/pkg/vm/vmcontext/gas_charge_ipld.go index ed4b280da4..94e92c4247 100644 --- a/pkg/vm/vmcontext/gas_charge_ipld.go +++ b/pkg/vm/vmcontext/gas_charge_ipld.go @@ -12,7 +12,7 @@ import ( var _ cbor.IpldBlockstore = (*GasChargeBlockStore)(nil) -//GasChargeBlockStore in addition to the basic blockstore read and write capabilities, a certain amount of gas consumption will be deducted for each operation +// GasChargeBlockStore in addition to the basic blockstore read and write capabilities, a certain amount of gas consumption will be deducted for each operation type GasChargeBlockStore struct { gasTank *gas.GasTracker pricelist gas.Pricelist @@ -27,7 +27,7 @@ func NewGasChargeBlockStore(gasTank *gas.GasTracker, pricelist gas.Pricelist, in } } -//Get charge gas and than get the value of cid +// Get charge gas and than get the value of cid func (bs *GasChargeBlockStore) Get(ctx context.Context, c cid.Cid) (blocks.Block, error) { bs.gasTank.Charge(bs.pricelist.OnIpldGet(), "storage get %s", c) @@ -38,7 +38,7 @@ func (bs *GasChargeBlockStore) Get(ctx context.Context, c cid.Cid) (blocks.Block return blk, nil } -//Put first charge gas and than save block +// Put first charge gas and than save block func (bs *GasChargeBlockStore) Put(ctx context.Context, blk blocks.Block) error { bs.gasTank.Charge(bs.pricelist.OnIpldPut(len(blk.RawData())), "%s storage put %d bytes", blk.Cid(), len(blk.RawData())) diff --git a/pkg/vm/vmcontext/syscallsStateView.go b/pkg/vm/vmcontext/syscallsStateView.go index e81b96256b..17b86735d3 100644 --- a/pkg/vm/vmcontext/syscallsStateView.go +++ b/pkg/vm/vmcontext/syscallsStateView.go @@ -14,9 +14,7 @@ import ( "github.com/pkg/errors" ) -// // implement syscalls stateView view -// type syscallsStateView struct { ctx *invocationContext *LegacyVM @@ -48,7 +46,7 @@ func (vm *syscallsStateView) ResolveToKeyAddr(ctx context.Context, accountAddr a return accountState.PubkeyAddress() } -//MinerInfo get miner info +// MinerInfo get miner info func (vm *syscallsStateView) MinerInfo(ctx context.Context, maddr address.Address, nv network.Version) (*miner.MinerInfo, error) { accountActor, found, err := vm.State.GetActor(vm.context, maddr) if err != nil { @@ -71,12 +69,12 @@ func (vm *syscallsStateView) MinerInfo(ctx context.Context, maddr address.Addres return &minerInfo, nil } -//GetNetworkVersion get network version +// GetNetworkVersion get network version func (vm *syscallsStateView) GetNetworkVersion(ctx context.Context, ce abi.ChainEpoch) network.Version { return vm.vmOption.NetworkVersion } -//GetNetworkVersion get network version +// GetNetworkVersion get network version func (vm *syscallsStateView) TotalFilCircSupply(height abi.ChainEpoch, st tree.Tree) (abi.TokenAmount, error) { return vm.GetCircSupply(context.TODO()) } diff --git a/pkg/vm/vmcontext/vmcontext.go b/pkg/vm/vmcontext/vmcontext.go index abc70dcd8a..84e0580474 100644 --- a/pkg/vm/vmcontext/vmcontext.go +++ b/pkg/vm/vmcontext/vmcontext.go @@ -729,7 +729,7 @@ func (vm *LegacyVM) clearSnapshot() { vm.State.ClearSnapshot() } -//nolint +// nolint func (vm *LegacyVM) Flush(ctx context.Context) (tree.Root, error) { // Flush all blocks out of the store if root, err := vm.State.Flush(vm.context); err != nil { diff --git a/pkg/vm/vmcontext/vmdebugger.go b/pkg/vm/vmcontext/vmdebugger.go index ac29df3ea9..04fc2747bb 100644 --- a/pkg/vm/vmcontext/vmdebugger.go +++ b/pkg/vm/vmcontext/vmdebugger.go @@ -6,7 +6,7 @@ import ( "strings" ) -//VMDebugMsg for vm debug +// VMDebugMsg for vm debug type VMDebugMsg struct { buf *strings.Builder } @@ -25,12 +25,12 @@ func (debug *VMDebugMsg) Println(args ...interface{}) { debug.buf.WriteString("\n") } -//WriteToTerminal write debug message to terminal +// WriteToTerminal write debug message to terminal func (debug *VMDebugMsg) WriteToTerminal() { fmt.Println(debug.buf.String()) } -//WriteToFile write debug message to file +// WriteToFile write debug message to file func (debug *VMDebugMsg) WriteToFile(fileName string) error { return ioutil.WriteFile(fileName, []byte(debug.buf.String()), 0777) } diff --git a/pkg/vmsupport/syscalls.go b/pkg/vmsupport/syscalls.go index 542ceddc35..a6bc8cbfc8 100644 --- a/pkg/vmsupport/syscalls.go +++ b/pkg/vmsupport/syscalls.go @@ -74,7 +74,7 @@ func (s *Syscalls) HashBlake2b(data []byte) [32]byte { return blake2b.Sum256(data) } -//ComputeUnsealedSectorCID Computes an unsealed sector CID (CommD) from its constituent piece CIDs (CommPs) and sizes. +// ComputeUnsealedSectorCID Computes an unsealed sector CID (CommD) from its constituent piece CIDs (CommPs) and sizes. func (s *Syscalls) ComputeUnsealedSectorCID(_ context.Context, proof abi.RegisteredSealProof, pieces []abi.PieceInfo) (cid.Cid, error) { return impl.GenerateUnsealedCID(proof, pieces) } @@ -93,7 +93,7 @@ func (s *Syscalls) VerifySeal(_ context.Context, info proof7.SealVerifyInfo) err var BatchSealVerifyParallelism = 2 * goruntime.NumCPU() -//BatchVerifySeals batch verify windows post +// BatchVerifySeals batch verify windows post func (s *Syscalls) BatchVerifySeals(ctx context.Context, vis map[address.Address][]proof7.SealVerifyInfo) (map[address.Address][]bool, error) { out := make(map[address.Address][]bool) @@ -138,7 +138,7 @@ func (s *Syscalls) VerifyAggregateSeals(aggregate proof7.AggregateSealVerifyProo return nil } -//VerifyPoSt verify windows post +// VerifyPoSt verify windows post func (s *Syscalls) VerifyPoSt(ctx context.Context, info proof7.WindowPoStVerifyInfo) error { ok, err := s.verifier.VerifyWindowPoSt(ctx, info) if err != nil { diff --git a/pkg/wallet/dsbackend.go b/pkg/wallet/dsbackend.go index 1e6d43bbef..5eb5ace640 100644 --- a/pkg/wallet/dsbackend.go +++ b/pkg/wallet/dsbackend.go @@ -243,7 +243,7 @@ func (backend *DSBackend) GetKeyInfo(ctx context.Context, addr address.Address) return key.KeyInfo, nil } -//GetKeyInfoPassphrase get private private key from wallet, get encrypt byte from db and decrypto it with password +// GetKeyInfoPassphrase get private private key from wallet, get encrypt byte from db and decrypto it with password func (backend *DSBackend) GetKeyInfoPassphrase(ctx context.Context, addr address.Address, password []byte) (*crypto.KeyInfo, error) { if !backend.HasAddress(ctx, addr) { return nil, errors.New("backend does not contain address") @@ -286,7 +286,7 @@ func (backend *DSBackend) LockWallet(ctx context.Context) error { return nil } -//UnLockWallet unlock wallet with password, decrypt local key in db and save to protected memory +// UnLockWallet unlock wallet with password, decrypt local key in db and save to protected memory func (backend *DSBackend) UnLockWallet(ctx context.Context, password []byte) error { defer func() { for i := range password { @@ -316,7 +316,7 @@ func (backend *DSBackend) UnLockWallet(ctx context.Context, password []byte) err return nil } -//SetPassword set password for wallet , and wallet used this password to encrypt private key +// SetPassword set password for wallet , and wallet used this password to encrypt private key func (backend *DSBackend) SetPassword(ctx context.Context, password []byte) error { if backend.password != nil { return ErrRepeatPassword @@ -340,12 +340,12 @@ func (backend *DSBackend) SetPassword(ctx context.Context, password []byte) erro return nil } -//HasPassword return whether the password has been set in the wallet +// HasPassword return whether the password has been set in the wallet func (backend *DSBackend) HasPassword() bool { return backend.password != nil } -//WalletState return wallet state(lock/unlock) +// WalletState return wallet state(lock/unlock) func (backend *DSBackend) WalletState(ctx context.Context) int { return backend.state } diff --git a/pkg/wallet/key.go b/pkg/wallet/key.go index 610138fbfd..786939774b 100644 --- a/pkg/wallet/key.go +++ b/pkg/wallet/key.go @@ -14,7 +14,7 @@ const ( version = 3 ) -//Key private key info +// Key private key info type Key struct { ID uuid.UUID // Version 4 "random" for unique id not derived from key data // to simplify lookups we also store the address diff --git a/pkg/wallet/wallet.go b/pkg/wallet/wallet.go index 5755505b44..9c61bc6eb4 100644 --- a/pkg/wallet/wallet.go +++ b/pkg/wallet/wallet.go @@ -225,7 +225,7 @@ func (w *Wallet) Export(ctx context.Context, addr address.Address, password stri return ki, nil } -//WalletSign used to sign message with private key +// WalletSign used to sign message with private key func (w *Wallet) WalletSign(ctx context.Context, addr address.Address, msg []byte, meta types.MsgMeta) (*crypto.Signature, error) { ki, err := w.Find(ctx, addr) if err != nil { @@ -238,8 +238,8 @@ func (w *Wallet) WalletSign(ctx context.Context, addr address.Address, msg []byt return ki.SignBytes(ctx, msg, addr) } -//DSBacked return the first wallet backend -//todo support multi wallet backend +// DSBacked return the first wallet backend +// todo support multi wallet backend func (w *Wallet) DSBacked() (*DSBackend, error) { backends := w.Backends(DSBackendType) if len(backends) == 0 { @@ -249,7 +249,7 @@ func (w *Wallet) DSBacked() (*DSBackend, error) { return (backends[0]).(*DSBackend), nil } -//LockWallet lock lock wallet +// LockWallet lock lock wallet func (w *Wallet) LockWallet(ctx context.Context) error { backend, err := w.DSBacked() if err != nil { @@ -269,7 +269,7 @@ func (w *Wallet) UnLockWallet(ctx context.Context, password []byte) error { return backend.UnLockWallet(ctx, password) } -//SetPassword +// SetPassword func (w *Wallet) SetPassword(ctx context.Context, password []byte) error { backend, err := w.DSBacked() if err != nil { @@ -278,7 +278,7 @@ func (w *Wallet) SetPassword(ctx context.Context, password []byte) error { return backend.SetPassword(ctx, password) } -//HasPassword return whether the password has been set in the wallet +// HasPassword return whether the password has been set in the wallet func (w *Wallet) HasPassword(ctx context.Context) bool { backend, err := w.DSBacked() if err != nil { @@ -288,7 +288,7 @@ func (w *Wallet) HasPassword(ctx context.Context) bool { return backend.HasPassword() } -//WalletState return wallet state(lock/unlock) +// WalletState return wallet state(lock/unlock) func (w *Wallet) WalletState(ctx context.Context) int { backend, err := w.DSBacked() if err != nil { diff --git a/tools/conformance/chaos/actor.go b/tools/conformance/chaos/actor.go index 91a490792e..d054246384 100644 --- a/tools/conformance/chaos/actor.go +++ b/tools/conformance/chaos/actor.go @@ -142,10 +142,10 @@ type CallerValidationArgs struct { // CallerValidation violates VM call validation constraints. // -// CallerValidationBranchNone performs no validation. -// CallerValidationBranchTwice validates twice. -// CallerValidationBranchIsAddress validates caller against CallerValidationArgs.Addrs. -// CallerValidationBranchIsType validates caller against CallerValidationArgs.Types. +// CallerValidationBranchNone performs no validation. +// CallerValidationBranchTwice validates twice. +// CallerValidationBranchIsAddress validates caller against CallerValidationArgs.Addrs. +// CallerValidationBranchIsType validates caller against CallerValidationArgs.Types. func (a Actor) CallerValidation(rt runtime2.Runtime, args *CallerValidationArgs) *abi.EmptyValue { switch args.Branch { case CallerValidationBranchNone: diff --git a/tools/seed/index.go b/tools/seed/index.go index d03e9f3962..e52e6f4777 100644 --- a/tools/seed/index.go +++ b/tools/seed/index.go @@ -1,5 +1,6 @@ package seed // ID identifies sector storage by UUID. One sector storage should map to one -// filesystem, local or networked / shared by multiple machines +// +// filesystem, local or networked / shared by multiple machines type ID string diff --git a/venus-component/libp2p/exchange/doc.go b/venus-component/libp2p/exchange/doc.go index b20ee0c1fe..21abc38c4b 100644 --- a/venus-component/libp2p/exchange/doc.go +++ b/venus-component/libp2p/exchange/doc.go @@ -10,8 +10,8 @@ // A client can also pass options, encoded as a 64-bit bitfield. Lotus supports // two options at the moment: // -// - include block contents -// - include block messages +// - include block contents +// - include block messages // // The response will include a status code, an optional message, and the // response payload in case of success. The payload is a slice of serialized diff --git a/venus-devtool/compatible/actors/templates.go b/venus-devtool/compatible/actors/templates.go index 104a415be5..af3e5944e5 100644 --- a/venus-devtool/compatible/actors/templates.go +++ b/venus-devtool/compatible/actors/templates.go @@ -45,6 +45,8 @@ var replacers = [][2]string{ }, {"\"golang.org/x/xerrors\"", "\"fmt\""}, {"xerrors.Errorf", "fmt.Errorf"}, + // fixed: actors/builtin/miner/state.v9.go:61:10: fmt.Errorf format %w has arg r of wrong type interface{} + {"failed to get available balance: %w", "failed to get available balance: %v"}, } func findActorsPkgDir() (string, error) { diff --git a/venus-devtool/util/api_meta.go b/venus-devtool/util/api_meta.go index bcee1e55d4..a43640adec 100644 --- a/venus-devtool/util/api_meta.go +++ b/venus-devtool/util/api_meta.go @@ -7,8 +7,8 @@ import ( "github.com/filecoin-project/lotus/api/v0api" "github.com/filecoin-project/lotus/api/v1api" - "github.com/filecoin-project/venus/venus-shared/api/chain/v0" - "github.com/filecoin-project/venus/venus-shared/api/chain/v1" + v0 "github.com/filecoin-project/venus/venus-shared/api/chain/v0" + v1 "github.com/filecoin-project/venus/venus-shared/api/chain/v1" ) var ChainAPIPairs = []struct { diff --git a/venus-shared/actors/builtin/miner/state.sep.go.template b/venus-shared/actors/builtin/miner/state.sep.go.template index f43d4098b6..55f372baa7 100644 --- a/venus-shared/actors/builtin/miner/state.sep.go.template +++ b/venus-shared/actors/builtin/miner/state.sep.go.template @@ -67,7 +67,7 @@ type partition{{.v}} struct { func (s *state{{.v}}) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) { defer func() { if r := recover(); r != nil { - err = fmt.Errorf("failed to get available balance: %w", r) + err = fmt.Errorf("failed to get available balance: %v", r) available = abi.NewTokenAmount(0) } }() diff --git a/venus-shared/actors/builtin/miner/state.v0.go b/venus-shared/actors/builtin/miner/state.v0.go index c2a380bcd9..349b39f2e0 100644 --- a/venus-shared/actors/builtin/miner/state.v0.go +++ b/venus-shared/actors/builtin/miner/state.v0.go @@ -59,7 +59,7 @@ type partition0 struct { func (s *state0) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) { defer func() { if r := recover(); r != nil { - err = fmt.Errorf("failed to get available balance: %w", r) + err = fmt.Errorf("failed to get available balance: %v", r) available = abi.NewTokenAmount(0) } }() diff --git a/venus-shared/actors/builtin/miner/state.v2.go b/venus-shared/actors/builtin/miner/state.v2.go index 124817ce99..74e551737b 100644 --- a/venus-shared/actors/builtin/miner/state.v2.go +++ b/venus-shared/actors/builtin/miner/state.v2.go @@ -57,7 +57,7 @@ type partition2 struct { func (s *state2) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) { defer func() { if r := recover(); r != nil { - err = fmt.Errorf("failed to get available balance: %w", r) + err = fmt.Errorf("failed to get available balance: %v", r) available = abi.NewTokenAmount(0) } }() diff --git a/venus-shared/actors/builtin/miner/state.v3.go b/venus-shared/actors/builtin/miner/state.v3.go index 9728adaede..b764b65e3c 100644 --- a/venus-shared/actors/builtin/miner/state.v3.go +++ b/venus-shared/actors/builtin/miner/state.v3.go @@ -59,7 +59,7 @@ type partition3 struct { func (s *state3) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) { defer func() { if r := recover(); r != nil { - err = fmt.Errorf("failed to get available balance: %w", r) + err = fmt.Errorf("failed to get available balance: %v", r) available = abi.NewTokenAmount(0) } }() diff --git a/venus-shared/actors/builtin/miner/state.v4.go b/venus-shared/actors/builtin/miner/state.v4.go index d83ebc194b..0c99ff9b0d 100644 --- a/venus-shared/actors/builtin/miner/state.v4.go +++ b/venus-shared/actors/builtin/miner/state.v4.go @@ -59,7 +59,7 @@ type partition4 struct { func (s *state4) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) { defer func() { if r := recover(); r != nil { - err = fmt.Errorf("failed to get available balance: %w", r) + err = fmt.Errorf("failed to get available balance: %v", r) available = abi.NewTokenAmount(0) } }() diff --git a/venus-shared/actors/builtin/miner/state.v5.go b/venus-shared/actors/builtin/miner/state.v5.go index 0dd3f59df5..bbe73b6609 100644 --- a/venus-shared/actors/builtin/miner/state.v5.go +++ b/venus-shared/actors/builtin/miner/state.v5.go @@ -59,7 +59,7 @@ type partition5 struct { func (s *state5) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) { defer func() { if r := recover(); r != nil { - err = fmt.Errorf("failed to get available balance: %w", r) + err = fmt.Errorf("failed to get available balance: %v", r) available = abi.NewTokenAmount(0) } }() diff --git a/venus-shared/actors/builtin/miner/state.v6.go b/venus-shared/actors/builtin/miner/state.v6.go index bae344a9bb..c903e6e2d5 100644 --- a/venus-shared/actors/builtin/miner/state.v6.go +++ b/venus-shared/actors/builtin/miner/state.v6.go @@ -59,7 +59,7 @@ type partition6 struct { func (s *state6) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) { defer func() { if r := recover(); r != nil { - err = fmt.Errorf("failed to get available balance: %w", r) + err = fmt.Errorf("failed to get available balance: %v", r) available = abi.NewTokenAmount(0) } }() diff --git a/venus-shared/actors/builtin/miner/state.v7.go b/venus-shared/actors/builtin/miner/state.v7.go index 117145f5a3..0fda2f2dd1 100644 --- a/venus-shared/actors/builtin/miner/state.v7.go +++ b/venus-shared/actors/builtin/miner/state.v7.go @@ -59,7 +59,7 @@ type partition7 struct { func (s *state7) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) { defer func() { if r := recover(); r != nil { - err = fmt.Errorf("failed to get available balance: %w", r) + err = fmt.Errorf("failed to get available balance: %v", r) available = abi.NewTokenAmount(0) } }() diff --git a/venus-shared/actors/builtin/miner/state.v8.go b/venus-shared/actors/builtin/miner/state.v8.go index 8dfebb363d..da78fb4fdb 100644 --- a/venus-shared/actors/builtin/miner/state.v8.go +++ b/venus-shared/actors/builtin/miner/state.v8.go @@ -58,7 +58,7 @@ type partition8 struct { func (s *state8) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) { defer func() { if r := recover(); r != nil { - err = fmt.Errorf("failed to get available balance: %w", r) + err = fmt.Errorf("failed to get available balance: %v", r) available = abi.NewTokenAmount(0) } }() diff --git a/venus-shared/actors/builtin/miner/state.v9.go b/venus-shared/actors/builtin/miner/state.v9.go index 251a4e0fcb..ea67b528e3 100644 --- a/venus-shared/actors/builtin/miner/state.v9.go +++ b/venus-shared/actors/builtin/miner/state.v9.go @@ -58,7 +58,7 @@ type partition9 struct { func (s *state9) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) { defer func() { if r := recover(); r != nil { - err = fmt.Errorf("failed to get available balance: %w", r) + err = fmt.Errorf("failed to get available balance: %v", r) available = abi.NewTokenAmount(0) } }() diff --git a/venus-shared/api/api_info.go b/venus-shared/api/api_info.go index eb50975231..710afc304d 100644 --- a/venus-shared/api/api_info.go +++ b/venus-shared/api/api_info.go @@ -45,7 +45,7 @@ func ParseApiInfo(s string) APIInfo { } } -//DialArgs parser libp2p address to http/ws protocol, the version argument can be override by address in version +// DialArgs parser libp2p address to http/ws protocol, the version argument can be override by address in version func (a APIInfo) DialArgs(version string) (string, error) { return DialArgs(a.Addr, version) } diff --git a/venus-shared/blockstore/blockstore.go b/venus-shared/blockstore/blockstore.go index 07d92219bf..2731044106 100644 --- a/venus-shared/blockstore/blockstore.go +++ b/venus-shared/blockstore/blockstore.go @@ -2,12 +2,12 @@ // blockstore not ultimately constructed out of the building blocks in this // package may not work properly. // -// * This package correctly wraps blockstores with the IdBlockstore. This blockstore: -// * Filters out all puts for blocks with CIDs using the "identity" hash function. -// * Extracts inlined blocks from CIDs using the identity hash function and -// returns them on get/has, ignoring the contents of the blockstore. -// * In the future, this package may enforce additional restrictions on block -// sizes, CID validity, etc. +// - This package correctly wraps blockstores with the IdBlockstore. This blockstore: +// - Filters out all puts for blocks with CIDs using the "identity" hash function. +// - Extracts inlined blocks from CIDs using the identity hash function and +// returns them on get/has, ignoring the contents of the blockstore. +// - In the future, this package may enforce additional restrictions on block +// sizes, CID validity, etc. // // To make auditing for misuse of blockstores tractable, this package re-exports // parts of the go-ipfs-blockstore package such that no other package needs to @@ -54,7 +54,7 @@ type Blockstore interface { } // Alias so other packages don't have to import go-ipfs-blockstore -//type Blockstore = blockstore.Blockstore +// type Blockstore = blockstore.Blockstore type Viewer = blockstore.Viewer type GCBlockstore = blockstore.GCBlockstore type CacheOpts = blockstore.CacheOpts diff --git a/venus-shared/libp2p/exchange/exchange.go b/venus-shared/libp2p/exchange/exchange.go index eea7db019f..af2e8e8711 100644 --- a/venus-shared/libp2p/exchange/exchange.go +++ b/venus-shared/libp2p/exchange/exchange.go @@ -16,11 +16,11 @@ const ( ) // FIXME: Bumped from original 800 to this to accommodate `syncFork()` -// use of `GetBlocks()`. It seems the expectation of that API is to -// fetch any amount of blocks leaving it to the internal logic here -// to partition and reassemble the requests if they go above the maximum. -// (Also as a consequence of this temporarily removing the `const` -// qualifier to avoid "const initializer [...] is not a constant" error.) +// use of `GetBlocks()`. It seems the expectation of that API is to +// fetch any amount of blocks leaving it to the internal logic here +// to partition and reassemble the requests if they go above the maximum. +// (Also as a consequence of this temporarily removing the `const` +// qualifier to avoid "const initializer [...] is not a constant" error.) var MaxRequestLength = uint64(policy.ChainFinality) // FIXME: Rename. Make private. @@ -135,11 +135,12 @@ type BSTipSet struct { // `BlsIncludes`/`SecpkIncludes` matches `Bls`/`Secpk` messages // to blocks in the tipsets with the format: // `BlsIncludes[BI][MI]` -// * BI: block index in the tipset. -// * MI: message index in `Bls` list +// - BI: block index in the tipset. +// - MI: message index in `Bls` list // // FIXME: The logic to decompress this structure should belong -// to itself, not to the consumer. +// +// to itself, not to the consumer. type CompactedMessages struct { Bls []*types.Message BlsIncludes [][]uint64 diff --git a/venus-shared/types/market/client/data.go b/venus-shared/types/market/client/data.go index 10a66da0df..3a38e2d2f1 100644 --- a/venus-shared/types/market/client/data.go +++ b/venus-shared/types/market/client/data.go @@ -10,10 +10,10 @@ import ( ) // DataSelector specifies ipld selector string -// - if the string starts with '{', it's interpreted as json selector string -// see https://ipld.io/specs/selectors/ and https://ipld.io/specs/selectors/fixtures/selector-fixtures-1/ -// - otherwise the string is interpreted as ipld-selector-text-lite (simple ipld path) -// see https://github.com/ipld/go-ipld-selector-text-lite +// - if the string starts with '{', it's interpreted as json selector string +// see https://ipld.io/specs/selectors/ and https://ipld.io/specs/selectors/fixtures/selector-fixtures-1/ +// - otherwise the string is interpreted as ipld-selector-text-lite (simple ipld path) +// see https://github.com/ipld/go-ipld-selector-text-lite type DataSelector string type FileRef struct { diff --git a/venus-shared/types/messager/message.go b/venus-shared/types/messager/message.go index fa6dccdb1d..9eaffcf03c 100644 --- a/venus-shared/types/messager/message.go +++ b/venus-shared/types/messager/message.go @@ -87,7 +87,7 @@ type Message struct { UpdatedAt time.Time } -//todo ignore use message MarshalJSON method +// todo ignore use message MarshalJSON method func (m *Message) MarshalJSON() ([]byte, error) { type msg struct { Version uint64