Skip to content

Commit 1843f27

Browse files
authored
all: fix some typos in comments and names (#31023)
1 parent 37c0e69 commit 1843f27

File tree

27 files changed

+79
-52
lines changed

27 files changed

+79
-52
lines changed

accounts/accounts.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ const (
214214
// of starting any background processes such as automatic key derivation.
215215
WalletOpened
216216

217-
// WalletDropped
217+
// WalletDropped is fired when a wallet is removed or disconnected, either via USB
218+
// or due to a filesystem event in the keystore. This event indicates that the wallet
219+
// is no longer available for operations.
218220
WalletDropped
219221
)
220222

cmd/devp2p/internal/ethtest/protocol.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//
1414
// You should have received a copy of the GNU General Public License
1515
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
16+
1617
package ethtest
1718

1819
import (

cmd/devp2p/internal/v4test/discv4tests.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func PingExtraData(t *utesting.T) {
194194
}
195195
}
196196

197-
// This test sends a PING packet with additional data and wrong 'from' field
197+
// PingExtraDataWrongFrom sends a PING packet with additional data and wrong 'from' field
198198
// and expects a PONG response.
199199
func PingExtraDataWrongFrom(t *utesting.T) {
200200
te := newTestEnv(Remote, Listen1, Listen2)
@@ -215,7 +215,7 @@ func PingExtraDataWrongFrom(t *utesting.T) {
215215
}
216216
}
217217

218-
// This test sends a PING packet with an expiration in the past.
218+
// PingPastExpiration sends a PING packet with an expiration in the past.
219219
// The remote node should not respond.
220220
func PingPastExpiration(t *utesting.T) {
221221
te := newTestEnv(Remote, Listen1, Listen2)
@@ -234,7 +234,7 @@ func PingPastExpiration(t *utesting.T) {
234234
}
235235
}
236236

237-
// This test sends an invalid packet. The remote node should not respond.
237+
// WrongPacketType sends an invalid packet. The remote node should not respond.
238238
func WrongPacketType(t *utesting.T) {
239239
te := newTestEnv(Remote, Listen1, Listen2)
240240
defer te.close()
@@ -252,7 +252,7 @@ func WrongPacketType(t *utesting.T) {
252252
}
253253
}
254254

255-
// This test verifies that the default behaviour of ignoring 'from' fields is unaffected by
255+
// BondThenPingWithWrongFrom verifies that the default behaviour of ignoring 'from' fields is unaffected by
256256
// the bonding process. After bonding, it pings the target with a different from endpoint.
257257
func BondThenPingWithWrongFrom(t *utesting.T) {
258258
te := newTestEnv(Remote, Listen1, Listen2)
@@ -289,7 +289,7 @@ waitForPong:
289289
}
290290
}
291291

292-
// This test just sends FINDNODE. The remote node should not reply
292+
// FindnodeWithoutEndpointProof sends FINDNODE. The remote node should not reply
293293
// because the endpoint proof has not completed.
294294
func FindnodeWithoutEndpointProof(t *utesting.T) {
295295
te := newTestEnv(Remote, Listen1, Listen2)
@@ -332,7 +332,7 @@ func BasicFindnode(t *utesting.T) {
332332
}
333333
}
334334

335-
// This test sends an unsolicited NEIGHBORS packet after the endpoint proof, then sends
335+
// UnsolicitedNeighbors sends an unsolicited NEIGHBORS packet after the endpoint proof, then sends
336336
// FINDNODE to read the remote table. The remote node should not return the node contained
337337
// in the unsolicited NEIGHBORS packet.
338338
func UnsolicitedNeighbors(t *utesting.T) {
@@ -373,7 +373,7 @@ func UnsolicitedNeighbors(t *utesting.T) {
373373
}
374374
}
375375

376-
// This test sends FINDNODE with an expiration timestamp in the past.
376+
// FindnodePastExpiration sends FINDNODE with an expiration timestamp in the past.
377377
// The remote node should not respond.
378378
func FindnodePastExpiration(t *utesting.T) {
379379
te := newTestEnv(Remote, Listen1, Listen2)
@@ -426,7 +426,7 @@ func bond(t *utesting.T, te *testenv) {
426426
}
427427
}
428428

429-
// This test attempts to perform a traffic amplification attack against a
429+
// FindnodeAmplificationInvalidPongHash attempts to perform a traffic amplification attack against a
430430
// 'victim' endpoint using FINDNODE. In this attack scenario, the attacker
431431
// attempts to complete the endpoint proof non-interactively by sending a PONG
432432
// with mismatching reply token from the 'victim' endpoint. The attack works if
@@ -478,7 +478,7 @@ func FindnodeAmplificationInvalidPongHash(t *utesting.T) {
478478
}
479479
}
480480

