From 9378d3ee573a27926c7a2402e63f8796cf8e7eb2 Mon Sep 17 00:00:00 2001 From: slightsharp Date: Fri, 23 Jan 2026 19:35:56 +0800 Subject: [PATCH] chore: fix some minor issues in the comments Signed-off-by: slightsharp --- cmd/integration-test-server/utils/utils.go | 2 +- ethstorage/data_shard.go | 4 ++-- ethstorage/miner/l1_mining_api.go | 2 +- ethstorage/p2p/protocol/peer.go | 2 +- ethstorage/pora/ethash/mmap_help_other.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/integration-test-server/utils/utils.go b/cmd/integration-test-server/utils/utils.go index 6d3806e6..296648ef 100644 --- a/cmd/integration-test-server/utils/utils.go +++ b/cmd/integration-test-server/utils/utils.go @@ -77,7 +77,7 @@ func checkMinedTsTooSmallError(logFile string) (int, error) { } func checkDiffNotMatchError(logFile string) (int, error) { - // Description: "Mining info retrieved" -> "Failed to submit mined result"; shard and block equal which difficulty is not the same + // Description: "Mining info retrieved" -> "Failed to submit mined result"; shard and block equal but difficulty is not the same // Sample: // lvl=info msg="Mining info retrieved" shard=1 block=6,906,682 difficulty=13,006,115 lastMineTime=1,729,375,716 proofsSubmitted=2 // lvl=eror msg="Failed to submit mined result" shard=1 block=6,906,682 difficulty=1,729,376,532 error="failed to estimate gas: execution reverted: ErrorData: 0x5b38d755: StorageContract_DifficultyNotMet()" diff --git a/ethstorage/data_shard.go b/ethstorage/data_shard.go index e86dec9e..c3226435 100644 --- a/ethstorage/data_shard.go +++ b/ethstorage/data_shard.go @@ -302,7 +302,7 @@ func DecodeChunk(chunkSize uint64, bs []byte, encodeType uint64, encodeKey commo func decodeChunk(chunkSize uint64, bs []byte, encodeType uint64, encodeKey common.Hash) []byte { if len(bs) > int(chunkSize) { - panic("cannot encode chunk with size > CHUNK_SIZE") + panic("cannot decode chunk with size > CHUNK_SIZE") } if encodeType == ENCODE_KECCAK_256 { output := make([]byte, len(bs)) @@ -380,7 +380,7 @@ func (ds *DataShard) WriteWith(kvIdx uint64, b []byte, commit common.Hash, encod return ds.WriteMeta(kvIdx, commit[:]) } -// Write a value of the KV to the store. The value will be encoded with kvIdx and SP address. +// Write a value of the KV to the store. The value will be encoded with kvIdx and SP address. func (ds *DataShard) Write(kvIdx uint64, b []byte, commit common.Hash) error { return ds.WriteWith(kvIdx, b, commit, func(cdata []byte, chunkIdx uint64) []byte { encodeKey := calcEncodeKey(commit, chunkIdx, ds.Miner()) diff --git a/ethstorage/miner/l1_mining_api.go b/ethstorage/miner/l1_mining_api.go index ee1ac5ff..48410f2b 100644 --- a/ethstorage/miner/l1_mining_api.go +++ b/ethstorage/miner/l1_mining_api.go @@ -112,7 +112,7 @@ func (m *l1MiningAPI) GetMiningInfo(ctx context.Context, contract common.Address func (m *l1MiningAPI) GetDataHashes(ctx context.Context, contract common.Address, kvIdxes []uint64) ([]common.Hash, error) { metas, err := m.GetKvMetas(kvIdxes, rpc.LatestBlockNumber.Int64()) if err != nil { - m.lg.Error("Failed to get versioned hashs", "error", err) + m.lg.Error("Failed to get versioned hashes", "error", err) return nil, err } var hashes []common.Hash diff --git a/ethstorage/p2p/protocol/peer.go b/ethstorage/p2p/protocol/peer.go index 60ec55e2..b0276256 100644 --- a/ethstorage/p2p/protocol/peer.go +++ b/ethstorage/p2p/protocol/peer.go @@ -30,7 +30,7 @@ type Peer struct { lg log.Logger // Contextual lg with the peer id injected } -// NewPeer create a wrapper for a network connection and negotiated protocol version. +// NewPeer create a wrapper for a network connection and negotiated protocol version. func NewPeer(version uint, chainId *big.Int, peerId peer.ID, newStream newStreamFn, direction network.Direction, initRequestSize, minRequestSize uint64, shards map[common.Address][]uint64) *Peer { ctx, cancel := context.WithCancel(context.Background()) diff --git a/ethstorage/pora/ethash/mmap_help_other.go b/ethstorage/pora/ethash/mmap_help_other.go index 7b97778b..86586217 100644 --- a/ethstorage/pora/ethash/mmap_help_other.go +++ b/ethstorage/pora/ethash/mmap_help_other.go @@ -29,7 +29,7 @@ import ( // does not actually occupy the full declared size on disk. func ensureSize(f *os.File, size int64) error { // On systems which do not support fallocate, we merely truncate it. - // More robust alternatives would be to + // More robust alternatives would be to // - Use posix_fallocate, or // - explicitly fill the file with zeroes. return f.Truncate(size)