From 97c0bd8cb2aa58f23a5c7dde8c2d18d02c471928 Mon Sep 17 00:00:00 2001 From: Sebastian <159052459+sewqasreedas@users.noreply.github.com> Date: Tue, 19 Aug 2025 19:43:57 +0200 Subject: [PATCH] chore: fix typos (#25191) --- store/internal/maps/maps.go | 2 +- store/internal/proofs/convert.go | 2 +- store/internal/proofs/create.go | 2 +- store/internal/proofs/helpers.go | 2 +- store/internal/tree/hash.go | 2 +- store/listenkv/store.go | 6 +++--- store/prefix/store.go | 6 +++--- store/pruning/manager_test.go | 4 ++-- store/pruning/types/options.go | 2 +- store/rootmulti/store.go | 4 ++-- store/rootmulti/store_test.go | 2 +- store/snapshots/helpers_test.go | 2 +- store/snapshots/manager_test.go | 2 +- store/snapshots/types/snapshotter.go | 10 +++++----- 14 files changed, 24 insertions(+), 24 deletions(-) diff --git a/store/internal/maps/maps.go b/store/internal/maps/maps.go index 8077c20dce..34b2f09b7e 100644 --- a/store/internal/maps/maps.go +++ b/store/internal/maps/maps.go @@ -156,7 +156,7 @@ func (kv KVPair) Bytes() []byte { // * 8 bytes to Uvarint encode the length of the value // So preallocate for the worst case, which will in total // be a maximum of 14 bytes wasted, if len(key)=1, len(value)=1, - // but that's going to rare. + // but that's going to be rare. buf := make([]byte, 8+len(kv.Key)+8+len(kv.Value)) // Encode the key, prefixed with its length. diff --git a/store/internal/proofs/convert.go b/store/internal/proofs/convert.go index 98a34fdd8f..9faaa7ded9 100644 --- a/store/internal/proofs/convert.go +++ b/store/internal/proofs/convert.go @@ -67,7 +67,7 @@ func convertInnerOps(p *cmtprotocrypto.Proof) ([]*ics23.InnerOp, error) { } // buildPath returns a list of steps from leaf to root -// in each step, true means index is left side, false index is right side +// in each step, true means index is left side, false means index is right side // code adapted from merkle/simple_proof.go:computeHashFromAunts func buildPath(idx, total int64) []bool { if total < 2 { diff --git a/store/internal/proofs/create.go b/store/internal/proofs/create.go index 55874d99cd..4c1871dde8 100644 --- a/store/internal/proofs/create.go +++ b/store/internal/proofs/create.go @@ -15,7 +15,7 @@ var ( ) /* -CreateMembershipProof will produce a CommitmentProof that the given key (and queries value) exists in the map. +CreateMembershipProof will produce a CommitmentProof that the given key (and queried value) exists in the map. If the key doesn't exist in the tree, this will return an error. */ func CreateMembershipProof(data map[string][]byte, key []byte) (*ics23.CommitmentProof, error) { diff --git a/store/internal/proofs/helpers.go b/store/internal/proofs/helpers.go index b82c96fe9c..059bfd0e3c 100644 --- a/store/internal/proofs/helpers.go +++ b/store/internal/proofs/helpers.go @@ -55,7 +55,7 @@ func CalcRoot(data map[string][]byte) []byte { return root } -// GetKey this returns a key, on Left/Right/Middle +// GetKey returns a key, on Left/Right/Middle func GetKey(allkeys []string, loc Where) string { if loc == Left { return allkeys[0] diff --git a/store/internal/tree/hash.go b/store/internal/tree/hash.go index d48e9c47bb..3b9b356691 100644 --- a/store/internal/tree/hash.go +++ b/store/internal/tree/hash.go @@ -11,7 +11,7 @@ var ( innerPrefix = []byte{1} ) -// HashFromByteSlices computes a Merkle tree where the leaves are the byte slice, +// HashFromByteSlices computes a Merkle tree where the leaves are the byte slices, // in the provided order. It follows RFC-6962. func HashFromByteSlices(items [][]byte) []byte { return hashFromByteSlices(sha256.New(), items) diff --git a/store/listenkv/store.go b/store/listenkv/store.go index b08a6e3950..f9b6a1f6d9 100644 --- a/store/listenkv/store.go +++ b/store/listenkv/store.go @@ -52,19 +52,19 @@ func (s *Store) Has(key []byte) bool { } // Iterator implements the KVStore interface. It delegates the Iterator call -// the to the parent KVStore. +// to the parent KVStore. func (s *Store) Iterator(start, end []byte) types.Iterator { return s.iterator(start, end, true) } // ReverseIterator implements the KVStore interface. It delegates the -// ReverseIterator call the to the parent KVStore. +// ReverseIterator call to the parent KVStore. func (s *Store) ReverseIterator(start, end []byte) types.Iterator { return s.iterator(start, end, false) } // iterator facilitates iteration over a KVStore. It delegates the necessary -// calls to it's parent KVStore. +// calls to its parent KVStore. func (s *Store) iterator(start, end []byte, ascending bool) types.Iterator { var parent types.Iterator diff --git a/store/prefix/store.go b/store/prefix/store.go index 09c244889c..dec50ec0b6 100644 --- a/store/prefix/store.go +++ b/store/prefix/store.go @@ -12,8 +12,8 @@ import ( var _ types.KVStore = Store{} -// Store is similar with cometbft/cometbft/libs/db/prefix_db -// both gives access only to the limited subset of the store +// Store is similar to cometbft/cometbft/libs/db/prefix_db +// both give access only to the limited subset of the store // for convenience or safety type Store struct { parent types.KVStore @@ -75,7 +75,7 @@ func (s Store) Set(key, value []byte) { s.parent.Set(s.key(key), value) } -// Delete implements KVStore, calls delete on the parent store with the key prefixed with the prefix +// Delete implements KVStore, calls Delete on the parent store with the key prefixed with the prefix func (s Store) Delete(key []byte) { s.parent.Delete(s.key(key)) } diff --git a/store/pruning/manager_test.go b/store/pruning/manager_test.go index bba3d47c49..d5c8273187 100644 --- a/store/pruning/manager_test.go +++ b/store/pruning/manager_test.go @@ -153,12 +153,12 @@ func TestPruningHeight_Inputs(t *testing.T) { 0, types.PruningEverything, }, - "currentHeight is zero - prune everything - invalid currentHeight": { + "currentHeight is zero - prune everything - invalid currentHeight": { 0, 0, types.PruningEverything, }, - "currentHeight is positive but within keep recent- prune everything - not kept": { + "currentHeight is positive but within keep recent - prune everything - not kept": { keepRecent, 0, types.PruningEverything, diff --git a/store/pruning/types/options.go b/store/pruning/types/options.go index ff3d154d98..4afc01912c 100644 --- a/store/pruning/types/options.go +++ b/store/pruning/types/options.go @@ -32,7 +32,7 @@ const ( const ( // PruningDefault defines a pruning strategy where the last 362880 heights are // kept where to-be pruned heights are pruned at every 10th height. - // The last 362880 heights are kept(approximately 3.5 weeks worth of state) assuming the typical + // The last 362880 heights are kept (approximately 3.5 weeks worth of state) assuming the typical // block time is 6s. If these values do not match the applications' requirements, use the "custom" option. PruningDefault PruningStrategy = iota // PruningEverything defines a pruning strategy where all committed heights are diff --git a/store/rootmulti/store.go b/store/rootmulti/store.go index 3f4e5af06c..8b3c94e485 100644 --- a/store/rootmulti/store.go +++ b/store/rootmulti/store.go @@ -354,7 +354,7 @@ func moveKVStoreData(oldDB, newDB types.KVStore) error { // PruneSnapshotHeight prunes the given height according to the prune strategy. // If the strategy is PruneNothing, this is a no-op. -// For other strategies, this height is persisted until the snapshot is operated. +// For other strategies, this height is persisted until the snapshot is completed. func (rs *Store) PruneSnapshotHeight(height int64) { rs.pruningManager.HandleSnapshotHeight(height) } @@ -694,7 +694,7 @@ func (rs *Store) handlePruning(version int64) error { return rs.PruneStores(pruneHeight) } -// PruneStores prunes all history upto the specific height of the multi store. +// PruneStores prunes all history up to the specific height of the multi store. func (rs *Store) PruneStores(pruningHeight int64) (err error) { if pruningHeight <= 0 { rs.logger.Debug("pruning skipped, height is less than or equal to 0") diff --git a/store/rootmulti/store_test.go b/store/rootmulti/store_test.go index 90af171217..ee61a491e0 100644 --- a/store/rootmulti/store_test.go +++ b/store/rootmulti/store_test.go @@ -436,7 +436,7 @@ func TestMultiStoreRestart(t *testing.T) { reloadedCid := multi.LastCommitID() require.Equal(t, int64(4), reloadedCid.Version, "Reloaded CID is not the same as last flushed CID") - // Check that store1 and store2 retained date from 3rd commit + // Check that store1 and store2 retained data from 3rd commit store1 = multi.GetStoreByName("store1").(types.KVStore) val := store1.Get([]byte(k)) require.Equal(t, []byte(fmt.Sprintf("%s:%d", v, 3)), val, "Reloaded value not the same as last flushed value") diff --git a/store/snapshots/helpers_test.go b/store/snapshots/helpers_test.go index f35ea6babf..cb117fa087 100644 --- a/store/snapshots/helpers_test.go +++ b/store/snapshots/helpers_test.go @@ -63,7 +63,7 @@ func readChunks(chunks <-chan io.ReadCloser) [][]byte { return bodies } -// snapshotItems serialize a array of bytes as SnapshotItem_ExtensionPayload, and return the chunks. +// snapshotItems serialize an array of bytes as SnapshotItem_ExtensionPayload, and return the chunks. func snapshotItems(items [][]byte, ext snapshottypes.ExtensionSnapshotter) [][]byte { // copy the same parameters from the code snapshotChunkSize := uint64(10e6) diff --git a/store/snapshots/manager_test.go b/store/snapshots/manager_test.go index d1b5e69ef3..562742bf37 100644 --- a/store/snapshots/manager_test.go +++ b/store/snapshots/manager_test.go @@ -170,7 +170,7 @@ func TestManager_Restore(t *testing.T) { err = manager.Restore(types.Snapshot{Height: 3, Format: types.CurrentFormat, Hash: []byte{1, 2, 3}}) require.Error(t, err) - // Restore errors on chunk and chunkhashes mismatch + // Restore errors on chunk and chunk hashes mismatch err = manager.Restore(types.Snapshot{ Height: 3, Format: types.CurrentFormat, diff --git a/store/snapshots/types/snapshotter.go b/store/snapshots/types/snapshotter.go index 28c86b29d0..53a1594038 100644 --- a/store/snapshots/types/snapshotter.go +++ b/store/snapshots/types/snapshotter.go @@ -32,20 +32,20 @@ type Snapshotter interface { Restore(height uint64, format uint32, protoReader protoio.Reader) (SnapshotItem, error) } -// ExtensionPayloadReader read extension payloads, -// it returns io.EOF when reached either end of stream or the extension boundaries. +// ExtensionPayloadReader reads extension payloads, +// it returns io.EOF when it reaches either end of stream or the extension boundaries. type ExtensionPayloadReader = func() ([]byte, error) // ExtensionPayloadWriter is a helper to write extension payloads to underlying stream. type ExtensionPayloadWriter = func([]byte) error // ExtensionSnapshotter is an extension Snapshotter that is appended to the snapshot stream. -// ExtensionSnapshotter has an unique name and manages it's own internal formats. +// ExtensionSnapshotter has an unique name and manages its own internal formats. type ExtensionSnapshotter interface { // SnapshotName returns the name of snapshotter, it should be unique in the manager. SnapshotName() string - // SnapshotFormat returns the default format the extension snapshotter use to encode the + // SnapshotFormat returns the default format the extension snapshotter uses to encode the // payloads when taking a snapshot. // It's defined within the extension, different from the global format for the whole state-sync snapshot. SnapshotFormat() uint32 @@ -57,6 +57,6 @@ type ExtensionSnapshotter interface { SnapshotExtension(height uint64, payloadWriter ExtensionPayloadWriter) error // RestoreExtension restores an extension state snapshot, - // the payload reader returns `io.EOF` when reached the extension boundaries. + // the payload reader returns `io.EOF` when it reaches the extension boundaries. RestoreExtension(height uint64, format uint32, payloadReader ExtensionPayloadReader) error }