Skip to content

Commit

Permalink
chore: fix some typos in comments
Browse files Browse the repository at this point in the history
Signed-off-by: avoidalone <wuguangdong@outlook.com>
  • Loading branch information
avoidalone committed Apr 22, 2024
1 parent d0de0bd commit f78b389
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions pkg/chainsync/syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion pkg/consensus/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/market/fundmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/net/blocksub/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pkg/net/exchange/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions pkg/repo/fskeystore/fskeystore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down Expand Up @@ -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")
}
}

Expand Down Expand Up @@ -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")
}
}

Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pkg/repo/fskeystore/memkeystore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
2 changes: 1 addition & 1 deletion venus-component/libp2p/exchange/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion venus-shared/types/tipset_marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f78b389

Please sign in to comment.