all: fix spelling mistakes (#25961)

This commit is contained in:
Martin Holst Swende 2022-10-11 09:37:00 +02:00 committed by GitHub
parent 7eafbec741
commit 5a02b2d6d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 64 additions and 64 deletions

@ -257,7 +257,7 @@ func merge(slice []Wallet, wallets ...Wallet) []Wallet {
return slice return slice
} }
// drop is the couterpart of merge, which looks up wallets from within the sorted // drop is the counterpart of merge, which looks up wallets from within the sorted
// cache and removes the ones specified. // cache and removes the ones specified.
func drop(slice []Wallet, wallets ...Wallet) []Wallet { func drop(slice []Wallet, wallets ...Wallet) []Wallet {
for _, wallet := range wallets { for _, wallet := range wallets {

@ -90,7 +90,7 @@ func (s *Suite) TestSnapGetAccountRange(t *utesting.T) {
{4000, s.chain.RootAt(0), zero, ffHash, 0, zero, zero}, {4000, s.chain.RootAt(0), zero, ffHash, 0, zero, zero},
// A 127 block old stateroot, expected to be served // A 127 block old stateroot, expected to be served
{4000, s.chain.RootAt(999 - 127), zero, ffHash, 77, firstKey, common.HexToHash("0xe4c6fdef5dd4e789a2612390806ee840b8ec0fe52548f8b4efe41abb20c37aac")}, {4000, s.chain.RootAt(999 - 127), zero, ffHash, 77, firstKey, common.HexToHash("0xe4c6fdef5dd4e789a2612390806ee840b8ec0fe52548f8b4efe41abb20c37aac")},
// A root which is not actually an account root, but a storage orot // A root which is not actually an account root, but a storage root
{4000, storageRoot, zero, ffHash, 0, zero, zero}, {4000, storageRoot, zero, ffHash, 0, zero, zero},
// And some non-sensical requests // And some non-sensical requests

@ -394,7 +394,7 @@ func (g Alloc) OnAccount(addr common.Address, dumpAccount state.DumpAccount) {
g[addr] = genesisAccount g[addr] = genesisAccount
} }
// saveFile marshalls the object to the given file // saveFile marshals the object to the given file
func saveFile(baseDir, filename string, data interface{}) error { func saveFile(baseDir, filename string, data interface{}) error {
b, err := json.MarshalIndent(data, "", " ") b, err := json.MarshalIndent(data, "", " ")
if err != nil { if err != nil {

@ -86,7 +86,7 @@ func (ap *testerAccountPool) sign(header *types.Header, signer string) {
copy(header.Extra[len(header.Extra)-extraSeal:], sig) copy(header.Extra[len(header.Extra)-extraSeal:], sig)
} }
// testerVote represents a single block signed by a parcitular account, where // testerVote represents a single block signed by a particular account, where
// the account may or may not have cast a Clique vote. // the account may or may not have cast a Clique vote.
type testerVote struct { type testerVote struct {
signer string signer string

@ -612,7 +612,7 @@ func (s *MatcherSession) Multiplex(batch int, wait time.Duration, mux chan chan
return return
case <-time.After(wait): case <-time.After(wait):
// Throttling up, fetch whatever's available // Throttling up, fetch whatever is available
} }
} }
// Allocate as much as we can handle and request servicing // Allocate as much as we can handle and request servicing

@ -29,7 +29,7 @@ import (
"github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/trie"
) )
// DumpConfig is a set of options to control what portions of the statewill be // DumpConfig is a set of options to control what portions of the state will be
// iterated and collected. // iterated and collected.
type DumpConfig struct { type DumpConfig struct {
SkipCode bool SkipCode bool

@ -136,7 +136,7 @@ func (stat *generateStats) progressAccounts(account common.Hash, done uint64) {
stat.head = account stat.head = account
} }
// finishAccounts updates the gemerator stats for the finished account range. // finishAccounts updates the generator stats for the finished account range.
func (stat *generateStats) finishAccounts(done uint64) { func (stat *generateStats) finishAccounts(done uint64) {
stat.lock.Lock() stat.lock.Lock()
defer stat.lock.Unlock() defer stat.lock.Unlock()

@ -276,7 +276,7 @@ func (fi *fastIterator) next(idx int) bool {
return false return false
} }
// The elem we're placing it next to has the same value, // The elem we're placing it next to has the same value,
// so whichever winds up on n+1 will need further iteraton // so whichever winds up on n+1 will need further iteration
clash = n + 1 clash = n + 1
return cur.priority < fi.iterators[n+1].priority return cur.priority < fi.iterators[n+1].priority

@ -819,7 +819,7 @@ func TestStorageIteratorDeletions(t *testing.T) {
// only spit out 200 values eventually. // only spit out 200 values eventually.
// //
// The value-fetching benchmark is easy on the binary iterator, since it never has to reach // The value-fetching benchmark is easy on the binary iterator, since it never has to reach
// down at any depth for retrieving the values -- all are on the toppmost layer // down at any depth for retrieving the values -- all are on the topmost layer
// //
// BenchmarkAccountIteratorTraversal/binary_iterator_keys-6 2239 483674 ns/op // BenchmarkAccountIteratorTraversal/binary_iterator_keys-6 2239 483674 ns/op
// BenchmarkAccountIteratorTraversal/binary_iterator_values-6 2403 501810 ns/op // BenchmarkAccountIteratorTraversal/binary_iterator_values-6 2403 501810 ns/op

@ -36,7 +36,7 @@ var (
snapAccountProveCounter = metrics.NewRegisteredCounter("state/snapshot/generation/duration/account/prove", nil) snapAccountProveCounter = metrics.NewRegisteredCounter("state/snapshot/generation/duration/account/prove", nil)
// snapAccountTrieReadCounter measures time spent on the account trie iteration // snapAccountTrieReadCounter measures time spent on the account trie iteration
snapAccountTrieReadCounter = metrics.NewRegisteredCounter("state/snapshot/generation/duration/account/trieread", nil) snapAccountTrieReadCounter = metrics.NewRegisteredCounter("state/snapshot/generation/duration/account/trieread", nil)
// snapAccountSnapReadCounter measues time spent on the snapshot account iteration // snapAccountSnapReadCounter measures time spent on the snapshot account iteration
snapAccountSnapReadCounter = metrics.NewRegisteredCounter("state/snapshot/generation/duration/account/snapread", nil) snapAccountSnapReadCounter = metrics.NewRegisteredCounter("state/snapshot/generation/duration/account/snapread", nil)
// snapAccountWriteCounter measures time spent on writing/updating/deleting accounts // snapAccountWriteCounter measures time spent on writing/updating/deleting accounts
snapAccountWriteCounter = metrics.NewRegisteredCounter("state/snapshot/generation/duration/account/write", nil) snapAccountWriteCounter = metrics.NewRegisteredCounter("state/snapshot/generation/duration/account/write", nil)

@ -166,7 +166,7 @@ func TestDiskLayerExternalInvalidationPartialFlatten(t *testing.T) {
if err := snaps.Cap(common.HexToHash("0x03"), 1); err != nil { if err := snaps.Cap(common.HexToHash("0x03"), 1); err != nil {
t.Fatalf("failed to merge accumulator onto disk: %v", err) t.Fatalf("failed to merge accumulator onto disk: %v", err)
} }
// Since the base layer was modified, ensure that data retrievald on the external reference fail // Since the base layer was modified, ensure that data retrievals on the external reference fail
if acc, err := ref.Account(common.HexToHash("0x01")); err != ErrSnapshotStale { if acc, err := ref.Account(common.HexToHash("0x01")); err != ErrSnapshotStale {
t.Errorf("stale reference returned account: %#x (err: %v)", acc, err) t.Errorf("stale reference returned account: %#x (err: %v)", acc, err)
} }
@ -224,7 +224,7 @@ func TestDiffLayerExternalInvalidationPartialFlatten(t *testing.T) {
if err := snaps.Cap(common.HexToHash("0x04"), 1); err != nil { if err := snaps.Cap(common.HexToHash("0x04"), 1); err != nil {
t.Fatalf("failed to flatten diff layer into accumulator: %v", err) t.Fatalf("failed to flatten diff layer into accumulator: %v", err)
} }
// Since the accumulator diff layer was modified, ensure that data retrievald on the external reference fail // Since the accumulator diff layer was modified, ensure that data retrievals on the external reference fail
if acc, err := ref.Account(common.HexToHash("0x01")); err != ErrSnapshotStale { if acc, err := ref.Account(common.HexToHash("0x01")); err != ErrSnapshotStale {
t.Errorf("stale reference returned account: %#x (err: %v)", acc, err) t.Errorf("stale reference returned account: %#x (err: %v)", acc, err)
} }

@ -667,7 +667,7 @@ func (s *StateDB) Copy() *StateDB {
// nil // nil
if object, exist := s.stateObjects[addr]; exist { if object, exist := s.stateObjects[addr]; exist {
// Even though the original object is dirty, we are not copying the journal, // Even though the original object is dirty, we are not copying the journal,
// so we need to make sure that anyside effect the journal would have caused // so we need to make sure that any side-effect the journal would have caused
// during a commit (or similar op) is already applied to the copy. // during a commit (or similar op) is already applied to the copy.
state.stateObjects[addr] = object.deepCopy(state) state.stateObjects[addr] = object.deepCopy(state)
@ -796,8 +796,8 @@ func (s *StateDB) Finalise(deleteEmptyObjects bool) {
// resurrect an account; but the snapshotter needs both events. // resurrect an account; but the snapshotter needs both events.
if s.snap != nil { if s.snap != nil {
s.snapDestructs[obj.addrHash] = struct{}{} // We need to maintain account deletions explicitly (will remain set indefinitely) s.snapDestructs[obj.addrHash] = struct{}{} // We need to maintain account deletions explicitly (will remain set indefinitely)
delete(s.snapAccounts, obj.addrHash) // Clear out any previously updated account data (may be recreated via a ressurrect) delete(s.snapAccounts, obj.addrHash) // Clear out any previously updated account data (may be recreated via a resurrect)
delete(s.snapStorage, obj.addrHash) // Clear out any previously updated storage data (may be recreated via a ressurrect) delete(s.snapStorage, obj.addrHash) // Clear out any previously updated storage data (may be recreated via a resurrect)
} }
} else { } else {
obj.finalise(true) // Prefetch slots in the background obj.finalise(true) // Prefetch slots in the background

@ -469,7 +469,7 @@ func (h *priceHeap) Pop() interface{} {
} }
// txPricedList is a price-sorted heap to allow operating on transactions pool // txPricedList is a price-sorted heap to allow operating on transactions pool
// contents in a price-incrementing way. It's built opon the all transactions // contents in a price-incrementing way. It's built upon the all transactions
// in txpool but only interested in the remote part. It means only remote transactions // in txpool but only interested in the remote part. It means only remote transactions
// will be considered for tracking, sorting, eviction, etc. // will be considered for tracking, sorting, eviction, etc.
// //

@ -65,7 +65,7 @@ var (
// configured for the transaction pool. // configured for the transaction pool.
ErrUnderpriced = errors.New("transaction underpriced") ErrUnderpriced = errors.New("transaction underpriced")
// ErrTxPoolOverflow is returned if the transaction pool is full and can't accpet // ErrTxPoolOverflow is returned if the transaction pool is full and can't accept
// another remote transaction. // another remote transaction.
ErrTxPoolOverflow = errors.New("txpool is full") ErrTxPoolOverflow = errors.New("txpool is full")
@ -850,7 +850,7 @@ func (pool *TxPool) AddLocals(txs []*types.Transaction) []error {
} }
// AddLocal enqueues a single local transaction into the pool if it is valid. This is // AddLocal enqueues a single local transaction into the pool if it is valid. This is
// a convenience wrapper aroundd AddLocals. // a convenience wrapper around AddLocals.
func (pool *TxPool) AddLocal(tx *types.Transaction) error { func (pool *TxPool) AddLocal(tx *types.Transaction) error {
errs := pool.AddLocals([]*types.Transaction{tx}) errs := pool.AddLocals([]*types.Transaction{tx})
return errs[0] return errs[0]

@ -2158,7 +2158,7 @@ func TestTransactionReplacementDynamicFee(t *testing.T) {
stages := []string{"pending", "queued"} stages := []string{"pending", "queued"}
for _, stage := range stages { for _, stage := range stages {
// Since state is empty, 0 nonce txs are "executable" and can go // Since state is empty, 0 nonce txs are "executable" and can go
// into pending immediately. 2 nonce txs are "happed // into pending immediately. 2 nonce txs are "gapped"
nonce := uint64(0) nonce := uint64(0)
if stage == "queued" { if stage == "queued" {
nonce = 2 nonce = 2

@ -935,7 +935,7 @@ func (c *bls12381Pairing) Run(input []byte) ([]byte, error) {
return nil, errBLS12381G2PointSubgroup return nil, errBLS12381G2PointSubgroup
} }
// Update pairing engine with G1 and G2 ponits // Update pairing engine with G1 and G2 points
e.AddPair(p1, p2) e.AddPair(p1, p2)
} }
// Prepare 32 byte output // Prepare 32 byte output

@ -48,7 +48,7 @@ func SigToPub(hash, sig []byte) (*ecdsa.PublicKey, error) {
// //
// This function is susceptible to chosen plaintext attacks that can leak // This function is susceptible to chosen plaintext attacks that can leak
// information about the private key that is used for signing. Callers must // information about the private key that is used for signing. Callers must
// be aware that the given digest cannot be chosen by an adversery. Common // be aware that the given digest cannot be chosen by an adversary. Common
// solution is to hash any input before calculating the signature. // solution is to hash any input before calculating the signature.
// //
// The produced signature is in the [R || S || V] format where V is 0 or 1. // The produced signature is in the [R || S || V] format where V is 0 or 1.

@ -105,7 +105,7 @@ type ConsensusAPI struct {
// problematic, so we will only track the head chain segment of a bad // problematic, so we will only track the head chain segment of a bad
// chain to allow discarding progressing bad chains and side chains, // chain to allow discarding progressing bad chains and side chains,
// without tracking too much bad data. // without tracking too much bad data.
invalidBlocksHits map[common.Hash]int // Emhemeral cache to track invalid blocks and their hit count invalidBlocksHits map[common.Hash]int // Ephemeral cache to track invalid blocks and their hit count
invalidTipsets map[common.Hash]*types.Header // Ephemeral cache to track invalid tipsets and their bad ancestor invalidTipsets map[common.Hash]*types.Header // Ephemeral cache to track invalid tipsets and their bad ancestor
invalidLock sync.Mutex // Protects the invalid maps from concurrent access invalidLock sync.Mutex // Protects the invalid maps from concurrent access

@ -632,7 +632,7 @@ func (q *queue) ExpireReceipts(peer string) int {
// lock is not obtained in here is that the parameters already need to access // lock is not obtained in here is that the parameters already need to access
// the queue, so they already need a lock anyway. // the queue, so they already need a lock anyway.
func (q *queue) expire(peer string, pendPool map[string]*fetchRequest, taskQueue *prque.Prque) int { func (q *queue) expire(peer string, pendPool map[string]*fetchRequest, taskQueue *prque.Prque) int {
// Retrieve the request being expired and log an error if it's non-existnet, // Retrieve the request being expired and log an error if it's non-existent,
// as there's no order of events that should lead to such expirations. // as there's no order of events that should lead to such expirations.
req := pendPool[peer] req := pendPool[peer]
if req == nil { if req == nil {

@ -35,7 +35,7 @@ import (
// scratchHeaders is the number of headers to store in a scratch space to allow // scratchHeaders is the number of headers to store in a scratch space to allow
// concurrent downloads. A header is about 0.5KB in size, so there is no worry // concurrent downloads. A header is about 0.5KB in size, so there is no worry
// about using too much memory. The only catch is that we can only validate gaps // about using too much memory. The only catch is that we can only validate gaps
// afer they're linked to the head, so the bigger the scratch space, the larger // after they're linked to the head, so the bigger the scratch space, the larger
// potential for invalid headers. // potential for invalid headers.
// //
// The current scratch space of 131072 headers is expected to use 64MB RAM. // The current scratch space of 131072 headers is expected to use 64MB RAM.

@ -154,7 +154,7 @@ type TxFetcher struct {
// broadcast without needing explicit request/reply round trips. // broadcast without needing explicit request/reply round trips.
waitlist map[common.Hash]map[string]struct{} // Transactions waiting for an potential broadcast waitlist map[common.Hash]map[string]struct{} // Transactions waiting for an potential broadcast
waittime map[common.Hash]mclock.AbsTime // Timestamps when transactions were added to the waitlist waittime map[common.Hash]mclock.AbsTime // Timestamps when transactions were added to the waitlist
waitslots map[string]map[common.Hash]struct{} // Waiting announcement sgroupped by peer (DoS protection) waitslots map[string]map[common.Hash]struct{} // Waiting announcements grouped by peer (DoS protection)
// Stage 2: Queue of transactions that waiting to be allocated to some peer // Stage 2: Queue of transactions that waiting to be allocated to some peer
// to be retrieved directly. // to be retrieved directly.
@ -218,7 +218,7 @@ func (f *TxFetcher) Notify(peer string, hashes []common.Hash) error {
txAnnounceInMeter.Mark(int64(len(hashes))) txAnnounceInMeter.Mark(int64(len(hashes)))
// Skip any transaction announcements that we already know of, or that we've // Skip any transaction announcements that we already know of, or that we've
// previously marked as cheap and discarded. This check is of course racey, // previously marked as cheap and discarded. This check is of course racy,
// because multiple concurrent notifies will still manage to pass it, but it's // because multiple concurrent notifies will still manage to pass it, but it's
// still valuable to check here because it runs concurrent to the internal // still valuable to check here because it runs concurrent to the internal
// loop, so anything caught here is time saved internally. // loop, so anything caught here is time saved internally.

@ -203,7 +203,7 @@ func (p *Peer) dispatcher() {
} }
case cancelOp := <-p.reqCancel: case cancelOp := <-p.reqCancel:
// Retrieve the pendign request to cancel and short circuit if it // Retrieve the pending request to cancel and short circuit if it
// has already been serviced and is not available anymore // has already been serviced and is not available anymore
req := pending[cancelOp.id] req := pending[cancelOp.id]
if req == nil { if req == nil {

@ -335,7 +335,7 @@ func testGetBlockBodies(t *testing.T, protocol uint) {
} }
// Run each of the tests and verify the results against the chain // Run each of the tests and verify the results against the chain
for i, tt := range tests { for i, tt := range tests {
// Collect the hashes to request, and the response to expectva // Collect the hashes to request, and the response to expect
var ( var (
hashes []common.Hash hashes []common.Hash
bodies []*BlockBody bodies []*BlockBody

@ -188,7 +188,7 @@ func (p *Peer) markTransaction(hash common.Hash) {
// not be managed directly. // not be managed directly.
// //
// The reasons this is public is to allow packages using this protocol to write // The reasons this is public is to allow packages using this protocol to write
// tests that directly send messages without having to do the asyn queueing. // tests that directly send messages without having to do the async queueing.
func (p *Peer) SendTransactions(txs types.Transactions) error { func (p *Peer) SendTransactions(txs types.Transactions) error {
// Mark all the transactions as known, but ensure we don't overflow our limits // Mark all the transactions as known, but ensure we don't overflow our limits
for _, tx := range txs { for _, tx := range txs {

@ -139,7 +139,7 @@ func HandleMessage(backend Backend, peer *Peer) error {
} }
defer msg.Discard() defer msg.Discard()
start := time.Now() start := time.Now()
// Track the emount of time it takes to serve the request and run the handler // Track the amount of time it takes to serve the request and run the handler
if metrics.Enabled { if metrics.Enabled {
h := fmt.Sprintf("%s/%s/%d/%#02x", p2p.HandleHistName, ProtocolName, peer.Version(), msg.Code) h := fmt.Sprintf("%s/%s/%d/%#02x", p2p.HandleHistName, ProtocolName, peer.Version(), msg.Code)
defer func(start time.Time) { defer func(start time.Time) {
@ -343,7 +343,7 @@ func ServiceGetStorageRangesQuery(chain *core.BlockChain, req *GetStorageRangesP
req.Bytes = softResponseLimit req.Bytes = softResponseLimit
} }
// TODO(karalabe): Do we want to enforce > 0 accounts and 1 account if origin is set? // TODO(karalabe): Do we want to enforce > 0 accounts and 1 account if origin is set?
// TODO(karalabe): - Logging locally is not ideal as remote faulst annoy the local user // TODO(karalabe): - Logging locally is not ideal as remote faults annoy the local user
// TODO(karalabe): - Dropping the remote peer is less flexible wrt client bugs (slow is better than non-functional) // TODO(karalabe): - Dropping the remote peer is less flexible wrt client bugs (slow is better than non-functional)
// Calculate the hard limit at which to abort, even if mid storage trie // Calculate the hard limit at which to abort, even if mid storage trie

@ -95,7 +95,7 @@ func TestHashRanges(t *testing.T) {
// meaningful space size for manual verification. // meaningful space size for manual verification.
// - The head being 0xff...f0, we have 14 hashes left in the space // - The head being 0xff...f0, we have 14 hashes left in the space
// - Chunking up 14 into 3 pieces is 4.(6), but we need the ceil of 5 to avoid a micro-last-chunk // - Chunking up 14 into 3 pieces is 4.(6), but we need the ceil of 5 to avoid a micro-last-chunk
// - Since the range is not divisible, the last interval will be shrter, capped at 0xff...f // - Since the range is not divisible, the last interval will be shorter, capped at 0xff...f
// - The chunk ranges thus needs to be [..0, ..5], [..6, ..b], [..c, ..f] // - The chunk ranges thus needs to be [..0, ..5], [..6, ..b], [..c, ..f]
{ {
head: common.HexToHash("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0"), head: common.HexToHash("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0"),

@ -70,7 +70,7 @@ const (
// and waste round trip times. If it's too high, we're capping responses and // and waste round trip times. If it's too high, we're capping responses and
// waste bandwidth. // waste bandwidth.
// //
// Depoyed bytecodes are currently capped at 24KB, so the minimum request // Deployed bytecodes are currently capped at 24KB, so the minimum request
// size should be maxRequestSize / 24K. Assuming that most contracts do not // size should be maxRequestSize / 24K. Assuming that most contracts do not
// come close to that, requesting 4x should be a good approximation. // come close to that, requesting 4x should be a good approximation.
maxCodeRequestCount = maxRequestSize / (24 * 1024) * 4 maxCodeRequestCount = maxRequestSize / (24 * 1024) * 4
@ -87,8 +87,8 @@ const (
trienodeHealRateMeasurementImpact = 0.005 trienodeHealRateMeasurementImpact = 0.005
// minTrienodeHealThrottle is the minimum divisor for throttling trie node // minTrienodeHealThrottle is the minimum divisor for throttling trie node
// heal requests to avoid overloading the local node and exessively expanding // heal requests to avoid overloading the local node and excessively expanding
// the state trie bedth wise. // the state trie breadth wise.
minTrienodeHealThrottle = 1 minTrienodeHealThrottle = 1
// maxTrienodeHealThrottle is the maximum divisor for throttling trie node // maxTrienodeHealThrottle is the maximum divisor for throttling trie node

@ -138,7 +138,7 @@ func testCallTracer(tracerName string, dirPath string, t *testing.T) {
if _, err = st.TransitionDb(); err != nil { if _, err = st.TransitionDb(); err != nil {
t.Fatalf("failed to execute transaction: %v", err) t.Fatalf("failed to execute transaction: %v", err)
} }
// Retrieve the trace result and compare against the etalon // Retrieve the trace result and compare against the expected.
res, err := tracer.GetResult() res, err := tracer.GetResult()
if err != nil { if err != nil {
t.Fatalf("failed to retrieve trace result: %v", err) t.Fatalf("failed to retrieve trace result: %v", err)

@ -122,7 +122,7 @@ func testPrestateDiffTracer(tracerName string, dirPath string, t *testing.T, typ
if _, err = st.TransitionDb(); err != nil { if _, err = st.TransitionDb(); err != nil {
t.Fatalf("failed to execute transaction: %v", err) t.Fatalf("failed to execute transaction: %v", err)
} }
// Retrieve the trace result and compare against the etalon // Retrieve the trace result and compare against the expected
res, err := tracer.GetResult() res, err := tracer.GetResult()
if err != nil { if err != nil {
t.Fatalf("failed to retrieve trace result: %v", err) t.Fatalf("failed to retrieve trace result: %v", err)

@ -6,7 +6,7 @@ import (
"strings" "strings"
"unicode" "unicode"
// Force-load native and js pacakges, to trigger registration // Force-load native and js packages, to trigger registration
_ "github.com/ethereum/go-ethereum/eth/tracers/js" _ "github.com/ethereum/go-ethereum/eth/tracers/js"
_ "github.com/ethereum/go-ethereum/eth/tracers/native" _ "github.com/ethereum/go-ethereum/eth/tracers/native"
) )

@ -392,7 +392,7 @@ func testTransactionInBlockInterrupted(t *testing.T, client *rpc.Client) {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
// Test tx in block interupted. // Test tx in block interrupted.
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
cancel() cancel()
tx, err := ec.TransactionInBlock(ctx, block.Hash(), 0) tx, err := ec.TransactionInBlock(ctx, block.Hash(), 0)

@ -456,7 +456,7 @@ func (s *PersonalAccountAPI) signTransaction(ctx context.Context, args *Transact
// passwd isn't able to decrypt the key it fails. // passwd isn't able to decrypt the key it fails.
func (s *PersonalAccountAPI) SendTransaction(ctx context.Context, args TransactionArgs, passwd string) (common.Hash, error) { func (s *PersonalAccountAPI) SendTransaction(ctx context.Context, args TransactionArgs, passwd string) (common.Hash, error) {
if args.Nonce == nil { if args.Nonce == nil {
// Hold the addresse's mutex around signing to prevent concurrent assignment of // Hold the mutex around signing to prevent concurrent assignment of
// the same nonce to multiple accounts. // the same nonce to multiple accounts.
s.nonceLock.LockAddr(args.from()) s.nonceLock.LockAddr(args.from())
defer s.nonceLock.UnlockAddr(args.from()) defer s.nonceLock.UnlockAddr(args.from())
@ -1719,7 +1719,7 @@ func (s *TransactionAPI) SendTransaction(ctx context.Context, args TransactionAr
} }
if args.Nonce == nil { if args.Nonce == nil {
// Hold the addresse's mutex around signing to prevent concurrent assignment of // Hold the mutex around signing to prevent concurrent assignment of
// the same nonce to multiple accounts. // the same nonce to multiple accounts.
s.nonceLock.LockAddr(args.from()) s.nonceLock.LockAddr(args.from())
defer s.nonceLock.UnlockAddr(args.from()) defer s.nonceLock.UnlockAddr(args.from())

@ -95,7 +95,7 @@ func Info() (version, vcs string) {
// versionInfo returns version information for the currently executing // versionInfo returns version information for the currently executing
// implementation. // implementation.
// //
// Depending on how the code is instansiated, it returns different amounts of // Depending on how the code is instantiated, it returns different amounts of
// information. If it is unable to determine which module is related to our // information. If it is unable to determine which module is related to our
// package it falls back to the hardcoded values in the params package. // package it falls back to the hardcoded values in the params package.
func versionInfo(info *debug.BuildInfo) string { func versionInfo(info *debug.BuildInfo) string {

@ -142,7 +142,7 @@ func (r *resultStore) HasCompletedItems() bool {
// countCompleted returns the number of items ready for delivery, stopping at // countCompleted returns the number of items ready for delivery, stopping at
// the first non-complete item. // the first non-complete item.
// //
// The mthod assumes (at least) rlock is held. // The method assumes (at least) rlock is held.
func (r *resultStore) countCompleted() int { func (r *resultStore) countCompleted() int {
// We iterate from the already known complete point, and see // We iterate from the already known complete point, and see
// if any more has completed since last count // if any more has completed since last count

@ -282,7 +282,7 @@ func testInvalidAnnounces(t *testing.T, protocol int) {
peer.cpeer.sendAnnounce(announce) peer.cpeer.sendAnnounce(announce)
<-done // Wait syncing <-done // Wait syncing
// Ensure the bad peer is evicited // Ensure the bad peer is evicted
if c.handler.backend.peers.len() != 0 { if c.handler.backend.peers.len() != 0 {
t.Fatalf("Failed to evict invalid peer") t.Fatalf("Failed to evict invalid peer")
} }

@ -223,7 +223,7 @@ func (cm *ClientManager) processed(node *ClientNode, maxCost, realCost uint64, n
cm.updateBuffer(node, int64(maxCost-realCost), now) cm.updateBuffer(node, int64(maxCost-realCost), now)
} }
// updateBuffer recalulates the corrected buffer value, adds the given value to it // updateBuffer recalculates the corrected buffer value, adds the given value to it
// and updates the node's actual buffer value if possible // and updates the node's actual buffer value if possible
func (cm *ClientManager) updateBuffer(node *ClientNode, add int64, now mclock.AbsTime) { func (cm *ClientManager) updateBuffer(node *ClientNode, add int64, now mclock.AbsTime) {
cm.lock.Lock() cm.lock.Lock()

@ -119,7 +119,7 @@ func (h peerByTxHistory) Less(i, j int) bool {
func (h peerByTxHistory) Swap(i, j int) { h[i], h[j] = h[j], h[i] } func (h peerByTxHistory) Swap(i, j int) { h[i], h[j] = h[j], h[i] }
const ( const (
maxTxStatusRetry = 3 // The maximum retrys will be made for tx status request. maxTxStatusRetry = 3 // The maximum retries will be made for tx status request.
maxTxStatusCandidates = 5 // The maximum les servers the tx status requests will be sent to. maxTxStatusCandidates = 5 // The maximum les servers the tx status requests will be sent to.
) )

@ -434,7 +434,7 @@ func handleGetProofs(msg Decoder) (serveRequestFn, uint64, uint64, error) {
continue continue
} }
} }
// Prove the user's request from the account or stroage trie // Prove the user's request from the account or storage trie
if err := trie.Prove(request.Key, request.FromLevel, nodes); err != nil { if err := trie.Prove(request.Key, request.FromLevel, nodes); err != nil {
p.Log().Warn("Failed to prove state request", "block", header.Number, "hash", header.Hash(), "err", err) p.Log().Warn("Failed to prove state request", "block", header.Number, "hash", header.Hash(), "err", err)
continue continue

@ -53,7 +53,7 @@ var (
// each client can have several minutes of connection time. // each client can have several minutes of connection time.
// //
// Balances of disconnected clients are stored in nodeDB including positive balance // Balances of disconnected clients are stored in nodeDB including positive balance
// and negative banalce. Boeth positive balance and negative balance will decrease // and negative balance. Both positive balance and negative balance will decrease
// exponentially. If the balance is low enough, then the record will be dropped. // exponentially. If the balance is low enough, then the record will be dropped.
type ClientPool struct { type ClientPool struct {
*priorityPool *priorityPool

@ -182,7 +182,7 @@ func (pool *TxPool) checkMinedTxs(ctx context.Context, hash common.Hash, number
} }
// If some transactions have been mined, write the needed data to disk and update // If some transactions have been mined, write the needed data to disk and update
if list != nil { if list != nil {
// Retrieve all the receipts belonging to this block and write the loopup table // Retrieve all the receipts belonging to this block and write the lookup table
if _, err := GetBlockReceipts(ctx, pool.odr, hash, number); err != nil { // ODR caches, ignore results if _, err := GetBlockReceipts(ctx, pool.odr, hash, number); err != nil { // ODR caches, ignore results
return err return err
} }

@ -169,7 +169,7 @@ func makeTransaction(nonce uint64, privKey *ecdsa.PrivateKey, signer types.Signe
if baseFee == nil { if baseFee == nil {
baseFee = new(big.Int).SetInt64(int64(rand.Int31())) baseFee = new(big.Int).SetInt64(int64(rand.Int31()))
} }
// Generate the feecap, 75% valid feecap and 25% unguaranted. // Generate the feecap, 75% valid feecap and 25% unguaranteed.
var gasFeeCap *big.Int var gasFeeCap *big.Int
if rand.Intn(4) == 0 { if rand.Intn(4) == 0 {
rand.Read(buf) rand.Read(buf)

@ -31,7 +31,7 @@ import (
// Since it's impossible to get the arbitrary-ness converted between Go and mobile // Since it's impossible to get the arbitrary-ness converted between Go and mobile
// platforms, we're using explicit getters and setters for the conversions. There // platforms, we're using explicit getters and setters for the conversions. There
// is of course no point in enumerating everything, just enough to support the // is of course no point in enumerating everything, just enough to support the
// contract bindins requiring client side generated code. // contract bindings requiring client side generated code.
type Interface struct { type Interface struct {
object interface{} object interface{}
} }

@ -73,7 +73,7 @@ const rttMinConfidence = 0.1
const ttlScaling = 3 const ttlScaling = 3
// ttlLimit is the maximum timeout allowance to prevent reaching crazy numbers // ttlLimit is the maximum timeout allowance to prevent reaching crazy numbers
// if some unforeseen network events shappen. As much as we try to hone in on // if some unforeseen network events happen. As much as we try to hone in on
// the most optimal values, it doesn't make any sense to go above a threshold, // the most optimal values, it doesn't make any sense to go above a threshold,
// even if everything is slow and screwy. // even if everything is slow and screwy.
const ttlLimit = time.Minute const ttlLimit = time.Minute
@ -92,9 +92,9 @@ const tuningImpact = 0.25
// Tracker estimates the throughput capacity of a peer with regard to each data // Tracker estimates the throughput capacity of a peer with regard to each data
// type it can deliver. The goal is to dynamically adjust request sizes to max // type it can deliver. The goal is to dynamically adjust request sizes to max
// out network throughput without overloading either the peer or th elocal node. // out network throughput without overloading either the peer or the local node.
// //
// By tracking in real time the latencies and bandiwdths peers exhibit for each // By tracking in real time the latencies and bandwidths peers exhibit for each
// packet type, it's possible to prevent overloading by detecting a slowdown on // packet type, it's possible to prevent overloading by detecting a slowdown on
// one type when another type is pushed too hard. // one type when another type is pushed too hard.
// //
@ -214,7 +214,7 @@ type Trackers struct {
// confidence represents the probability that the estimated roundtrip value // confidence represents the probability that the estimated roundtrip value
// is the real one across all our peers. The confidence value is used as an // is the real one across all our peers. The confidence value is used as an
// impact factor of new measurements on old estimates. As our connectivity // impact factor of new measurements on old estimates. As our connectivity
// stabilizes, this value gravitates towards 1, new measurements havinng // stabilizes, this value gravitates towards 1, new measurements having
// almost no impact. If there's a large peer churn and few peers, then new // almost no impact. If there's a large peer churn and few peers, then new
// measurements will impact it more. The confidence is increased with every // measurements will impact it more. The confidence is increased with every
// packet and dropped with every new connection. // packet and dropped with every new connection.
@ -316,7 +316,7 @@ func (t *Trackers) medianRoundTrip() time.Duration {
} }
// MeanCapacities returns the capacities averaged across all the added trackers. // MeanCapacities returns the capacities averaged across all the added trackers.
// The purpos of the mean capacities are to initialize a new peer with some sane // The purpose of the mean capacities are to initialize a new peer with some sane
// starting values that it will hopefully outperform. If the mean overshoots, the // starting values that it will hopefully outperform. If the mean overshoots, the
// peer will be cut back to minimal capacity and given another chance. // peer will be cut back to minimal capacity and given another chance.
func (t *Trackers) MeanCapacities() map[uint64]float64 { func (t *Trackers) MeanCapacities() map[uint64]float64 {

@ -409,7 +409,7 @@ func (api *SignerAPI) List(ctx context.Context) ([]common.Address, error) {
// New creates a new password protected Account. The private key is protected with // New creates a new password protected Account. The private key is protected with
// the given password. Users are responsible to backup the private key that is stored // the given password. Users are responsible to backup the private key that is stored
// in the keystore location thas was specified when this API was created. // in the keystore location that was specified when this API was created.
func (api *SignerAPI) New(ctx context.Context) (common.Address, error) { func (api *SignerAPI) New(ctx context.Context) (common.Address, error) {
if be := api.am.Backends(keystore.KeyStoreType); len(be) == 0 { if be := api.am.Backends(keystore.KeyStoreType); len(be) == 0 {
return common.Address{}, errors.New("password based accounts not supported") return common.Address{}, errors.New("password based accounts not supported")
@ -635,7 +635,7 @@ func (api *SignerAPI) SignGnosisSafeTx(ctx context.Context, signerAddress common
gnosisTx.Signature = signature gnosisTx.Signature = signature
gnosisTx.SafeTxHash = common.BytesToHash(preimage) gnosisTx.SafeTxHash = common.BytesToHash(preimage)
gnosisTx.Sender = *checkSummedSender // Must be checksumed to be accepted by relay gnosisTx.Sender = *checkSummedSender // Must be checksummed to be accepted by relay
return &gnosisTx, nil return &gnosisTx, nil
} }

@ -179,7 +179,7 @@ func (f *fuzzer) fuzz() int {
return ok return ok
} }
// Fuzz is the fuzzing entryy-point. // Fuzz is the fuzzing entry-point.
// The function must return // The function must return
// //
// - 1 if the fuzzer should increase priority of the // - 1 if the fuzzer should increase priority of the

@ -22,7 +22,7 @@ import (
// Fuzz is the basic entry point for the go-fuzz tool // Fuzz is the basic entry point for the go-fuzz tool
// //
// This returns 1 for valid parsable/runable code, 0 // This returns 1 for valid parse:able/runnable code, 0
// for invalid opcode. // for invalid opcode.
func Fuzz(input []byte) int { func Fuzz(input []byte) int {
_, _, err := runtime.Execute(input, input, &runtime.Config{ _, _, err := runtime.Execute(input, input, &runtime.Config{

@ -373,7 +373,7 @@ func unset(parent node, child node, key []byte, pos int, removeLeft bool) error
if removeLeft { if removeLeft {
if bytes.Compare(cld.Key, key[pos:]) < 0 { if bytes.Compare(cld.Key, key[pos:]) < 0 {
// The key of fork shortnode is less than the path // The key of fork shortnode is less than the path
// (it belongs to the range), unset the entrie // (it belongs to the range), unset the entire
// branch. The parent must be a fullnode. // branch. The parent must be a fullnode.
fn := parent.(*fullNode) fn := parent.(*fullNode)
fn.Children[key[pos-1]] = nil fn.Children[key[pos-1]] = nil

@ -494,7 +494,7 @@ func (st *StackTrie) Hash() (h common.Hash) {
return h return h
} }
// Commit will firstly hash the entrie trie if it's still not hashed // Commit will firstly hash the entire trie if it's still not hashed
// and then commit all nodes to the associated database. Actually most // and then commit all nodes to the associated database. Actually most
// of the trie nodes MAY have been committed already. The main purpose // of the trie nodes MAY have been committed already. The main purpose
// here is to commit the root node. // here is to commit the root node.

@ -609,7 +609,7 @@ func benchUpdate(b *testing.B, e binary.ByteOrder) *Trie {
} }
// Benchmarks the trie hashing. Since the trie caches the result of any operation, // Benchmarks the trie hashing. Since the trie caches the result of any operation,
// we cannot use b.N as the number of hashing rouns, since all rounds apart from // we cannot use b.N as the number of hashing rounds, since all rounds apart from
// the first one will be NOOP. As such, we'll use b.N as the number of account to // the first one will be NOOP. As such, we'll use b.N as the number of account to
// insert into the trie before measuring the hashing. // insert into the trie before measuring the hashing.
// BenchmarkHash-6 288680 4561 ns/op 682 B/op 9 allocs/op // BenchmarkHash-6 288680 4561 ns/op 682 B/op 9 allocs/op
@ -644,7 +644,7 @@ func BenchmarkHash(b *testing.B) {
} }
// Benchmarks the trie Commit following a Hash. Since the trie caches the result of any operation, // Benchmarks the trie Commit following a Hash. Since the trie caches the result of any operation,
// we cannot use b.N as the number of hashing rouns, since all rounds apart from // we cannot use b.N as the number of hashing rounds, since all rounds apart from
// the first one will be NOOP. As such, we'll use b.N as the number of account to // the first one will be NOOP. As such, we'll use b.N as the number of account to
// insert into the trie before measuring the hashing. // insert into the trie before measuring the hashing.
func BenchmarkCommitAfterHash(b *testing.B) { func BenchmarkCommitAfterHash(b *testing.B) {