481-
// This test attempts to perform a traffic amplification attack using FINDNODE.
481+
// FindnodeAmplificationWrongIP attempts to perform a traffic amplification attack using FINDNODE.
482482
// The attack works if the remote node does not verify the IP address of FINDNODE
483483
// against the endpoint verification proof done by PING/PONG.
484484
func FindnodeAmplificationWrongIP(t *utesting.T) {

consensus/clique/snapshot_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,6 @@ func (tt *cliqueTest) run(t *testing.T) {
467467
for j := 0; j < len(batches)-1; j++ {
468468
if k, err := chain.InsertChain(batches[j]); err != nil {
469469
t.Fatalf("failed to import batch %d, block %d: %v", j, k, err)
470-
break
471470
}
472471
}
473472
if _, err = chain.InsertChain(batches[len(batches)-1]); err != tt.failure {

core/tracing/hooks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ const (
293293
GasChangeCallLeftOverRefunded GasChangeReason = 7
294294
// GasChangeCallContractCreation is the amount of gas that will be burned for a CREATE.
295295
GasChangeCallContractCreation GasChangeReason = 8
296-
// GasChangeContractCreation is the amount of gas that will be burned for a CREATE2.
296+
// GasChangeCallContractCreation2 is the amount of gas that will be burned for a CREATE2.
297297
GasChangeCallContractCreation2 GasChangeReason = 9
298298
// GasChangeCallCodeStorage is the amount of gas that will be charged for code storage.
299299
GasChangeCallCodeStorage GasChangeReason = 10

core/txpool/legacypool/legacypool2_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ func TestTransactionZAttack(t *testing.T) {
162162
var ivpendingNum int
163163
pendingtxs, _ := pool.Content()
164164
for account, txs := range pendingtxs {
165-
cur_balance := new(big.Int).Set(pool.currentState.GetBalance(account).ToBig())
165+
curBalance := new(big.Int).Set(pool.currentState.GetBalance(account).ToBig())
166166
for _, tx := range txs {
167-
if cur_balance.Cmp(tx.Value()) <= 0 {
167+
if curBalance.Cmp(tx.Value()) <= 0 {
168168
ivpendingNum++
169169
} else {
170-
cur_balance.Sub(cur_balance, tx.Value())
170+
curBalance.Sub(curBalance, tx.Value())
171171
}
172172
}
173173
}

core/types/deposit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const (
2424
depositRequestSize = 192
2525
)
2626

27-
// UnpackIntoDeposit unpacks a serialized DepositEvent.
27+
// DepositLogToRequest unpacks a serialized DepositEvent.
2828
func DepositLogToRequest(data []byte) ([]byte, error) {
2929
if len(data) != 576 {
3030
return nil, fmt.Errorf("deposit wrong length: want 576, have %d", len(data))

core/vm/eof_validation.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ func validateCode(code []byte, section int, container *Container, jt *JumpTable,
109109
return nil, err
110110
}
111111
case RJUMPV:
112-
max_size := int(code[i+1])
113-
length := max_size + 1
112+
maxSize := int(code[i+1])
113+
length := maxSize + 1
114114
if len(code) <= i+length {
115115
return nil, fmt.Errorf("%w: jump table truncated, op %s, pos %d", errTruncatedImmediate, op, i)
116116
}
@@ -120,7 +120,7 @@ func validateCode(code []byte, section int, container *Container, jt *JumpTable,
120120
return nil, err
121121
}
122122
}
123-
i += 2 * max_size
123+
i += 2 * maxSize
124124
case CALLF:
125125
arg, _ := parseUint16(code[i+1:])
126126
if arg >= len(container.types) {

core/vm/program/program.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// - There are not package guarantees. We might iterate heavily on this package, and do backwards-incompatible changes without warning
2020
// - There are no quality-guarantees. These utilities may produce evm-code that is non-functional. YMMV.
2121
// - There are no stability-guarantees. The utility will `panic` if the inputs do not align / make sense.
22+
2223
package program
2324

2425
import (
@@ -204,7 +205,7 @@ func (p *Program) StaticCall(gas *uint256.Int, address, inOffset, inSize, outOff
204205
return p.Op(vm.STATICCALL)
205206
}
206207

207-
// StaticCall is a convenience function to make a callcode. If 'gas' is nil, the opcode GAS will
208+
// CallCode is a convenience function to make a callcode. If 'gas' is nil, the opcode GAS will
208209
// be used to provide all gas.
209210
func (p *Program) CallCode(gas *uint256.Int, address, value, inOffset, inSize, outOffset, outSize any) *Program {
210211
if outOffset == outSize && inSize == outSize && inOffset == outSize {
@@ -263,7 +264,7 @@ func (p *Program) InputAddressToStack(inputOffset uint32) *Program {
263264
return p.Op(vm.AND)
264265
}
265266

266-
// MStore stores the provided data (into the memory area starting at memStart).
267+
// Mstore stores the provided data (into the memory area starting at memStart).
267268
func (p *Program) Mstore(data []byte, memStart uint32) *Program {
268269
var idx = 0
269270
// We need to store it in chunks of 32 bytes

crypto/blake2b/blake2b.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ import (
2323
)
2424

2525
const (
26-
// The blocksize of BLAKE2b in bytes.
26+
// BlockSize the blocksize of BLAKE2b in bytes.
2727
BlockSize = 128
28-
// The hash size of BLAKE2b-512 in bytes.
28+
// Size the hash size of BLAKE2b-512 in bytes.
2929
Size = 64
30-
// The hash size of BLAKE2b-384 in bytes.
30+
// Size384 the hash size of BLAKE2b-384 in bytes.
3131
Size384 = 48
32-
// The hash size of BLAKE2b-256 in bytes.
32+
// Size256 the hash size of BLAKE2b-256 in bytes.
3333
Size256 = 32
3434
)
3535

0 commit comments

Comments
 (0)