From f78b389452a5ffd2363fb4b5a0d039e61d9f8384 Mon Sep 17 00:00:00 2001 From: avoidalone Date: Mon, 22 Apr 2024 21:38:38 +0800 Subject: [PATCH] chore: fix some typos in comments Signed-off-by: avoidalone --- pkg/chainsync/syncer/syncer.go | 4 ++-- pkg/consensus/block_validator.go | 2 +- pkg/market/fundmanager.go | 2 +- pkg/net/blocksub/validator.go | 2 +- pkg/net/exchange/client.go | 2 +- pkg/repo/fskeystore/fskeystore_test.go | 12 ++++++------ pkg/repo/fskeystore/memkeystore_test.go | 6 +++--- venus-component/libp2p/exchange/client/client.go | 2 +- venus-shared/types/tipset_marshal.go | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/pkg/chainsync/syncer/syncer.go b/pkg/chainsync/syncer/syncer.go index 21d269eeff..2caf411156 100644 --- a/pkg/chainsync/syncer/syncer.go +++ b/pkg/chainsync/syncer/syncer.go @@ -673,7 +673,7 @@ func (syncer *Syncer) Head() *types.TipSet { // maybe this code should actually live in blocksync?? func zipTipSetAndMessages(bs blockstore.Blockstore, ts *types.TipSet, allbmsgs []*types.Message, allsmsgs []*types.SignedMessage, bmi, smi [][]uint64) (*types.FullTipSet, error) { if len(ts.Blocks()) != len(smi) || len(ts.Blocks()) != len(bmi) { - return nil, fmt.Errorf("msgincl length didnt match tipset size") + return nil, fmt.Errorf("msgincl length didn't match tipset size") } fts := &types.FullTipSet{} @@ -704,7 +704,7 @@ func zipTipSetAndMessages(bs blockstore.Blockstore, ts *types.TipSet, allbmsgs [ } if b.Messages != mrcid { - return nil, fmt.Errorf("messages didnt match message root in header for ts %s", ts.Key()) + return nil, fmt.Errorf("messages didn't match message root in header for ts %s", ts.Key()) } fb := &types.FullBlock{ diff --git a/pkg/consensus/block_validator.go b/pkg/consensus/block_validator.go index 1ff527905b..ccc33d29b4 100644 --- a/pkg/consensus/block_validator.go +++ b/pkg/consensus/block_validator.go @@ -915,7 +915,7 @@ func (bv *BlockValidator) checkBlockMessages(ctx context.Context, return fmt.Errorf("serialize tx meta failed: %v", err) } if blk.Messages != b.Cid() { - return fmt.Errorf("messages didnt match message root in header") + return fmt.Errorf("messages didn't match message root in header") } return nil } diff --git a/pkg/market/fundmanager.go b/pkg/market/fundmanager.go index ffdd7783bf..4d289e5787 100644 --- a/pkg/market/fundmanager.go +++ b/pkg/market/fundmanager.go @@ -561,7 +561,7 @@ func (a *fundedAddress) processWithdrawals(withdrawals []*fundRequest) (msgCid c return withdrawFundsCid, nil } -// asynchonously wait for results of message +// asynchronously wait for results of message func (a *fundedAddress) startWaitForResults(ctx context.Context, msgCid cid.Cid) { go func() { err := a.env.WaitMsg(a.ctx, msgCid) diff --git a/pkg/net/blocksub/validator.go b/pkg/net/blocksub/validator.go index a84ec1f34c..acb3537bab 100644 --- a/pkg/net/blocksub/validator.go +++ b/pkg/net/blocksub/validator.go @@ -27,7 +27,7 @@ type BlockHeaderValidator interface { ValidateBlockMsg(context.Context, *types.BlockMsg) pubsub.ValidationResult } -// NewBlockTopicValidator retruns a BlockTopicValidator using `bv` for message validation +// NewBlockTopicValidator returns a BlockTopicValidator using `bv` for message validation func NewBlockTopicValidator(bv BlockHeaderValidator, opts ...pubsub.ValidatorOpt) *BlockTopicValidator { return &BlockTopicValidator{ opts: opts, diff --git a/pkg/net/exchange/client.go b/pkg/net/exchange/client.go index d4f6413ac9..baa0c740bb 100644 --- a/pkg/net/exchange/client.go +++ b/pkg/net/exchange/client.go @@ -237,7 +237,7 @@ func (c *client) processResponse(req *exchange.Request, res *exchange.Response, // If we didn't request the headers they should have been provided // by the caller. if len(tipsets) < len(res.Chain) { - return nil, fmt.Errorf("not enought tipsets provided for message response validation, needed %d, have %d", len(res.Chain), len(tipsets)) + return nil, fmt.Errorf("not enough tipsets provided for message response validation, needed %d, have %d", len(res.Chain), len(tipsets)) } chain := make([]*exchange.BSTipSet, 0, resLength) for i, resChain := range res.Chain { diff --git a/pkg/repo/fskeystore/fskeystore_test.go b/pkg/repo/fskeystore/fskeystore_test.go index 1bafff4e8e..14cbd5d4c3 100644 --- a/pkg/repo/fskeystore/fskeystore_test.go +++ b/pkg/repo/fskeystore/fskeystore_test.go @@ -148,15 +148,15 @@ func TestKeystoreBasics(t *testing.T) { } if err := ks.Put("..///foo/", k1); err == nil { - t.Fatal("shouldnt be able to put a poorly named key") + t.Fatal("shouldn't be able to put a poorly named key") } if err := ks.Put("", k1); err == nil { - t.Fatal("shouldnt be able to put a key with no name") + t.Fatal("shouldn't be able to put a key with no name") } if err := ks.Put(".foo", k1); err == nil { - t.Fatal("shouldnt be able to put a key with a 'hidden' name") + t.Fatal("shouldn't be able to put a key with a 'hidden' name") } } @@ -205,7 +205,7 @@ func TestInvalidKeyFiles(t *testing.T) { } if _, err = ks.Has(".invalid"); err == nil { - t.Fatal("shouldnt be able to put a key with a 'hidden' name") + t.Fatal("shouldn't be able to put a key with a 'hidden' name") } } @@ -233,7 +233,7 @@ func TestMakeKeystoreNoDir(t *testing.T) { _, err := NewFSKeystore("/this/is/not/a/real/dir") if err == nil { - t.Fatal("shouldnt be able to make a keystore in a nonexistant directory") + t.Fatal("shouldn't be able to make a keystore in a nonexistant directory") } } @@ -264,7 +264,7 @@ func assertGetKey(ks Keystore, name string, exp []byte) error { } if !bytes.Equal(outK, exp) { - return fmt.Errorf("key we got out didnt match expectation") + return fmt.Errorf("key we got out didn't match expectation") } return nil diff --git a/pkg/repo/fskeystore/memkeystore_test.go b/pkg/repo/fskeystore/memkeystore_test.go index f3b989dd07..99b988aed5 100644 --- a/pkg/repo/fskeystore/memkeystore_test.go +++ b/pkg/repo/fskeystore/memkeystore_test.go @@ -90,14 +90,14 @@ func TestMemKeyStoreBasics(t *testing.T) { } if err := ks.Put("..///foo/", k1); err == nil { - t.Fatal("shouldnt be able to put a poorly named key") + t.Fatal("shouldn't be able to put a poorly named key") } if err := ks.Put("", k1); err == nil { - t.Fatal("shouldnt be able to put a key with no name") + t.Fatal("shouldn't be able to put a key with no name") } if err := ks.Put(".foo", k1); err == nil { - t.Fatal("shouldnt be able to put a key with a 'hidden' name") + t.Fatal("shouldn't be able to put a key with a 'hidden' name") } } diff --git a/venus-component/libp2p/exchange/client/client.go b/venus-component/libp2p/exchange/client/client.go index 0a5d1b21a6..8af2f87b0b 100644 --- a/venus-component/libp2p/exchange/client/client.go +++ b/venus-component/libp2p/exchange/client/client.go @@ -242,7 +242,7 @@ func (c *client) processResponse(req *exchange.Request, res *exchange.Response, // If we didn't request the headers they should have been provided // by the caller. if len(tipsets) < len(res.Chain) { - return nil, fmt.Errorf("not enought tipsets provided for message response validation, needed %d, have %d", len(res.Chain), len(tipsets)) + return nil, fmt.Errorf("not enough tipsets provided for message response validation, needed %d, have %d", len(res.Chain), len(tipsets)) } chain := make([]*exchange.BSTipSet, 0, resLength) for i, resChain := range res.Chain { diff --git a/venus-shared/types/tipset_marshal.go b/venus-shared/types/tipset_marshal.go index a6d178fc57..c3f2dbfbe4 100644 --- a/venus-shared/types/tipset_marshal.go +++ b/venus-shared/types/tipset_marshal.go @@ -16,7 +16,7 @@ type ExpTipSet struct { } func (ts *TipSet) MarshalJSON() ([]byte, error) { - // why didnt i just export the fields? Because the struct has methods with the + // why didn't i just export the fields? Because the struct has methods with the // same names already return json.Marshal(ExpTipSet{ Cids: ts.cids,