From c8a14a71d38bebd64a68bb5d09a687bb4b5d02a4 Mon Sep 17 00:00:00 2001 From: chuangjinglu Date: Tue, 28 Jan 2025 07:27:00 +0800 Subject: [PATCH] chore: fix some comments (#1591) Signed-off-by: chuangjinglu Co-authored-by: Alexey Kiselev --- pkg/consensus/blocks_validation.go | 2 +- pkg/proto/ethabi/methods_map.go | 2 +- pkg/proto/ethabi/unpack.go | 2 +- pkg/state/rewards_calculator.go | 2 +- pkg/state/snapshot_hasher_internal_test.go | 2 +- pkg/state/transaction_checker.go | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/consensus/blocks_validation.go b/pkg/consensus/blocks_validation.go index 905b5c01d..5936a73fd 100644 --- a/pkg/consensus/blocks_validation.go +++ b/pkg/consensus/blocks_validation.go @@ -261,7 +261,7 @@ func (cv *Validator) validateMinerAccount(block *proto.BlockHeader, blockHeight } minerAddr, err := proto.NewAddressFromPublicKey(cv.settings.AddressSchemeCharacter, block.GeneratorPublicKey) if err != nil { - return errors.Wrapf(err, "faield to get miner address from pub key %q", block.GeneratorPublicKey.String()) + return errors.Wrapf(err, "failed to get miner address from pub key %q", block.GeneratorPublicKey.String()) } blockMinerHasScript, err := cv.state.NewestAccountHasScript(minerAddr) if err != nil { diff --git a/pkg/proto/ethabi/methods_map.go b/pkg/proto/ethabi/methods_map.go index 3304b598c..60836136b 100644 --- a/pkg/proto/ethabi/methods_map.go +++ b/pkg/proto/ethabi/methods_map.go @@ -57,7 +57,7 @@ func newMethodsMapFromRideDAppMeta(dApp meta.DApp, parsePayments bool) (MethodsM continue // ignore ride callable with unsupported argument type } return MethodsMap{}, errors.Wrapf(err, - "failed to build ABI db from DApp metadata, verison %d", dApp.Version, + "failed to build ABI db from DApp metadata, version %d", dApp.Version, ) } methods[method.Sig.Selector()] = method diff --git a/pkg/proto/ethabi/unpack.go b/pkg/proto/ethabi/unpack.go index ecde45a18..a30543f49 100644 --- a/pkg/proto/ethabi/unpack.go +++ b/pkg/proto/ethabi/unpack.go @@ -88,7 +88,7 @@ func tryAsInt64(dataT DataType) (int64, error) { } } -// forEachUnpack iteratively unpack elements. +// forEachUnpackRideList iteratively unpack elements. func forEachUnpackRideList(t Type, output []byte, start, size int) (_ List, slotsReadTotal int, err error) { if t.T != SliceType { // here we can only handle slice type return nil, 0, errors.Errorf("abi: invalid type in slice unpacking stage") diff --git a/pkg/state/rewards_calculator.go b/pkg/state/rewards_calculator.go index 33631ed2b..173345b5a 100644 --- a/pkg/state/rewards_calculator.go +++ b/pkg/state/rewards_calculator.go @@ -90,7 +90,7 @@ func (c *rewardCalculator) performCalculation( } // sanity check if cnt := len(rewardAddresses); cnt > additionalAddressesCount { - panic(fmt.Sprintf("reward addresses count=%d is greater than additional addreses count which is %d", + panic(fmt.Sprintf("reward addresses count=%d is greater than additional addresses count which is %d", cnt, additionalAddressesCount, )) } diff --git a/pkg/state/snapshot_hasher_internal_test.go b/pkg/state/snapshot_hasher_internal_test.go index 937af4983..2199f3718 100644 --- a/pkg/state/snapshot_hasher_internal_test.go +++ b/pkg/state/snapshot_hasher_internal_test.go @@ -234,7 +234,7 @@ func BenchmarkTxSnapshotHasher(b *testing.B) { for j := 0; j < b.N; j++ { h, hErr := calculateTxSnapshotStateHash(hasher, txID, blockHeight, prevHash, txSnapshot) if hErr != nil { - b.Fatalf("error occured: %+v", err) + b.Fatalf("error occurred: %+v", err) } if h != expectedHash { b.Fatalf("expectedHash=%s != actual=%s", expectedHash.Hex(), h.Hex()) diff --git a/pkg/state/transaction_checker.go b/pkg/state/transaction_checker.go index fd7a36101..e1924eeae 100644 --- a/pkg/state/transaction_checker.go +++ b/pkg/state/transaction_checker.go @@ -1453,7 +1453,7 @@ func (tc *transactionChecker) tryCreateDAppEstimationUpdate( } treeEstimation, err := ride.EstimateTree(tree, currentEstimatorVersion) if err != nil { - return scriptEstimation{}, false, errors.Wrapf(err, "faield to estimate script by addr %q", scriptAddr) + return scriptEstimation{}, false, errors.Wrapf(err, "failed to estimate script by addr %q", scriptAddr) } return scriptEstimation{ currentEstimatorVersion: currentEstimatorVersion,