From eb53ed5a045ed98868ec7bbf2fc1ff1a4a617584 Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Wed, 14 Aug 2024 21:09:53 +0200 Subject: [PATCH] fix typos in all packages --- config/cspell-ts.json | 23 ++++++- package.json | 2 +- packages/block/src/from-beacon-payload.ts | 1 + packages/block/src/header/header.ts | 2 +- packages/block/src/helpers.ts | 1 + packages/block/src/params.ts | 2 +- packages/block/test/block.spec.ts | 4 +- packages/block/test/clique.spec.ts | 2 +- packages/block/test/eip4844block.spec.ts | 2 +- packages/block/test/eip4895block.spec.ts | 6 +- .../block/test/from-beacon-payload.spec.ts | 4 +- packages/block/test/from-rpc.spec.ts | 1 + packages/block/test/header.spec.ts | 1 + packages/block/test/mergeBlock.spec.ts | 2 +- packages/blockchain/src/blockchain.ts | 11 ++-- packages/blockchain/src/consensus/clique.ts | 3 +- packages/blockchain/src/db/constants.ts | 4 +- packages/blockchain/src/db/manager.ts | 2 +- packages/blockchain/src/types.ts | 4 +- packages/blockchain/test/clique.spec.ts | 1 + .../blockchain/test/customConsensus.spec.ts | 2 +- packages/blockchain/test/index.spec.ts | 3 +- packages/client/archive/libp2p/index.ts | 3 +- packages/client/archive/libp2p/libp2pnode.ts | 1 + .../archive/libp2p/net/peer/libp2pnode.ts | 1 + .../archive/libp2p/net/peer/libp2ppeer.ts | 11 ++-- .../archive/libp2p/net/server/libp2pserver.ts | 1 + packages/client/bin/cli.ts | 6 +- packages/client/src/config.ts | 7 ++- packages/client/src/execution/vmexecution.ts | 8 +-- packages/client/src/ext/jwt-simple.ts | 2 +- packages/client/src/ext/qheap.ts | 1 + packages/client/src/miner/miner.ts | 1 + packages/client/src/net/server/rlpxserver.ts | 1 + packages/client/src/rpc/index.ts | 4 +- packages/client/src/rpc/modules/admin.ts | 2 +- .../client/src/rpc/modules/engine/engine.ts | 2 +- .../src/rpc/modules/engine/util/getPayload.ts | 2 +- packages/client/src/rpc/validation.ts | 4 +- packages/client/src/service/skeleton.ts | 62 +++++++++---------- packages/client/src/service/txpool.ts | 2 +- .../client/src/sync/fetcher/accountfetcher.ts | 6 +- .../src/sync/fetcher/bytecodefetcher.ts | 10 +-- .../client/src/sync/fetcher/storagefetcher.ts | 12 ++-- .../src/sync/fetcher/trienodefetcher.ts | 8 +-- packages/client/src/sync/fetcher/types.ts | 2 +- packages/client/src/sync/snapsync.ts | 4 +- packages/client/src/util/parse.ts | 1 + packages/client/test/logging.spec.ts | 2 +- packages/client/test/miner/miner.spec.ts | 4 +- .../client/test/miner/pendingBlock.spec.ts | 2 +- .../test/net/protocol/snapprotocol.spec.ts | 2 +- .../rpc/engine/forkchoiceUpdatedV1.spec.ts | 2 +- .../test/rpc/engine/getPayloadV3.spec.ts | 2 +- .../client/test/rpc/engine/kaustinen6.spec.ts | 1 + .../test/rpc/engine/newPayloadV3.spec.ts | 4 +- .../client/test/rpc/engine/preimages.spec.ts | 2 +- .../test/rpc/engine/withdrawals.spec.ts | 2 +- .../getTransactionByBlockHashAndIndex.spec.ts | 2 +- packages/client/test/rpc/validation.spec.ts | 8 +-- .../test/service/fullethereumservice.spec.ts | 6 +- .../test/service/lightethereumservice.spec.ts | 2 +- .../client/test/sim/4844-blobpost.spec.ts | 2 +- packages/client/test/sim/simutils.ts | 3 +- packages/client/test/sim/txGenerator.ts | 1 + packages/client/test/sync/skeleton.spec.ts | 2 +- packages/client/test/sync/txpool.spec.ts | 2 +- packages/client/test/util/parse.spec.ts | 4 +- packages/common/src/common.ts | 6 +- packages/common/src/eips.ts | 2 +- packages/common/src/interfaces.ts | 2 +- packages/common/src/utils.ts | 1 + packages/common/test/chains.spec.ts | 2 +- packages/common/test/data/paramsTest.ts | 2 +- packages/common/test/hardforks.spec.ts | 3 +- packages/common/test/params.spec.ts | 8 +-- packages/common/test/utils.spec.ts | 2 +- packages/devp2p/src/dns/dns.ts | 2 +- packages/devp2p/src/dns/enr.ts | 15 ++--- packages/devp2p/src/dpt/server.ts | 1 + packages/devp2p/src/ext/kbucket.ts | 3 +- packages/devp2p/src/rlpx/ecies.ts | 9 +-- packages/devp2p/src/rlpx/rlpx.ts | 4 +- packages/devp2p/src/util.ts | 1 + packages/devp2p/test/dns.spec.ts | 4 +- packages/devp2p/test/enr.spec.ts | 4 +- packages/evm/scripts/eofContainerValidator.ts | 2 +- packages/evm/src/eof/errors.ts | 2 +- packages/evm/src/evm.ts | 4 +- packages/evm/src/interpreter.ts | 11 ++-- packages/evm/src/opcodes/util.ts | 4 +- packages/evm/src/params.ts | 7 ++- packages/evm/src/precompiles/05-modexp.ts | 1 + .../evm/src/precompiles/0d-bls12-g1msm.ts | 2 +- .../evm/src/precompiles/10-bls12-g2msm.ts | 2 +- .../evm/src/precompiles/bls12_381/noble.ts | 20 +++--- packages/evm/src/precompiles/bn254/noble.ts | 2 +- packages/evm/src/stack.ts | 2 +- packages/evm/test/customPrecompiles.spec.ts | 2 +- packages/evm/test/eips/eip-3860.spec.ts | 4 +- .../evm/test/precompiles/05-modexp.spec.ts | 4 +- packages/evm/test/runCall.spec.ts | 1 + packages/rlp/src/index.ts | 1 + packages/rlp/test/dataTypes.spec.ts | 10 +-- packages/rlp/test/invalid.spec.ts | 8 +-- packages/statemanager/src/cache/account.ts | 1 + packages/statemanager/src/cache/cache.ts | 1 + packages/statemanager/src/cache/code.ts | 1 + packages/statemanager/src/cache/storage.ts | 3 +- packages/statemanager/src/stateManager.ts | 4 +- .../src/statelessVerkleStateManager.ts | 2 +- .../statemanager/test/rpcStateManager.spec.ts | 3 +- packages/trie/benchmarks/suite.ts | 2 +- packages/trie/examples/logDemo.ts | 4 +- packages/trie/scripts/view.ts | 24 +++---- packages/trie/src/proof/range.ts | 2 +- packages/trie/src/trie.ts | 14 ++--- packages/trie/src/util/encoding.ts | 15 ++--- packages/trie/src/util/nibbles.ts | 1 + packages/trie/test/official.spec.ts | 2 +- packages/trie/test/proof.spec.ts | 17 ++--- packages/trie/test/proof/range.spec.ts | 4 +- packages/trie/test/trie/checkpoint.spec.ts | 2 +- packages/trie/test/trie/secure.spec.ts | 2 +- packages/trie/test/util/encodingUtils.spec.ts | 2 +- packages/trie/test/util/log.spec.ts | 2 +- packages/tx/examples/transactions.ts | 2 +- packages/tx/examples/txFactory.ts | 2 +- packages/tx/src/4844/constructors.ts | 4 +- packages/tx/test/eip3860.spec.ts | 4 +- packages/tx/test/eip4844.spec.ts | 2 +- packages/tx/test/fromRpc.spec.ts | 8 ++- packages/tx/test/legacy.spec.ts | 4 +- packages/tx/test/types.ts | 5 +- packages/util/examples/signature.ts | 4 +- packages/util/src/asyncEventEmitter.ts | 1 + packages/util/src/blobs.ts | 1 + packages/util/src/bytes.ts | 6 +- packages/util/src/internal.ts | 1 + packages/util/src/kzg.ts | 2 +- packages/util/src/types.ts | 4 +- packages/util/src/verkle.ts | 4 +- packages/util/src/withdrawal.ts | 2 +- packages/util/test/account.spec.ts | 9 +-- packages/util/test/bytes.spec.ts | 8 +-- packages/util/test/provider.spec.ts | 2 +- packages/util/test/signature.spec.ts | 34 +++++----- packages/util/test/withdrawal.spec.ts | 4 +- packages/verkle/src/node/leafNode.ts | 2 +- packages/vm/benchmarks/mockchain.ts | 4 +- packages/vm/examples/helpers/tx-builder.ts | 2 +- packages/vm/examples/run-solidity-contract.ts | 4 +- packages/vm/examples/runGoerliBlock.ts | 2 +- packages/vm/src/buildBlock.ts | 2 +- packages/vm/src/emitEVMProfile.ts | 2 +- packages/vm/src/params.ts | 4 +- packages/vm/src/requests.ts | 10 +-- packages/vm/src/runBlock.ts | 4 +- packages/vm/src/runTx.ts | 2 +- packages/vm/src/types.ts | 2 +- packages/vm/src/vm.ts | 2 +- packages/vm/test/api/EIPs/eip-2929.spec.ts | 2 +- .../eip-2935-historical-block-hashes.spec.ts | 16 ++--- .../vm/test/api/EIPs/eip-3198-BaseFee.spec.ts | 6 +- ...t-difficulty-opcode-with-prevrando.spec.ts | 6 +- .../test/api/EIPs/eip-4788-beaconroot.spec.ts | 2 +- .../api/EIPs/eip-4895-withdrawals.spec.ts | 2 +- packages/vm/test/api/EIPs/eip-7002.spec.ts | 2 +- packages/vm/test/api/bloom.spec.ts | 4 +- packages/vm/test/api/buildBlock.spec.ts | 4 +- packages/vm/test/api/customChain.spec.ts | 2 +- packages/vm/test/api/index.spec.ts | 8 +-- .../vm/test/api/muirGlacier/index.spec.ts | 2 +- packages/vm/test/api/runTx.spec.ts | 1 + .../vm/test/api/tester/tester.config.spec.ts | 2 +- packages/vm/test/api/utils.ts | 2 +- packages/wallet/src/hdkey.ts | 1 + packages/wallet/src/thirdparty.ts | 5 +- packages/wallet/src/wallet.ts | 5 +- 179 files changed, 437 insertions(+), 360 deletions(-) diff --git a/config/cspell-ts.json b/config/cspell-ts.json index d9eb97b819..c44b54e1c0 100644 --- a/config/cspell-ts.json +++ b/config/cspell-ts.json @@ -1,6 +1,16 @@ { "language": "en-US", - "ignoreRegExpList": ["/0x[0-9A-Fa-f]+/"], + "ignoreRegExpList": ["/0x[0-9A-Fa-f]+/", "@scure"], + "overrides": [ + { + "filename": "**/packages/devp2p/**", + "ignoreWords": ["pirl", "ubiq", "gwhale", "prichain", "zfill"] + }, + { + "filename": "**/packages/ethash/**", + "ignoreWords": ["epoc", "cmix"] + } + ], "words": [ "Hardfork", "hardfork", @@ -563,6 +573,15 @@ "fixturehd", "hdnode", "testpassword", - "wrongtestpassword" + "wrongtestpassword", + "keybyte", + "unstub", + "unmock", + "unjustifiedly", + "uncompression", + "dedicatedly", + "EVMBLS", + "EVMBN", + "EVMONEs" ] } diff --git a/package.json b/package.json index d9d359228a..13710bb4bc 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "checkNpmVersion": "./scripts/check-npm-version.sh", "clean": "./config/cli/clean-root.sh", "cspell": "npm run cspell:ts && npm run cspell:md", - "cspell:ts": "npx cspell --gitignore -e ./packages/ethereum-tests -c ./config/cspell-ts.json \"./packages/**/*.ts\"", + "cspell:ts": "npx cspell --gitignore -e \"./packages/ethereum-tests\" -e \"./packages/wallet/test\" -c ./config/cspell-ts.json \"./packages/**/*.ts\" --show-suggestions", "cspell:md": "npx cspell --gitignore -e ./packages/ethereum-tests -c ./config/cspell-md.json \"./packages/**/*.md\"", "docs:build": "npm run docs:build --workspaces --if-present", "e2e:inject": "node ./scripts/e2e-inject-resolutions.js", diff --git a/packages/block/src/from-beacon-payload.ts b/packages/block/src/from-beacon-payload.ts index ec9c4d275f..83d20b7d94 100644 --- a/packages/block/src/from-beacon-payload.ts +++ b/packages/block/src/from-beacon-payload.ts @@ -1,3 +1,4 @@ +// cspell:ignore breq import { bigIntToHex } from '@ethereumjs/util' import type { ExecutionPayload } from './types.js' diff --git a/packages/block/src/header/header.ts b/packages/block/src/header/header.ts index c3cdeb9123..f5afcfaedf 100644 --- a/packages/block/src/header/header.ts +++ b/packages/block/src/header/header.ts @@ -612,7 +612,7 @@ export class BlockHeader { rawItems.push(this.withdrawalsRoot!) } - // in kaunstinen 2 verkle is scheduled after withdrawals, will eventually be post deneb hopefully + // in kaustinen 2 verkle is scheduled after withdrawals, will eventually be post deneb hopefully if (this.common.isActivatedEIP(6800)) { // execution witness is not mandatory part of the the block so nothing to push here // but keep this comment segment for clarity regarding the same and move it according as per the diff --git a/packages/block/src/helpers.ts b/packages/block/src/helpers.ts index 87d80e7883..ac8ffbbc6f 100644 --- a/packages/block/src/helpers.ts +++ b/packages/block/src/helpers.ts @@ -1,3 +1,4 @@ +// cspell:ignore accum import { RLP } from '@ethereumjs/rlp' import { Trie } from '@ethereumjs/trie' import { BlobEIP4844Transaction } from '@ethereumjs/tx' diff --git a/packages/block/src/params.ts b/packages/block/src/params.ts index 94472f0eba..d4277f3329 100644 --- a/packages/block/src/params.ts +++ b/packages/block/src/params.ts @@ -29,7 +29,7 @@ export const paramsBlock: ParamsDict = { difficultyBombDelay: 3000000, // the amount of blocks to delay the difficulty bomb with }, /** -. * Constantinope HF Meta EIP +. * Constantinople HF Meta EIP . */ 1013: { // pow diff --git a/packages/block/test/block.spec.ts b/packages/block/test/block.spec.ts index e75feda9dc..b830005b7f 100644 --- a/packages/block/test/block.spec.ts +++ b/packages/block/test/block.spec.ts @@ -23,7 +23,7 @@ import { paramsBlock, } from '../src/index.js' -import * as testDataGenesis from './testdata/genesishashestest.json' +import * as testDataGenesis from './testdata/genesisHashesTest.json' import * as testDataFromRpcGoerli from './testdata/testdata-from-rpc-goerli.json' import * as testDataPreLondon2 from './testdata/testdata_pre-london-2.json' import * as testDataPreLondon from './testdata/testdata_pre-london.json' @@ -299,7 +299,7 @@ describe('[Block]: block functions', () => { ) await checkThrowsAsync(block.validateData(false, false), 'invalid uncle hash') - // Verkle withness + // Verkle witness const common = new Common({ chain: Mainnet, eips: [6800], hardfork: Hardfork.Cancun }) // Note: `executionWitness: undefined` will still initialize an execution witness in the block // So, only testing for `null` here diff --git a/packages/block/test/clique.spec.ts b/packages/block/test/clique.spec.ts index 4f55dcac8d..a170d42c80 100644 --- a/packages/block/test/clique.spec.ts +++ b/packages/block/test/clique.spec.ts @@ -54,7 +54,7 @@ describe('[Header]: Clique PoA Functionality', () => { }, undefined, undefined, - 'cliqueEpochTransitionSigners() -> should throw on non-epch block', + 'cliqueEpochTransitionSigners() -> should throw on non-epoch block', ) header = createBlockHeader({ number: 60000, extraData: new Uint8Array(137) }, { common }) diff --git a/packages/block/test/eip4844block.spec.ts b/packages/block/test/eip4844block.spec.ts index 6d99306213..761f47af17 100644 --- a/packages/block/test/eip4844block.spec.ts +++ b/packages/block/test/eip4844block.spec.ts @@ -269,7 +269,7 @@ describe('transaction validation tests', () => { .getTransactionsValidationErrors() .join(' ') .includes('exceed maximum blob gas per block'), - 'tx erros includes correct error message when too many blobs in a block', + 'tx errors includes correct error message when too many blobs in a block', ) }) }) diff --git a/packages/block/test/eip4895block.spec.ts b/packages/block/test/eip4895block.spec.ts index 4be6264c65..13e7835363 100644 --- a/packages/block/test/eip4895block.spec.ts +++ b/packages/block/test/eip4895block.spec.ts @@ -37,16 +37,16 @@ common.hardforkBlock = function (hardfork: string | undefined) { describe('EIP4895 tests', () => { it('should correctly generate withdrawalsRoot', async () => { - // get withdwalsArray + // get withdrawalsArray const gethBlockBytesArray = RLP.decode(hexToBytes(`0x${gethWithdrawals8BlockRlp}`)) const withdrawals = (gethBlockBytesArray[3] as WithdrawalBytes[]).map((wa) => Withdrawal.fromValuesArray(wa), ) assert.equal(withdrawals.length, 8, '8 withdrawals should have been found') - const gethWitdrawalsRoot = (gethBlockBytesArray[0] as Uint8Array[])[16] as Uint8Array + const gethWithdrawalsRoot = (gethBlockBytesArray[0] as Uint8Array[])[16] as Uint8Array assert.deepEqual( await genWithdrawalsTrieRoot(withdrawals), - gethWitdrawalsRoot, + gethWithdrawalsRoot, 'withdrawalsRoot should be valid', ) }) diff --git a/packages/block/test/from-beacon-payload.spec.ts b/packages/block/test/from-beacon-payload.spec.ts index 1d78598650..f634235ea7 100644 --- a/packages/block/test/from-beacon-payload.spec.ts +++ b/packages/block/test/from-beacon-payload.spec.ts @@ -23,7 +23,7 @@ describe('[fromExecutionPayloadJson]: 4844 devnet 5', () => { commonJson.config = { ...commonJson.config, chainId: 4844001005 } const network = 'sharding' common = createCommonFromGethGenesis(commonJson, { chain: network, customCrypto: { kzg } }) - // safely change chainId without modifying undelying json + // safely change chainId without modifying underlying json common.setHardfork(Hardfork.Cancun) }) @@ -86,7 +86,7 @@ describe('[fromExecutionPayloadJson]: 4844 devnet 5', () => { describe('[fromExecutionPayloadJson]: kaustinen', () => { const network = 'kaustinen' - // safely change chainId without modifying undelying json + // safely change chainId without modifying underlying json const common = createCommonFromGethGenesis(testnetVerkleKaustinen, { chain: network, eips: [6800], diff --git a/packages/block/test/from-rpc.spec.ts b/packages/block/test/from-rpc.spec.ts index 4970a59a79..3be4bc8478 100644 --- a/packages/block/test/from-rpc.spec.ts +++ b/packages/block/test/from-rpc.spec.ts @@ -1,3 +1,4 @@ +// cspell:ignore wtxns wtxs wotxns import { Common, Goerli, Hardfork, Mainnet } from '@ethereumjs/common' import { bytesToHex, equalsBytes, hexToBytes, randomBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' diff --git a/packages/block/test/header.spec.ts b/packages/block/test/header.spec.ts index a56e3c41f7..123a976486 100644 --- a/packages/block/test/header.spec.ts +++ b/packages/block/test/header.spec.ts @@ -1,3 +1,4 @@ +// cspell:ignore NOTURN import { Common, Goerli, Hardfork, Mainnet } from '@ethereumjs/common' import { RLP } from '@ethereumjs/rlp' import { diff --git a/packages/block/test/mergeBlock.spec.ts b/packages/block/test/mergeBlock.spec.ts index ab323cf499..ccc7a6f8bd 100644 --- a/packages/block/test/mergeBlock.spec.ts +++ b/packages/block/test/mergeBlock.spec.ts @@ -112,7 +112,7 @@ describe('[Header]: Casper PoS / The Merge Functionality', () => { } }) - it('EIP-4399: prevRando should return mixHash value', () => { + it('EIP-4399: prevRandao should return mixHash value', () => { const mixHash = new Uint8Array(32).fill(3) let block = createBlock({ header: { mixHash } }, { common }) assert.ok( diff --git a/packages/blockchain/src/blockchain.ts b/packages/blockchain/src/blockchain.ts index a50b1bf933..69f0145159 100644 --- a/packages/blockchain/src/blockchain.ts +++ b/packages/blockchain/src/blockchain.ts @@ -1,3 +1,4 @@ +// cspell:ignore NOTURN import { Block, BlockHeader, createBlock } from '@ethereumjs/block' import { Common, ConsensusAlgorithm, ConsensusType, Hardfork, Mainnet } from '@ethereumjs/common' import { @@ -42,9 +43,9 @@ import type { BigIntLike, DB, DBObject, GenesisState } from '@ethereumjs/util' * of block headers or blocks with support for reorgs and the ability to provide * custom DB backends. * - * By default consensus validation is not provided since with the swith to + * By default consensus validation is not provided since with the switch to * Proof-of-Stake consensus is validated by the Ethereum consensus layer. - * If consensus validation is desired for Etash or Clique blockchains the + * If consensus validation is desired for Ethash or Clique blockchains the * optional `consensusDict` option can be used to pass in validation objects. */ export class Blockchain implements BlockchainInterface { @@ -453,7 +454,7 @@ export class Blockchain implements BlockchainInterface { await this.consensus?.newBlock(block, commonAncestor, ancestorHeaders) } catch (e) { - // restore head to the previouly sane state + // restore head to the previously sane state this._heads = oldHeads this._headHeaderHash = oldHeadHeaderHash this._headBlockHash = oldHeadBlockHash @@ -940,7 +941,7 @@ export class Blockchain implements BlockchainInterface { } finally { if (releaseLockOnCallback === true) { await this._lock.acquire() - // If lock was released check if reorg occured + // If lock was released check if reorg occurred const nextBlockMayBeReorged = await this.getBlock(nextBlockNumber).catch( (_e) => null, ) @@ -1271,7 +1272,7 @@ export class Blockchain implements BlockchainInterface { } if (common.consensusType() === 'poa') { if (common.genesis().extraData) { - // Ensure exta data is populated from genesis data if provided + // Ensure extra data is populated from genesis data if provided header.extraData = common.genesis().extraData } else { // Add required extraData (32 bytes vanity + 65 bytes filled with zeroes diff --git a/packages/blockchain/src/consensus/clique.ts b/packages/blockchain/src/consensus/clique.ts index dc7af67ea9..0e10353728 100644 --- a/packages/blockchain/src/consensus/clique.ts +++ b/packages/blockchain/src/consensus/clique.ts @@ -1,3 +1,4 @@ +// cspell:ignore NOTURN addrs import { cliqueEpochTransitionSigners, cliqueIsEpochTransition, @@ -120,7 +121,7 @@ export class CliqueConsensus implements Consensus { /** * - * @param param dictionary containin a {@link Blockchain} object + * @param param dictionary containing a {@link Blockchain} object * * Note: this method must be called before consensus checks are used or type errors will occur */ diff --git a/packages/blockchain/src/db/constants.ts b/packages/blockchain/src/db/constants.ts index a7936b804f..5b365937ac 100644 --- a/packages/blockchain/src/db/constants.ts +++ b/packages/blockchain/src/db/constants.ts @@ -32,7 +32,7 @@ const NUM_SUFFIX = utf8ToBytes('n') /** * blockHashPrefix + hash -> number */ -const BLOCK_HASH_PEFIX = utf8ToBytes('H') +const BLOCK_HASH_PREFIX = utf8ToBytes('H') /** * bodyPrefix + number + hash -> block body @@ -55,7 +55,7 @@ const bodyKey = (n: bigint, hash: Uint8Array) => concatBytes(BODY_PREFIX, bytesB const numberToHashKey = (n: bigint) => concatBytes(HEADER_PREFIX, bytesBE8(n), NUM_SUFFIX) -const hashToNumberKey = (hash: Uint8Array) => concatBytes(BLOCK_HASH_PEFIX, hash) +const hashToNumberKey = (hash: Uint8Array) => concatBytes(BLOCK_HASH_PREFIX, hash) /** * @hidden diff --git a/packages/blockchain/src/db/manager.ts b/packages/blockchain/src/db/manager.ts index bca9cee717..42f826c464 100644 --- a/packages/blockchain/src/db/manager.ts +++ b/packages/blockchain/src/db/manager.ts @@ -107,7 +107,7 @@ export class DBManager { let body = await this.getBody(hash, number) // be backward compatible where we didn't use to store a body with no txs, uncles, withdrawals - // otherwise the body is never partially stored and if we have some body, its in entirity + // otherwise the body is never partially stored and if we have some body, its in entirety if (body === undefined) { body = [[], []] as BlockBodyBytes // Do extra validations on the header since we are assuming empty transactions and uncles diff --git a/packages/blockchain/src/types.ts b/packages/blockchain/src/types.ts index c46debba28..0eee200bf8 100644 --- a/packages/blockchain/src/types.ts +++ b/packages/blockchain/src/types.ts @@ -175,7 +175,7 @@ export interface BlockchainOptions extends GenesisOptions { /** * Validate the consensus with the respective consensus implementation passed - * to `consensusDict` (see respective option) `CapserConsensus` (which effectively + * to `consensusDict` (see respective option) `CasperConsensus` (which effectively * does nothing) is available by default. * * For the build-in validation classes the following validations take place. @@ -191,7 +191,7 @@ export interface BlockchainOptions extends GenesisOptions { * * Since consensus validation moved to the Ethereum consensus layer with Proof-of-Stake * consensus is not validated by default. For `ConsensusAlgorithm.Ethash` and - * `ConsensusAlgorith.Clique` consensus validation can be activated by passing in the + * `ConsensusAlgorithm.Clique` consensus validation can be activated by passing in the * respective consensus validation objects `EthashConsensus` or `CliqueConsensus`. * * ```ts diff --git a/packages/blockchain/test/clique.spec.ts b/packages/blockchain/test/clique.spec.ts index f4307ac872..f7a8298fc9 100644 --- a/packages/blockchain/test/clique.spec.ts +++ b/packages/blockchain/test/clique.spec.ts @@ -1,3 +1,4 @@ +// cspell:ignore NOTURN deauth unforked import { cliqueEpochTransitionSigners, createBlock, diff --git a/packages/blockchain/test/customConsensus.spec.ts b/packages/blockchain/test/customConsensus.spec.ts index 5865eb33eb..19083ade27 100644 --- a/packages/blockchain/test/customConsensus.spec.ts +++ b/packages/blockchain/test/customConsensus.spec.ts @@ -64,7 +64,7 @@ describe('Optional consensus parameter in blockchain constructor', () => { }) describe('Custom consensus validation rules', () => { - it('should validat custom consensus rules', async () => { + it('should validate custom consensus rules', async () => { const common = new Common({ chain: testnet, hardfork: Hardfork.Chainstart }) const blockchain = await createBlockchain({ common, validateConsensus: true, consensusDict }) const block = createBlock( diff --git a/packages/blockchain/test/index.spec.ts b/packages/blockchain/test/index.spec.ts index 508358cd5a..f0a202eb54 100644 --- a/packages/blockchain/test/index.spec.ts +++ b/packages/blockchain/test/index.spec.ts @@ -1,3 +1,4 @@ +// cspell:ignore staletest import { createBlock, createBlockFromRLPSerializedBlock, @@ -537,7 +538,7 @@ describe('blockchain test', () => { await blockchain.putHeader(block2Header) try { await blockchain.getBlock(BigInt(2)) - assert.fail('block should not be constucted') + assert.fail('block should not be constructed') } catch (e: any) { assert.equal( e.message, diff --git a/packages/client/archive/libp2p/index.ts b/packages/client/archive/libp2p/index.ts index f7c1b46164..fb1dc945a5 100644 --- a/packages/client/archive/libp2p/index.ts +++ b/packages/client/archive/libp2p/index.ts @@ -1,3 +1,4 @@ +// cspell:ignore ppeer pnode pserver import { Blockchain } from '@ethereumjs/blockchain' import { Chain, Common } from '@ethereumjs/common' import debug from 'debug' @@ -72,7 +73,7 @@ export async function createClient(args: any) { }) config.events.setMaxListeners(50) const chainDB = new Level( - `${datadir}/${common.chainName()}` + `${datadir}/${common.chainName()}`, ) const blockchain = await createBlockchain({ diff --git a/packages/client/archive/libp2p/libp2pnode.ts b/packages/client/archive/libp2p/libp2pnode.ts index 2e532234fa..01903c52ef 100644 --- a/packages/client/archive/libp2p/libp2pnode.ts +++ b/packages/client/archive/libp2p/libp2pnode.ts @@ -1,3 +1,4 @@ +// cspell:ignore MPLEX Muxer /** * Libp2p Bundle * @memberof module:net/peer diff --git a/packages/client/archive/libp2p/net/peer/libp2pnode.ts b/packages/client/archive/libp2p/net/peer/libp2pnode.ts index 125ffe71f2..34c85539e3 100644 --- a/packages/client/archive/libp2p/net/peer/libp2pnode.ts +++ b/packages/client/archive/libp2p/net/peer/libp2pnode.ts @@ -1,4 +1,5 @@ //@ts-nocheck +// cspell:ignore MPLEX Muxer /** * Libp2p Bundle * @memberof module:net/peer diff --git a/packages/client/archive/libp2p/net/peer/libp2ppeer.ts b/packages/client/archive/libp2p/net/peer/libp2ppeer.ts index b6f3ff5543..8f89e78781 100644 --- a/packages/client/archive/libp2p/net/peer/libp2ppeer.ts +++ b/packages/client/archive/libp2p/net/peer/libp2ppeer.ts @@ -1,4 +1,5 @@ //@ts-nocheck +// cspell:ignore psender pnode muxed muxer import { multiaddr } from '@multiformats/multiaddr' import { Peer } from '../../../src/net/peer/peer' @@ -31,7 +32,7 @@ export interface Libp2pPeerOptions extends Omit { await Promise.all( this.protocols.map(async (p) => { @@ -106,10 +107,10 @@ export class Libp2pPeer extends Peer { } catch (err: any) { const peerInfo = isPeerId(peer) ? `id=${peer.toB58String()}` : `multiaddr=${peer}` this.config.logger.debug( - `Peer doesn't support protocol=${protocol} ${peerInfo} ${err.stack}` + `Peer doesn't support protocol=${protocol} ${peerInfo} ${err.stack}`, ) } - }) + }), ) this.server = server this.connected = true diff --git a/packages/client/archive/libp2p/net/server/libp2pserver.ts b/packages/client/archive/libp2p/net/server/libp2pserver.ts index 89d46e3129..d283563e65 100644 --- a/packages/client/archive/libp2p/net/server/libp2pserver.ts +++ b/packages/client/archive/libp2p/net/server/libp2pserver.ts @@ -1,4 +1,5 @@ //@ts-nocheck +// cspell:ignore pnode addrs // eslint-disable-next-line implicit-dependencies/no-implicit, import/no-extraneous-dependencies import { keys } from 'libp2p-crypto' import { multiaddr } from '@multiformats/multiaddr' diff --git a/packages/client/bin/cli.ts b/packages/client/bin/cli.ts index 5d7a6a4885..b07643b535 100755 --- a/packages/client/bin/cli.ts +++ b/packages/client/bin/cli.ts @@ -430,7 +430,7 @@ const args: ClientOpts = yargs }) .option('isSingleNode', { describe: - 'To run client in single node configuration without need to discover the sync height from peer. Particularly useful in test configurations. This flag is automically activated in the "dev" mode', + 'To run client in single node configuration without need to discover the sync height from peer. Particularly useful in test configurations. This flag is automatically activated in the "dev" mode', boolean: true, }) .option('vmProfileBlocks', { @@ -460,7 +460,7 @@ const args: ClientOpts = yargs }) .option('engineNewpayloadMaxExecute', { describe: - 'Number of unexecuted blocks (including ancestors) that can be blockingly executed in engine`s new payload (if required and possible) to determine the validity of the block', + 'Number of unexecuted blocks (including ancestors) that can be executed per-block in engine`s new payload (if required and possible) to determine the validity of the block', number: true, }) .option('skipEngineExec', { @@ -470,7 +470,7 @@ const args: ClientOpts = yargs }) .option('ignoreStatelessInvalidExecs', { describe: - 'Ignore stateless execution failures and keep moving the vm execution along using execution witnesses available in block (verkle). Sets/overrides --statelessVerkle=true and --engineNewpayloadMaxExecute=0 to prevent engine newPayload direct block execution where block execution faliures may stall the CL client. Useful for debugging the verkle. The invalid blocks will be stored in dataDir/network/invalidPayloads which one may use later for debugging', + 'Ignore stateless execution failures and keep moving the vm execution along using execution witnesses available in block (verkle). Sets/overrides --statelessVerkle=true and --engineNewpayloadMaxExecute=0 to prevent engine newPayload direct block execution where block execution failures may stall the CL client. Useful for debugging the verkle. The invalid blocks will be stored in dataDir/network/invalidPayloads which one may use later for debugging', boolean: true, hidden: true, }) diff --git a/packages/client/src/config.ts b/packages/client/src/config.ts index e35e017b84..b314d8db08 100644 --- a/packages/client/src/config.ts +++ b/packages/client/src/config.ts @@ -1,3 +1,4 @@ +// cspell:ignore PARENTLOOKUP refeed import { Common, Hardfork, Mainnet } from '@ethereumjs/common' import { genPrivateKey } from '@ethereumjs/devp2p' import { type Address, BIGINT_0, BIGINT_1, BIGINT_2, BIGINT_256 } from '@ethereumjs/util' @@ -454,7 +455,7 @@ export class Config { public readonly initialVerkleStateRoot: Uint8Array public synchronized: boolean - public lastsyncronized?: boolean + public lastSynchronized?: boolean /** lastSyncDate in ms */ public lastSyncDate: number /** Best known block height */ @@ -628,7 +629,7 @@ export class Config { } } - if (this.synchronized !== this.lastsyncronized) { + if (this.synchronized !== this.lastSynchronized) { this.logger.debug( `Client synchronized=${this.synchronized}${ latest !== null && latest !== undefined ? ' height=' + latest.number : '' @@ -636,7 +637,7 @@ export class Config { (Date.now() - this.lastSyncDate) / 1000 } secs ago`, ) - this.lastsyncronized = this.synchronized + this.lastSynchronized = this.synchronized } } diff --git a/packages/client/src/execution/vmexecution.ts b/packages/client/src/execution/vmexecution.ts index 460b049a83..203910a504 100644 --- a/packages/client/src/execution/vmexecution.ts +++ b/packages/client/src/execution/vmexecution.ts @@ -585,7 +585,7 @@ export class VMExecution extends Execution { * @param loop Whether to continue iterating until vm head equals chain head (default: true) * @returns number of blocks executed */ - async run(loop = true, runOnlybatched = false): Promise { + async run(loop = true, runOnlyBatched = false): Promise { if (this.running || !this.started || !this.config.execution || this.config.shutdown) return 0 return this.runWithLock(async () => { @@ -625,8 +625,8 @@ export class VMExecution extends Execution { while ( this.started && !this.config.shutdown && - (!runOnlybatched || - (runOnlybatched && + (!runOnlyBatched || + (runOnlyBatched && canonicalHead.header.number - startHeadBlock.header.number >= BigInt(this.config.numBlocksPerIteration))) && (numExecuted === undefined || @@ -751,7 +751,7 @@ export class VMExecution extends Execution { parentState = block.header.stateRoot } catch (error: any) { // only marked the block as invalid if it was an actual execution error - // for e.g. absense of executionWitness doesn't make a block invalid + // for e.g. absence of executionWitness doesn't make a block invalid if (!`${error.message}`.includes('Invalid executionWitness=null')) { errorBlock = block } diff --git a/packages/client/src/ext/jwt-simple.ts b/packages/client/src/ext/jwt-simple.ts index a33be6c7dc..42972be434 100644 --- a/packages/client/src/ext/jwt-simple.ts +++ b/packages/client/src/ext/jwt-simple.ts @@ -7,7 +7,7 @@ * module dependencies */ import { bytesToUtf8, utf8ToBytes } from '@ethereumjs/util' -import { base64url, base64urlnopad } from '@scure/base' +import { base64url, base64urlnopad } from '@scure/base' // cspell:disable-line import crypto from 'crypto' /** diff --git a/packages/client/src/ext/qheap.ts b/packages/client/src/ext/qheap.ts index dc83e56f23..38aca07590 100644 --- a/packages/client/src/ext/qheap.ts +++ b/packages/client/src/ext/qheap.ts @@ -1,3 +1,4 @@ +// cspell:ignore Andras Radics /** * nodejs heap, classic array implementation * diff --git a/packages/client/src/miner/miner.ts b/packages/client/src/miner/miner.ts index 271c92b92d..63218ffca0 100644 --- a/packages/client/src/miner/miner.ts +++ b/packages/client/src/miner/miner.ts @@ -1,3 +1,4 @@ +// cspell:ignore NOTURN import { type BlockHeader, createSealedCliqueBlockHeader } from '@ethereumjs/block' import { ConsensusType, Hardfork } from '@ethereumjs/common' import { Ethash } from '@ethereumjs/ethash' diff --git a/packages/client/src/net/server/rlpxserver.ts b/packages/client/src/net/server/rlpxserver.ts index f041ff7a5c..8ec7eb13fc 100644 --- a/packages/client/src/net/server/rlpxserver.ts +++ b/packages/client/src/net/server/rlpxserver.ts @@ -1,3 +1,4 @@ +// cspell:ignore pirl ubiq gwhale prichain import { DPT as Devp2pDPT, RLPx as Devp2pRLPx } from '@ethereumjs/devp2p' import { bytesToUnprefixedHex, unprefixedHexToBytes, utf8ToBytes } from '@ethereumjs/util' diff --git a/packages/client/src/rpc/index.ts b/packages/client/src/rpc/index.ts index 58ddd1972e..ced41f3981 100644 --- a/packages/client/src/rpc/index.ts +++ b/packages/client/src/rpc/index.ts @@ -42,8 +42,8 @@ export class RPCManager { if (!this._config.saveReceipts && saveReceiptsMethods.includes(methodName)) { continue } - const concatedMethodName = `${modName.toLowerCase()}_${methodName}` - methods[concatedMethodName] = mod[methodName].bind((...params: any[]) => { + const concatenatedMethodName = `${modName.toLowerCase()}_${methodName}` + methods[concatenatedMethodName] = mod[methodName].bind((...params: any[]) => { try { mod(...params) } catch (error: any) { diff --git a/packages/client/src/rpc/modules/admin.ts b/packages/client/src/rpc/modules/admin.ts index 589665af2c..34460f785c 100644 --- a/packages/client/src/rpc/modules/admin.ts +++ b/packages/client/src/rpc/modules/admin.ts @@ -75,7 +75,7 @@ export class Admin { * @returns an array of objects containing information about peers (including id, eth protocol versions supported, client name, etc.) */ async peers() { - const peers = this._client.services.filter((serv) => serv.name === 'eth')[0]?.pool + const peers = this._client.services.filter((service) => service.name === 'eth')[0]?.pool .peers as RlpxPeer[] return peers?.map((peer) => { diff --git a/packages/client/src/rpc/modules/engine/engine.ts b/packages/client/src/rpc/modules/engine/engine.ts index e99c5e450a..47d9abe161 100644 --- a/packages/client/src/rpc/modules/engine/engine.ts +++ b/packages/client/src/rpc/modules/engine/engine.ts @@ -678,7 +678,7 @@ export class Engine { this.chain.config.engineNewpayloadMaxTxsExecute }) executionBusy=${this.execution.running}`, ) - // determind status to be returned depending on if block could extend chain or not + // determined status to be returned depending on if block could extend chain or not const status = optimisticLookup === true ? Status.SYNCING : Status.ACCEPTED const response = { status, latestValidHash: null, validationError: null } return response diff --git a/packages/client/src/rpc/modules/engine/util/getPayload.ts b/packages/client/src/rpc/modules/engine/util/getPayload.ts index 9cad1d79fb..18da12f188 100644 --- a/packages/client/src/rpc/modules/engine/util/getPayload.ts +++ b/packages/client/src/rpc/modules/engine/util/getPayload.ts @@ -21,7 +21,7 @@ export const blockToExecutionPayload = (block: Block, value: bigint, bundle?: Bl } : undefined - // ethereumjs doesnot provide any transaction censoring detection (yet) to suggest + // ethereumjs does not provide any transaction censoring detection (yet) to suggest // overriding builder/mev-boost blocks const shouldOverrideBuilder = false return { executionPayload, blockValue: bigIntToHex(value), blobsBundle, shouldOverrideBuilder } diff --git a/packages/client/src/rpc/validation.ts b/packages/client/src/rpc/validation.ts index 4b150cdc85..cc929dfe4e 100644 --- a/packages/client/src/rpc/validation.ts +++ b/packages/client/src/rpc/validation.ts @@ -379,7 +379,7 @@ export const validators = { }, /** - * validator to ensure required withdawal fields are present, and checks for valid address and hex values + * validator to ensure required withdrawal fields are present, and checks for valid address and hex values * for the other quantity based fields * @param requiredFields array of required fields * @returns validator function with params: @@ -677,7 +677,7 @@ export const validators = { /** * Verification of rewardPercentiles array * - * description: A monotonically increasing list of percentile values. For each block in the requested range, the transactions will be sorted in ascending order by effective tip per gas and the coresponding effective tip for the percentile will be determined, accounting for gas consumed. + * description: A monotonically increasing list of percentile values. For each block in the requested range, the transactions will be sorted in ascending order by effective tip per gas and the corresponding effective tip for the percentile will be determined, accounting for gas consumed. * type: array * items: rewardPercentile value * diff --git a/packages/client/src/service/skeleton.ts b/packages/client/src/service/skeleton.ts index 346dfe407e..859a6454b3 100644 --- a/packages/client/src/service/skeleton.ts +++ b/packages/client/src/service/skeleton.ts @@ -131,9 +131,9 @@ export class Skeleton extends MetaDBManager { public safeBlock?: Block public finalizedBlock?: Block - // to track if we have cl FCUs close to the clockhead + // to track if we have cl FCUs close to the clock head synchronized = false - private lastsyncronized = false + private lastSynchronized = false private lastSyncDate = 0 constructor(opts: MetaDBManagerOptions) { @@ -233,7 +233,7 @@ export class Skeleton extends MetaDBManager { return this.started > 0 } - async isLastAnnoucement(): Promise { + async isLastAnnouncement(): Promise { const subchain0 = this.status.progress.subchains[0] if (subchain0 !== undefined) { return this.getBlock(subchain0.head + BIGINT_1) !== undefined @@ -392,12 +392,12 @@ export class Skeleton extends MetaDBManager { * @params head - The block being attempted as a new head * @params force - Flag to indicate if this is just a check of worthiness or a actually new head * @params init - Flag this is the first time since the beacon sync start to perform additional tasks - * @params reorgthrow - Flag to indicate if we would actually like to throw if there is a reorg + * @params reorgThrow - Flag to indicate if we would actually like to throw if there is a reorg * instead of just returning the boolean * * @returns True if the head (will) cause a reorg in the canonical skeleton subchain */ - async setHead(head: Block, force = true, init = false, reorgthrow = false): Promise { + async setHead(head: Block, force = true, init = false, reorgThrow = false): Promise { if ( this.config.syncTargetHeight === undefined || this.config.syncTargetHeight < head.header.number @@ -455,21 +455,21 @@ export class Skeleton extends MetaDBManager { parent.header.number < subchain.tail ) { // truncate subchain 0 before inserting a new chain so that this chain can be merged into new - // one without issues if the opportunity arrises + // one without issues if the opportunity arises if ( subchain !== undefined && this.status.linked && this.status.canonicalHeadReset === false && this.chain.blocks.height >= subchain.tail ) { - const trucateTailToNumber = this.chain.blocks.height + BIGINT_1 - const trucateTailTo = - trucateTailToNumber <= subchain.head - ? await this.getBlock(trucateTailToNumber, true) + const truncateTailToNumber = this.chain.blocks.height + BIGINT_1 + const truncateTailTo = + truncateTailToNumber <= subchain.head + ? await this.getBlock(truncateTailToNumber, true) : undefined - if (trucateTailTo !== undefined) { - subchain.tail = trucateTailTo.header.number - subchain.next = trucateTailTo.header.parentHash + if (truncateTailTo !== undefined) { + subchain.tail = truncateTailTo.header.number + subchain.next = truncateTailTo.header.parentHash this.config.logger.info( `Truncated subchain0 with head=${subchain.head} to a new tail=${ subchain.tail @@ -478,7 +478,7 @@ export class Skeleton extends MetaDBManager { } else { // clear out this subchain this.config.logger.info( - `Dropping subchain0 with head=${subchain.head} before overlaying a new subchain as trucateTailToNumber=${trucateTailToNumber} block not available `, + `Dropping subchain0 with head=${subchain.head} before overlaying a new subchain as truncateTailToNumber=${truncateTailToNumber} block not available `, ) this.status.progress.subchains.splice(0, 1) } @@ -514,13 +514,13 @@ export class Skeleton extends MetaDBManager { !this.status.canonicalHeadReset && this.chain.blocks.height >= subchain.tail ) { - let trucateTailTo - const trucateTailToNumber = this.chain.blocks.height + BIGINT_1 - if (trucateTailToNumber < head.header.number) { - trucateTailTo = await this.getBlock(trucateTailToNumber, true) + let truncateTailTo + const truncateTailToNumber = this.chain.blocks.height + BIGINT_1 + if (truncateTailToNumber < head.header.number) { + truncateTailTo = await this.getBlock(truncateTailToNumber, true) } - if (trucateTailTo === undefined) { + if (truncateTailTo === undefined) { subchain.tail = head.header.number subchain.next = head.header.parentHash // reset canonical head, don't change linked status because parent was @@ -534,8 +534,8 @@ export class Skeleton extends MetaDBManager { }`, ) } else { - subchain.tail = trucateTailTo.header.number - subchain.next = trucateTailTo.header.parentHash + subchain.tail = truncateTailTo.header.number + subchain.next = truncateTailTo.header.parentHash // just reset tail and no need to modify linked status this.config.logger.info( `Truncated subchain with head=${subchain.head} to a new tail=${ @@ -577,7 +577,7 @@ export class Skeleton extends MetaDBManager { // Earlier we were throwing on reorg, essentially for the purposes for killing the reverse fetcher // but it can be handled properly in the calling fn without erroring - if (reorg && reorgthrow) { + if (reorg && reorgThrow) { if (force) { throw errSyncReorged } else { @@ -636,7 +636,7 @@ export class Skeleton extends MetaDBManager { } } - if (this.synchronized !== this.lastsyncronized) { + if (this.synchronized !== this.lastSynchronized) { this.config.logger.debug( `Cl (skeleton) synchronized=${this.synchronized}${ latest !== null && latest !== undefined ? ' height=' + latest.number : '' @@ -644,7 +644,7 @@ export class Skeleton extends MetaDBManager { (Date.now() - this.lastSyncDate) / 1000 } secs ago`, ) - this.lastsyncronized = this.synchronized + this.lastSynchronized = this.synchronized } } @@ -804,7 +804,7 @@ export class Skeleton extends MetaDBManager { // blocks if there are executed blocks to fill with. This blocking causes it to not interfere // with the setHead mechanism. This is however a hack and a better solution needs to be devised // to handle it blockchain level as because of async nature of new payloads and fcUs and the skeleton - // there is always a chance for uncordinated put blocks unless they are all cordinated through skeleton + // there is always a chance for uncoordinated put blocks unless they are all coordinated through skeleton // which might also be a valid await this.blockingFillWithCutoff(this.chain.config.engineParentLookupMaxDepth) @@ -840,13 +840,13 @@ export class Skeleton extends MetaDBManager { /** * Setup the skeleton to init sync with head * @params head - The block with which we want to init the skeleton head - * @params reorgthrow - If we would like the function to throw instead of silently + * @params reorgThrow - If we would like the function to throw instead of silently * return if there is reorg of the skeleton head * * @returns True if the skeleton was reorged trying to init else false */ - async initSync(head: Block, reorgthrow = false): Promise { - return this.setHead(head, true, true, reorgthrow) + async initSync(head: Block, reorgThrow = false): Promise { + return this.setHead(head, true, true, reorgThrow) } /** @@ -1183,7 +1183,7 @@ export class Skeleton extends MetaDBManager { canonicalHead = newHead await this.chain.resetCanonicalHead(canonicalHead) } - // update in lock so as to not conflict/overwrite sethead/putblock updates + // update in lock so as to not conflict/overwrite setHead/putBlock updates await this.runWithLock(async () => { this.status.canonicalHeadReset = false }) @@ -1231,7 +1231,7 @@ export class Skeleton extends MetaDBManager { // chain height has to be <= block number as we will skip putting this block as it might currently // cause chain reset. This can happen if any other async process added a batch of blocks like // execution's setHead. If that caused this chain to be not canonical anymore than the next - // putblocks should fail causing the fill to exit with skeleton stepback + // putBlocks should fail causing the fill to exit with skeleton stepback if (this.chain.blocks.height <= block.header.number) { try { numBlocksInserted = await this.chain.putBlocks([block], true) @@ -1823,7 +1823,7 @@ export class Skeleton extends MetaDBManager { subchains, // linked intToBytes(this.status.linked ? 1 : 0), - // canonocalHeadReset + // canonicalHeadReset intToBytes(this.status.canonicalHeadReset ? 1 : 0), // safe and finalized bigIntToBytes(this.status.safe), diff --git a/packages/client/src/service/txpool.ts b/packages/client/src/service/txpool.ts index 47ba8d9727..208b3f0b0f 100644 --- a/packages/client/src/service/txpool.ts +++ b/packages/client/src/service/txpool.ts @@ -888,7 +888,7 @@ export class TxPool { broadcasterrors += sendobjects.filter((sendobject) => sendobject.error !== undefined).length knownpeers++ } - // Get avergae + // Get average if (knownpeers > 0) { broadcasts = broadcasts / knownpeers broadcasterrors = broadcasterrors / knownpeers diff --git a/packages/client/src/sync/fetcher/accountfetcher.ts b/packages/client/src/sync/fetcher/accountfetcher.ts index dcd5a22879..197aae3659 100644 --- a/packages/client/src/sync/fetcher/accountfetcher.ts +++ b/packages/client/src/sync/fetcher/accountfetcher.ts @@ -26,7 +26,7 @@ import { ByteCodeFetcher } from './bytecodefetcher.js' import { Fetcher } from './fetcher.js' import { StorageFetcher } from './storagefetcher.js' import { TrieNodeFetcher } from './trienodefetcher.js' -import { getInitFecherDoneFlags } from './types.js' +import { getInitFetcherDoneFlags } from './types.js' import type { Peer } from '../../net/peer/index.js' import type { AccountData } from '../../net/protocol/snapprotocol.js' @@ -90,7 +90,7 @@ export class AccountFetcher extends Fetcher */ constructor(options: AccountFetcherOptions) { super(options) - this.fetcherDoneFlags = options.fetcherDoneFlags ?? getInitFecherDoneFlags() + this.fetcherDoneFlags = options.fetcherDoneFlags ?? getInitFetcherDoneFlags() this.root = options.root this.first = options.first @@ -546,7 +546,7 @@ export class AccountFetcher extends Fetcher * remaining items apart from the tasks it pushes in the queue * * Divides the full 256-bit range of hashes into ranges of @maxAccountRange - * size and turnes each range into a task for the fetcher + * size and turns each range into a task for the fetcher */ tasks(first = this.first, count = this.count, maxTasks = this.config.maxFetcherJobs): JobTask[] { diff --git a/packages/client/src/sync/fetcher/bytecodefetcher.ts b/packages/client/src/sync/fetcher/bytecodefetcher.ts index d2f5c8207c..a5868d92e9 100644 --- a/packages/client/src/sync/fetcher/bytecodefetcher.ts +++ b/packages/client/src/sync/fetcher/bytecodefetcher.ts @@ -10,7 +10,7 @@ import debug from 'debug' import { keccak256 } from 'ethereum-cryptography/keccak' import { Fetcher } from './fetcher.js' -import { getInitFecherDoneFlags } from './types.js' +import { getInitFetcherDoneFlags } from './types.js' import type { Peer } from '../../net/peer/index.js' import type { FetcherOptions } from './fetcher.js' @@ -55,7 +55,7 @@ export class ByteCodeFetcher extends Fetcher super(options) this.hashes = options.hashes ?? [] this.stateManager = options.stateManager ?? new DefaultStateManager() - this.fetcherDoneFlags = options.fetcherDoneFlags ?? getInitFecherDoneFlags() + this.fetcherDoneFlags = options.fetcherDoneFlags ?? getInitFetcherDoneFlags() this.fetcherDoneFlags.byteCodeFetcher.count = BigInt(this.hashes.length) this.codeDB = this.stateManager['_getCodeDB']() @@ -113,7 +113,7 @@ export class ByteCodeFetcher extends Fetcher // While results are in the same order as requested hashes but there could be gaps/misses in the results // if the node doesn't has the bytecode. We need an index to move forward through the hashes which are - // absent in the receieved responses + // absent in the received responses let requestedHashIndex = 0 for (let i = 0; i < rangeResult.codes.length; i++) { const receivedCode = rangeResult.codes[i] @@ -187,7 +187,7 @@ export class ByteCodeFetcher extends Fetcher } await this.codeDB.batch(ops as BatchDBOp[]) this.fetcherDoneFlags.byteCodeFetcher.first += BigInt(codeHashToByteCode.size) - // no idea why first starts exceeding count, may be because of missed hashesh thing, so resort to this + // no idea why first starts exceeding count, may be because of missed hashes thing, so resort to this // weird method of tracking the count this.fetcherDoneFlags.byteCodeFetcher.count = this.fetcherDoneFlags.byteCodeFetcher.first + BigInt(this.hashes.length) @@ -208,7 +208,7 @@ export class ByteCodeFetcher extends Fetcher */ enqueueByByteCodeRequestList(byteCodeRequestList: Uint8Array[]) { this.hashes.push(...byteCodeRequestList) - // no idea why first starts exceeding count, may be because of missed hashesh thing, so resort to this + // no idea why first starts exceeding count, may be because of missed hashes thing, so resort to this // weird method of tracking the count this.fetcherDoneFlags.byteCodeFetcher.count = this.fetcherDoneFlags.byteCodeFetcher.first + BigInt(this.hashes.length) diff --git a/packages/client/src/sync/fetcher/storagefetcher.ts b/packages/client/src/sync/fetcher/storagefetcher.ts index e7009401a4..2dfb3fda22 100644 --- a/packages/client/src/sync/fetcher/storagefetcher.ts +++ b/packages/client/src/sync/fetcher/storagefetcher.ts @@ -17,7 +17,7 @@ import debugDefault from 'debug' import { keccak256 } from 'ethereum-cryptography/keccak' import { Fetcher } from './fetcher.js' -import { getInitFecherDoneFlags } from './types.js' +import { getInitFetcherDoneFlags } from './types.js' import type { Peer } from '../../net/peer/index.js' import type { StorageData } from '../../net/protocol/snapprotocol.js' @@ -89,7 +89,7 @@ export class StorageFetcher extends Fetcher 0) { this.debug('Single account request is being initiated') storageRequest = this.fragmentedRequests.shift() - whereFirstwas = storageRequest!.first + whereFirstWas = storageRequest!.first startedWith = storageRequest!.first myFirst = storageRequest!.first myCount = storageRequest!.count @@ -602,7 +602,7 @@ export class StorageFetcher extends Fetcher constructor(options: TrieNodeFetcherOptions) { super(options) this.root = options.root - this.fetcherDoneFlags = options.fetcherDoneFlags ?? getInitFecherDoneFlags() + this.fetcherDoneFlags = options.fetcherDoneFlags ?? getInitFetcherDoneFlags() this.pathToNodeRequestData = new OrderedMap() this.requestedNodeToPath = new Map() this.fetchedAccountNodes = new Map() @@ -169,7 +169,7 @@ export class TrieNodeFetcher extends Fetcher try { // While results are in the same order as requested hashes but there could be gaps/misses in the results // if the node doesn't has all of the requested trie nodes. We need an index to move forward through the hashes which are - // absent in the receieved responses + // absent in the received responses const receivedNodes: Uint8Array[] = [] for (let i = 0; i < rangeResult.nodes.length; i++) { const receivedNode = rangeResult.nodes[i] @@ -331,7 +331,7 @@ export class TrieNodeFetcher extends Fetcher this.pathToNodeRequestData.eraseElementByKey(pathString) } - // for an initial implementation, just put nodes into trie and see if root maches stateRoot + // for an initial implementation, just put nodes into trie and see if root matches stateRoot if (this.pathToNodeRequestData.length === 0) { this.debug('All requests for current heal phase have been filled') const ops: BatchDBOp[] = [] diff --git a/packages/client/src/sync/fetcher/types.ts b/packages/client/src/sync/fetcher/types.ts index 8004360450..db348db0fb 100644 --- a/packages/client/src/sync/fetcher/types.ts +++ b/packages/client/src/sync/fetcher/types.ts @@ -43,7 +43,7 @@ export type SnapFetcherDoneFlags = { stateRoot?: Uint8Array } -export function getInitFecherDoneFlags(): SnapFetcherDoneFlags { +export function getInitFetcherDoneFlags(): SnapFetcherDoneFlags { return { done: false, syncing: false, diff --git a/packages/client/src/sync/snapsync.ts b/packages/client/src/sync/snapsync.ts index 97ae243777..529bd59a0a 100644 --- a/packages/client/src/sync/snapsync.ts +++ b/packages/client/src/sync/snapsync.ts @@ -4,7 +4,7 @@ import { Event } from '../types.js' import { short } from '../util/index.js' import { AccountFetcher } from './fetcher/index.js' -import { getInitFecherDoneFlags } from './fetcher/types.js' +import { getInitFetcherDoneFlags } from './fetcher/types.js' import { Synchronizer } from './sync.js' import type { VMExecution } from '../execution/index.js' @@ -26,7 +26,7 @@ export class SnapSynchronizer extends Synchronizer { public running = false skeleton?: Skeleton private execution: VMExecution - readonly fetcherDoneFlags: SnapFetcherDoneFlags = getInitFecherDoneFlags() + readonly fetcherDoneFlags: SnapFetcherDoneFlags = getInitFetcherDoneFlags() constructor(options: SnapSynchronizerOptions) { super(options) diff --git a/packages/client/src/util/parse.ts b/packages/client/src/util/parse.ts index 061f0157ae..0965cabaae 100644 --- a/packages/client/src/util/parse.ts +++ b/packages/client/src/util/parse.ts @@ -1,3 +1,4 @@ +// cspell:ignore WHATWG import { hexToBytes } from '@ethereumjs/util' import { isMultiaddr, multiaddr } from '@multiformats/multiaddr' import { URL } from 'url' diff --git a/packages/client/test/logging.spec.ts b/packages/client/test/logging.spec.ts index b5542e9e56..84438dc59f 100644 --- a/packages/client/test/logging.spec.ts +++ b/packages/client/test/logging.spec.ts @@ -44,7 +44,7 @@ describe('[Logging]', () => { }) as any assert.equal( message, - 'test \x1B[38;2;0;128;0mkey\x1B[39m=value ', + 'test \x1B[38;2;0;128;0mkey\x1B[39m=value ', // cspell:disable-line 'key=value pairs should be colorized', ) }) diff --git a/packages/client/test/miner/miner.spec.ts b/packages/client/test/miner/miner.spec.ts index dea370b039..36ffcad606 100644 --- a/packages/client/test/miner/miner.spec.ts +++ b/packages/client/test/miner/miner.spec.ts @@ -327,7 +327,7 @@ describe('assembleBlocks() -> with multiple txs, properly ordered by gasPrice an ;(vm.blockchain as any)._validateConsensus = false chain.putBlocks = (blocks: Block[]) => { - it('sholud be properly orded by gasPrice and nonce', () => { + it('should be properly ordered by gasPrice and nonce', () => { const msg = 'txs in block should be properly ordered by gasPrice and nonce' const expectedOrder = [txB01, txA01, txA02, txA03] for (const [index, tx] of expectedOrder.entries()) { @@ -382,7 +382,7 @@ describe('assembleBlocks() -> with saveReceipts', async () => { ;(vm.blockchain as any)._validateConsensus = false chain.putBlocks = async (blocks: Block[]) => { - it('should be properly orded by gasPrice and nonce', async () => { + it('should be properly ordered by gasPrice and nonce', async () => { const msg = 'txs in block should be properly ordered by gasPrice and nonce' const expectedOrder = [txB01, txA01, txA02, txA03] for (const [index, tx] of expectedOrder.entries()) { diff --git a/packages/client/test/miner/pendingBlock.spec.ts b/packages/client/test/miner/pendingBlock.spec.ts index 4a009e9465..a275e4d65e 100644 --- a/packages/client/test/miner/pendingBlock.spec.ts +++ b/packages/client/test/miner/pendingBlock.spec.ts @@ -215,7 +215,7 @@ describe('[PendingBlock]', async () => { it('should stop adding txs when block is full', async () => { const { txPool } = setup() - // set gas limit low so that can accomodate 2 txs + // set gas limit low so that can accommodate, 2 txs const prevGasLimit = common['_chainParams'].genesis.gasLimit common['_chainParams'].genesis.gasLimit = 50000 diff --git a/packages/client/test/net/protocol/snapprotocol.spec.ts b/packages/client/test/net/protocol/snapprotocol.spec.ts index 43b30fda1f..1fe6ac8759 100644 --- a/packages/client/test/net/protocol/snapprotocol.spec.ts +++ b/packages/client/test/net/protocol/snapprotocol.spec.ts @@ -153,7 +153,7 @@ describe('[SnapProtocol]', () => { assert.ok(equalsBytes(accountFull[3], KECCAK256_NULL), 'codeHash should be KECCAK256_NULL') // Lets encode fullData as it should be encoded in slim format and upon decoding - // we shpuld get slim format + // we should get slim format const slimPayload = pFull.encode( pFull.messages.filter((message) => message.name === 'AccountRange')[0], fullData, diff --git a/packages/client/test/rpc/engine/forkchoiceUpdatedV1.spec.ts b/packages/client/test/rpc/engine/forkchoiceUpdatedV1.spec.ts index 3fe206b853..735ec5a708 100644 --- a/packages/client/test/rpc/engine/forkchoiceUpdatedV1.spec.ts +++ b/packages/client/test/rpc/engine/forkchoiceUpdatedV1.spec.ts @@ -70,7 +70,7 @@ describe(method, () => { const invalidForkChoiceState = { ...validForkChoiceState, - finalizedBlockHash: '0xinvalid', + finalizedBlockHash: '0xinvalid', // cspell:disable-line } const res = await rpc.request(method, [invalidForkChoiceState, validPayloadAttributes]) assert.equal(res.error.code, INVALID_PARAMS) diff --git a/packages/client/test/rpc/engine/getPayloadV3.spec.ts b/packages/client/test/rpc/engine/getPayloadV3.spec.ts index 35aa080b5e..e300aa19d6 100644 --- a/packages/client/test/rpc/engine/getPayloadV3.spec.ts +++ b/packages/client/test/rpc/engine/getPayloadV3.spec.ts @@ -119,7 +119,7 @@ describe(method, () => { '0x8c71ad199a3dda94de6a1c31cc50a26b1f03a8a4924e9ea3fd7420c6411cac42', 'built expected block', ) - assert.equal(executionPayload.excessBlobGas, '0x0', 'correct execess blob gas') + assert.equal(executionPayload.excessBlobGas, '0x0', 'correct excess blob gas') assert.equal(executionPayload.blobGasUsed, '0x20000', 'correct blob gas used') const { commitments, proofs, blobs } = blobsBundle assert.ok( diff --git a/packages/client/test/rpc/engine/kaustinen6.spec.ts b/packages/client/test/rpc/engine/kaustinen6.spec.ts index 4b7dab2c55..dc7a11333d 100644 --- a/packages/client/test/rpc/engine/kaustinen6.spec.ts +++ b/packages/client/test/rpc/engine/kaustinen6.spec.ts @@ -1,3 +1,4 @@ +// cspell:ignore gethk vecs import { BlockHeader, createBlockFromExecutionPayload, diff --git a/packages/client/test/rpc/engine/newPayloadV3.spec.ts b/packages/client/test/rpc/engine/newPayloadV3.spec.ts index 75303d7629..71355bd200 100644 --- a/packages/client/test/rpc/engine/newPayloadV3.spec.ts +++ b/packages/client/test/rpc/engine/newPayloadV3.spec.ts @@ -33,7 +33,7 @@ describe(`${method}: call with executionPayloadV3`, () => { }) it('valid data', async () => { - // get the genesis json with late enougt date with respect to block data in batchBlocks + // get the genesis json with late enough date with respect to block data in batchBlocks const cancunTime = 1689945325 // deep copy json and add shanghai and cancun to genesis to avoid contamination const cancunJson = JSON.parse(JSON.stringify(genesisJSON)) @@ -71,7 +71,7 @@ describe(`${method}: call with executionPayloadV3`, () => { }) it('fcU and verify that no errors occur on new payload', async () => { - // get the genesis json with late enougt date with respect to block data in batchBlocks + // get the genesis json with late enough date with respect to block data in batchBlocks const cancunTime = 1689945325 // deep copy json and add shanghai and cancun to genesis to avoid contamination const cancunJson = JSON.parse(JSON.stringify(genesisJSON)) diff --git a/packages/client/test/rpc/engine/preimages.spec.ts b/packages/client/test/rpc/engine/preimages.spec.ts index d85891fc08..5b6b8d19b9 100644 --- a/packages/client/test/rpc/engine/preimages.spec.ts +++ b/packages/client/test/rpc/engine/preimages.spec.ts @@ -137,7 +137,7 @@ describe(`valid verkle network setup`, async () => { // and for block1 are coded to return no withdrawals // // third consideration is for feerecipient which are added here as random - // coinbase addrs + // coinbase addresses const testCases = [ { name: 'block 1 no txs', diff --git a/packages/client/test/rpc/engine/withdrawals.spec.ts b/packages/client/test/rpc/engine/withdrawals.spec.ts index e46f000c89..768ca0deb4 100644 --- a/packages/client/test/rpc/engine/withdrawals.spec.ts +++ b/packages/client/test/rpc/engine/withdrawals.spec.ts @@ -110,7 +110,7 @@ for (const { name, withdrawals, withdrawalsRoot, gethBlockRlp } of testCases) { assert.equal( withdrawalsRoot, computedWithdrawalsRoot, - 'withdrawalsRoot compuation should match', + 'withdrawalsRoot computation should match', ) const { server } = await setupChain(genesisJSON, 'post-merge', { engine: true }) const rpc = getRpcClient(server) diff --git a/packages/client/test/rpc/eth/getTransactionByBlockHashAndIndex.spec.ts b/packages/client/test/rpc/eth/getTransactionByBlockHashAndIndex.spec.ts index 7feabc0fd3..05ee246b57 100644 --- a/packages/client/test/rpc/eth/getTransactionByBlockHashAndIndex.spec.ts +++ b/packages/client/test/rpc/eth/getTransactionByBlockHashAndIndex.spec.ts @@ -88,7 +88,7 @@ describe(method, async () => { const { rpc } = await baseSetup() const mockBlockHash = '0x572856aae9a653012a7df7aeb56bfb7fe77f5bcb4b69fd971c04e989f6ccf9b1' - const mockTxIndex = 'INVALIDA_TXINDEX' + const mockTxIndex = 'INVALID_TXINDEX' const res = await rpc.request(method, [mockBlockHash, mockTxIndex]) assert.equal(res.error.code, INVALID_PARAMS) diff --git a/packages/client/test/rpc/validation.spec.ts b/packages/client/test/rpc/validation.spec.ts index 932f37bf3b..5b62da0cb7 100644 --- a/packages/client/test/rpc/validation.spec.ts +++ b/packages/client/test/rpc/validation.spec.ts @@ -301,9 +301,9 @@ describe(prefix, () => { assert.ok(validatorResult(validators.blockOption(['0x01'], 0))) // invalid - assert.notOk(validatorResult(validators.blockOption(['lates'], 0))) - assert.notOk(validatorResult(validators.blockOption(['arliest'], 0))) - assert.notOk(validatorResult(validators.blockOption(['pendin'], 0))) + assert.notOk(validatorResult(validators.blockOption(['lates'], 0))) // cspell:disable-line + assert.notOk(validatorResult(validators.blockOption(['arliest'], 0))) // cspell:disable-line + assert.notOk(validatorResult(validators.blockOption(['pendin'], 0))) // cspell:disable-line assert.notOk(validatorResult(validators.blockOption(['0'], 0))) assert.notOk(validatorResult(validators.blockOption(['00'], 0))) assert.notOk(validatorResult(validators.blockOption(['1'], 0))) @@ -327,7 +327,7 @@ describe(prefix, () => { assert.notOk(validatorResult(validators.bool(['true'], 0))) assert.notOk(validatorResult(validators.bool(['false'], 0))) assert.notOk(validatorResult(validators.bool(['tru'], 0))) - assert.notOk(validatorResult(validators.bool(['fals'], 0))) + assert.notOk(validatorResult(validators.bool(['fals'], 0))) // cspell:disable-line }) it('hex', () => { diff --git a/packages/client/test/service/fullethereumservice.spec.ts b/packages/client/test/service/fullethereumservice.spec.ts index 151220534f..de3551196e 100644 --- a/packages/client/test/service/fullethereumservice.spec.ts +++ b/packages/client/test/service/fullethereumservice.spec.ts @@ -96,7 +96,7 @@ describe('should open', async () => { expect(service.synchronizer!.open).toBeCalled() expect(server.addProtocols).toBeCalled() service.config.events.on(Event.SYNC_SYNCHRONIZED, () => { - it('should syncronize', () => { + it('should synchronize', () => { assert.ok('synchronized') }) }) @@ -217,7 +217,7 @@ describe('should ban peer for sending NewBlock/NewBlockHashes after merge', asyn chain.config.chainCommon.setHardfork(Hardfork.Paris) const service = new FullEthereumService({ config, chain }) service.pool.ban = () => { - it('should ban peeer', () => { + it('should ban peer', () => { assert.ok(true, 'banned peer when NewBlock/NewBlockHashes announced after Merge') }) } @@ -292,7 +292,7 @@ describe('should handle NewPooledTransactionHashes', async () => { const service = new FullEthereumService({ config, chain }) service.txPool.handleAnnouncedTxHashes = async (msg, _peer, _pool) => { it('should handle NewPooledTransactionHashes', () => { - assert.deepEqual(msg[0], hexToBytes('0xabcd'), 'handled NewPooledTransactionhashes') + assert.deepEqual(msg[0], hexToBytes('0xabcd'), 'handled NewPooledTransactionHashes') }) } diff --git a/packages/client/test/service/lightethereumservice.spec.ts b/packages/client/test/service/lightethereumservice.spec.ts index ede731051b..8d7bfc0206 100644 --- a/packages/client/test/service/lightethereumservice.spec.ts +++ b/packages/client/test/service/lightethereumservice.spec.ts @@ -60,7 +60,7 @@ describe('should open', async () => { expect(server.addProtocols).toBeCalled() }) service.config.events.on(Event.SYNC_SYNCHRONIZED, () => { - it('should syncronize', () => { + it('should synchronize', () => { assert.ok(true, 'synchronized') }) }) diff --git a/packages/client/test/sim/4844-blobpost.spec.ts b/packages/client/test/sim/4844-blobpost.spec.ts index 68c41c4ec5..3282cfccff 100644 --- a/packages/client/test/sim/4844-blobpost.spec.ts +++ b/packages/client/test/sim/4844-blobpost.spec.ts @@ -36,7 +36,7 @@ console.log({ sender, rpcUrl, chainId, numTxs }) const network = 'sharding' const shardingJson = require(`./configs/${network}.json`) -// safely change chainId without modifying undelying json +// safely change chainId without modifying underlying json const commonJson = { ...shardingJson } commonJson.config = { ...commonJson.config, chainId } const common = createCommonFromGethGenesis(commonJson, { chain: network }) diff --git a/packages/client/test/sim/simutils.ts b/packages/client/test/sim/simutils.ts index cdd3479dc7..b2133470ed 100644 --- a/packages/client/test/sim/simutils.ts +++ b/packages/client/test/sim/simutils.ts @@ -1,3 +1,4 @@ +// cspell:ignore pkill import { executionPayloadFromBeaconPayload } from '@ethereumjs/block' import { createBlockchain } from '@ethereumjs/blockchain' import { create1559FeeMarketTx, create4844BlobTx } from '@ethereumjs/tx' @@ -608,7 +609,7 @@ export async function setupEngineUpdateRelay(client: EthereumClient, peerBeaconU } } -// To minimise noise on the spec run, selective filteration is applied to let the important events +// To minimize noise on the spec run, selective filtering is applied to let the important events // of the testnet log to show up in the spec log export const filterKeywords = [ 'warn', diff --git a/packages/client/test/sim/txGenerator.ts b/packages/client/test/sim/txGenerator.ts index 9fd4d2dde3..f1e042700d 100644 --- a/packages/client/test/sim/txGenerator.ts +++ b/packages/client/test/sim/txGenerator.ts @@ -1,3 +1,4 @@ +// cspell:ignore pdata datalen // Adapted from - https://github.com/Inphi/eip4844-interop/blob/master/blob_tx_generator/blob.js import { create4844BlobTx } from '@ethereumjs/tx' import { diff --git a/packages/client/test/sync/skeleton.spec.ts b/packages/client/test/sync/skeleton.spec.ts index e3edb0a0c6..a26853cfa8 100644 --- a/packages/client/test/sync/skeleton.spec.ts +++ b/packages/client/test/sync/skeleton.spec.ts @@ -736,7 +736,7 @@ describe('[Skeleton] / setHead', async () => { { common, setHardfork: true }, ) - // lets jump ahead and add the block 81 and 71 with annoucements and trigger tryTailBackfill + // lets jump ahead and add the block 81 and 71 with announcements and trigger tryTailBackfill await skeleton.forkchoiceUpdate(block91) assert.equal(skeleton['status'].progress.subchains.length, 1, '1 subchain with older dropped') assert.equal( diff --git a/packages/client/test/sync/txpool.spec.ts b/packages/client/test/sync/txpool.spec.ts index f4e495ef0d..4da3e65c2c 100644 --- a/packages/client/test/sync/txpool.spec.ts +++ b/packages/client/test/sync/txpool.spec.ts @@ -450,7 +450,7 @@ describe('[TxPool]', async () => { const poolContent = pool.pool.get(address)! assert.equal(poolContent.length, 1, 'only one tx') assert.deepEqual(poolContent[0].tx.hash(), txA01.hash(), 'only later-added tx') - // Another attempt to add tx which should not be broadcased to peer2 + // Another attempt to add tx which should not be broadcasted to peer2 await pool.handleAnnouncedTxHashes([txA01.hash()], peer, peerPool) assert.equal(sentToPeer2, 1, 'no new broadcast attempt to the peer') // Just to enhance logging coverage, assign peerPool for stats collection diff --git a/packages/client/test/util/parse.spec.ts b/packages/client/test/util/parse.spec.ts index 5069c7dbc6..a0ac847f96 100644 --- a/packages/client/test/util/parse.spec.ts +++ b/packages/client/test/util/parse.spec.ts @@ -23,9 +23,9 @@ describe('[Util/Parse]', () => { ) assert.deepEqual( parseMultiaddrs( - '/ip4/1.1.1.2/tcp/50508/ws/p2p/QmYAuYxw6QX1x5aafs6g3bUrPbMDifP5pDun3N9zbVLpEa', + '/ip4/1.1.1.2/tcp/50508/ws/p2p/QmYAuYxw6QX1x5aafs6g3bUrPbMDifP5pDun3N9zbVLpEa', // cspell:disable-line ), - [multiaddr('/ip4/1.1.1.2/tcp/50508/ws/p2p/QmYAuYxw6QX1x5aafs6g3bUrPbMDifP5pDun3N9zbVLpEa')], + [multiaddr('/ip4/1.1.1.2/tcp/50508/ws/p2p/QmYAuYxw6QX1x5aafs6g3bUrPbMDifP5pDun3N9zbVLpEa')], // cspell:disable-line 'parse multiaddr with peer id', ) assert.deepEqual( diff --git a/packages/common/src/common.ts b/packages/common/src/common.ts index 2a19008654..7b598ae1ba 100644 --- a/packages/common/src/common.ts +++ b/packages/common/src/common.ts @@ -87,7 +87,7 @@ export class Common { /** * Update the internal Common EIP params set. Existing values - * will get preserved unless there is a new value for a paramter + * will get preserved unless there is a new value for a parameter * provided with params. * * Example Format: @@ -157,7 +157,7 @@ export class Common { } /** - * Returns the hardfork either based on block numer (older HFs) or + * Returns the hardfork either based on block number (older HFs) or * timestamp (Shanghai upwards). * * @param Opts Block number or timestamp @@ -240,7 +240,7 @@ export class Common { } /** - * Sets a new hardfork either based on block numer (older HFs) or + * Sets a new hardfork either based on block number (older HFs) or * timestamp (Shanghai upwards). * * @param Opts Block number or timestamp diff --git a/packages/common/src/eips.ts b/packages/common/src/eips.ts index bb0072c46f..091fae9ce4 100644 --- a/packages/common/src/eips.ts +++ b/packages/common/src/eips.ts @@ -35,7 +35,7 @@ export const eipsDict: EIPsDict = { minimumHardfork: Hardfork.SpuriousDragon, }, /** - * Constantinope HF Meta EIP + * Constantinople HF Meta EIP */ 1013: { minimumHardfork: Hardfork.Constantinople, diff --git a/packages/common/src/interfaces.ts b/packages/common/src/interfaces.ts index f8c224e38f..03f189b57e 100644 --- a/packages/common/src/interfaces.ts +++ b/packages/common/src/interfaces.ts @@ -145,7 +145,7 @@ export interface StateManagerInterface { * Extra Functionality * * Optional non-essential methods, these methods should always be guarded - * on usage (check for existance) + * on usage (check for existence) */ // Client RPC getProof?(address: Address, storageSlots: Uint8Array[]): Promise diff --git a/packages/common/src/utils.ts b/packages/common/src/utils.ts index 090591a69a..ec1f549247 100644 --- a/packages/common/src/utils.ts +++ b/packages/common/src/utils.ts @@ -1,3 +1,4 @@ +// cspell:ignore blockperiodseconds import { intToHex, isHexString, stripHexPrefix } from '@ethereumjs/util' import { Goerli, Holesky, Kaustinen6, Mainnet, Sepolia } from './chains.js' diff --git a/packages/common/test/chains.spec.ts b/packages/common/test/chains.spec.ts index a96ca4e951..d7ad6e6b98 100644 --- a/packages/common/test/chains.spec.ts +++ b/packages/common/test/chains.spec.ts @@ -47,7 +47,7 @@ describe('[Common/Chains]: Initialization / Chain params', () => { it('Should handle initialization errors', () => { const f = function () { - new Common({ chain: Mainnet, hardfork: 'hardforknotexisting' }) + new Common({ chain: Mainnet, hardfork: 'hardforkNotExisting' }) } const msg = 'should throw an exception on non-existing hardfork' assert.throws(f, /not supported$/, undefined, msg) // eslint-disable-line no-new diff --git a/packages/common/test/data/paramsTest.ts b/packages/common/test/data/paramsTest.ts index b6121c1b65..367c2e3c78 100644 --- a/packages/common/test/data/paramsTest.ts +++ b/packages/common/test/data/paramsTest.ts @@ -18,7 +18,7 @@ export const paramsTest: ParamsDict = { minerReward: '3000000000000000000', // the amount a miner get rewarded for mining a block }, /** -. * Constantinope HF Meta EIP +. * Constantinople HF Meta EIP . */ 1013: { // gasPrices diff --git a/packages/common/test/hardforks.spec.ts b/packages/common/test/hardforks.spec.ts index fa929bd752..d61f1e8080 100644 --- a/packages/common/test/hardforks.spec.ts +++ b/packages/common/test/hardforks.spec.ts @@ -1,3 +1,4 @@ +// cspell:ignore yolov import { hexToBytes, zeros } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' @@ -318,7 +319,7 @@ describe('[Common]: Hardfork logic', () => { const zeroCommonShanghaiFork = zeroCommon.forkHash(Hardfork.Shanghai, genesisHash) const zeroCommonCancunFork = zeroCommon.forkHash(Hardfork.Shanghai, genesisHash) - // Ensure that Shangai fork + Cancun fork have equal forkhash + // Ensure that Shanghai fork + Cancun fork have equal forkhash assert.equal(zeroCommonShanghaiFork, zeroCommonCancunFork) // Set the cancun time to the genesis block time (this should not change the forkHash) diff --git a/packages/common/test/params.spec.ts b/packages/common/test/params.spec.ts index 9e0b913c7d..5d2e086877 100644 --- a/packages/common/test/params.spec.ts +++ b/packages/common/test/params.spec.ts @@ -4,7 +4,7 @@ import { Common, Hardfork, Mainnet } from '../src/index.js' import { paramsTest } from './data/paramsTest.js' -describe('[Common]: Parameter instantion / params option / Updates', () => { +describe('[Common]: Parameter instantiation / params option / Updates', () => { it('Param option', () => { const c = new Common({ chain: Mainnet, params: paramsTest }) let msg = 'Should also work with parameters passed with params option' @@ -46,7 +46,7 @@ describe('[Common]: Parameter access for param(), paramByHardfork()', () => { assert.equal(c.param('ecAddGas'), BigInt(150), msg) assert.throws(() => { - c.paramByHardfork('notexistingvalue', 'byzantium') + c.paramByHardfork('notExistingValue', 'byzantium') }) /* @@ -115,10 +115,10 @@ describe('[Common]: Parameter access for param(), paramByHardfork()', () => { const c = new Common({ chain: Mainnet, params: paramsTest }) assert.throws(() => { - c.paramByEIP('notexistingvalue', 1559) + c.paramByEIP('notExistingValue', 1559) }) assert.throws(() => { - c.paramByEIP('notexistingvalue', 2537) + c.paramByEIP('notExistingValue', 2537) }) const UNSUPPORTED_EIP = 1000000 diff --git a/packages/common/test/utils.spec.ts b/packages/common/test/utils.spec.ts index 7dff0e0a39..f9a9e2a8da 100644 --- a/packages/common/test/utils.spec.ts +++ b/packages/common/test/utils.spec.ts @@ -89,7 +89,7 @@ describe('[Utils/Parse]', () => { ) }) - it('should correctly parse deposit contract adddress', async () => { + it('should correctly parse deposit contract address', async () => { // clone json out to not have side effects const customJson = JSON.parse(JSON.stringify(postMergeHardforkJSON)) Object.assign(customJson.config, { diff --git a/packages/devp2p/src/dns/dns.ts b/packages/devp2p/src/dns/dns.ts index ac526b30c1..2b0ad7226a 100644 --- a/packages/devp2p/src/dns/dns.ts +++ b/packages/devp2p/src/dns/dns.ts @@ -129,7 +129,7 @@ export class DNS { * * @param {string[]} branches * @param {SearchContext} context - * @return {String} subdomian + * @return {String} subdomain */ private _selectRandomPath(branches: string[], context: SearchContext): string { // Identify domains already visited in this traversal of the DNS tree. diff --git a/packages/devp2p/src/dns/enr.ts b/packages/devp2p/src/dns/enr.ts index 43ad937c35..5213e9aebf 100644 --- a/packages/devp2p/src/dns/enr.ts +++ b/packages/devp2p/src/dns/enr.ts @@ -1,3 +1,4 @@ +// cspell:ignore Vals import { RLP } from '@ethereumjs/rlp' import { bytesToUtf8, utf8ToBytes } from '@ethereumjs/util' import { base32, base64url } from '@scure/base' @@ -100,7 +101,7 @@ export class ENR { if (!root.startsWith(this.ROOT_PREFIX)) throw new Error(`ENR root entry must start with '${this.ROOT_PREFIX}'`) - const rootVals = sscanf( + const rootValues = sscanf( root, `${this.ROOT_PREFIX}v1 e=%s l=%s seq=%d sig=%s`, 'eRoot', @@ -109,10 +110,10 @@ export class ENR { 'signature', ) as ENRRootValues - if (!rootVals.eRoot) throw new Error("Could not parse 'e' value from ENR root entry") - if (!rootVals.lRoot) throw new Error("Could not parse 'l' value from ENR root entry") - if (!rootVals.seq) throw new Error("Could not parse 'seq' value from ENR root entry") - if (!rootVals.signature) throw new Error("Could not parse 'sig' value from ENR root entry") + if (!rootValues.eRoot) throw new Error("Could not parse 'e' value from ENR root entry") + if (!rootValues.lRoot) throw new Error("Could not parse 'l' value from ENR root entry") + if (!rootValues.seq) throw new Error("Could not parse 'seq' value from ENR root entry") + if (!rootValues.signature) throw new Error("Could not parse 'sig' value from ENR root entry") const decodedPublicKey = [...base32.decode(publicKey + '===').values()] @@ -122,7 +123,7 @@ export class ENR { const signedComponent = root.split(' sig')[0] const signedComponentBytes = utf8ToBytes(signedComponent) const signatureBytes = Uint8Array.from( - [...base64url.decode(rootVals.signature + '=').values()].slice(0, 64), + [...base64url.decode(rootValues.signature + '=').values()].slice(0, 64), ) const keyBytes = Uint8Array.from(decodedPublicKey) @@ -135,7 +136,7 @@ export class ENR { if (!isVerified) throw new Error('Unable to verify ENR root signature') - return rootVals.eRoot + return rootValues.eRoot } /** diff --git a/packages/devp2p/src/dpt/server.ts b/packages/devp2p/src/dpt/server.ts index 73b3c16076..e9cef54dd0 100644 --- a/packages/devp2p/src/dpt/server.ts +++ b/packages/devp2p/src/dpt/server.ts @@ -1,3 +1,4 @@ +// cspell:ignore rckey rkey import { bytesToHex, bytesToUnprefixedHex } from '@ethereumjs/util' import debugDefault from 'debug' import * as dgram from 'dgram' diff --git a/packages/devp2p/src/ext/kbucket.ts b/packages/devp2p/src/ext/kbucket.ts index 38f25eeab2..2892bc21f0 100644 --- a/packages/devp2p/src/ext/kbucket.ts +++ b/packages/devp2p/src/ext/kbucket.ts @@ -1,3 +1,4 @@ +// cspell:ignore Kademlia Slominski tomonari dont /* index.js - Kademlia DHT K-bucket implementation as a binary tree. @@ -154,7 +155,7 @@ export class KBucket { // we need to ping the first this._numberOfNodesToPing // in order to determine if they are alive // only if one of the pinged nodes does not respond, can the new contact - // be added (this prevents DoS flodding with new invalid contacts) + // be added (this prevents DoS flooding with new invalid contacts) this.events.emit('ping', node.contacts.slice(0, this._numberOfNodesToPing), contact) return this } diff --git a/packages/devp2p/src/rlpx/ecies.ts b/packages/devp2p/src/rlpx/ecies.ts index fd59b7af8e..68b9d21a92 100644 --- a/packages/devp2p/src/rlpx/ecies.ts +++ b/packages/devp2p/src/rlpx/ecies.ts @@ -1,3 +1,4 @@ +// cspell:ignore mkey import { RLP } from '@ethereumjs/rlp' import { bytesToInt, concatBytes, hexToBytes, intToBytes } from '@ethereumjs/util' import * as crypto from 'crypto' @@ -237,7 +238,7 @@ export class ECIES { let signature = null let recoveryId = null - let heid = null + let heId = null let remotePublicKey = null let nonce = null @@ -246,7 +247,7 @@ export class ECIES { signature = decrypted.subarray(0, 64) recoveryId = decrypted[64] - heid = decrypted.subarray(65, 97) // 32 bytes + heId = decrypted.subarray(65, 97) // 32 bytes remotePublicKey = id2pk(decrypted.subarray(97, 161)) nonce = decrypted.subarray(161, 193) } else { @@ -277,10 +278,10 @@ export class ECIES { if (this._remoteEphemeralPublicKey === null) return this._ephemeralSharedSecret = ecdhX(this._remoteEphemeralPublicKey, this._ephemeralPrivateKey) - if (heid !== null && this._remoteEphemeralPublicKey !== null) { + if (heId !== null && this._remoteEphemeralPublicKey !== null) { assertEq( this._keccakFunction(pk2id(this._remoteEphemeralPublicKey)), - heid, + heId, 'the hash of the ephemeral key should match', debug, ) diff --git a/packages/devp2p/src/rlpx/rlpx.ts b/packages/devp2p/src/rlpx/rlpx.ts index 7e5f49a158..00454c1980 100644 --- a/packages/devp2p/src/rlpx/rlpx.ts +++ b/packages/devp2p/src/rlpx/rlpx.ts @@ -112,8 +112,8 @@ export class RLPx { this._peers = new Map() this._peersQueue = [] this._peersLRU = new LRUCache({ max: 25000 }) - const REFILL_INTERVALL = 10000 // 10 sec * 1000 - const refillIntervalSubdivided = Math.floor(REFILL_INTERVALL / 10) + const REFILL_INTERVAL = 10000 // 10 sec * 1000 + const refillIntervalSubdivided = Math.floor(REFILL_INTERVAL / 10) this._refillIntervalId = setInterval(() => this._refillConnections(), refillIntervalSubdivided) this._keccakFunction = options.common?.customCrypto.keccak256 ?? keccak256 diff --git a/packages/devp2p/src/util.ts b/packages/devp2p/src/util.ts index e1de5db726..ea0aa1346f 100644 --- a/packages/devp2p/src/util.ts +++ b/packages/devp2p/src/util.ts @@ -1,3 +1,4 @@ +// cspell:ignore Fedor Indutny import { RLP } from '@ethereumjs/rlp' import { bytesToHex, bytesToUnprefixedHex, concatBytes, equalsBytes } from '@ethereumjs/util' import debug from 'debug' diff --git a/packages/devp2p/test/dns.spec.ts b/packages/devp2p/test/dns.spec.ts index 70bdb3d018..ff20fd020d 100644 --- a/packages/devp2p/test/dns.spec.ts +++ b/packages/devp2p/test/dns.spec.ts @@ -20,6 +20,7 @@ describe('DNS', () => { } const host = 'nodes.example.org' + // cspell:disable const rootDomain = 'JORXBYVVM7AEKETX5DGXW44EAY' const branchDomainA = 'D2SNLTAGWNQ34NTQTPHNZDECFU' const branchDomainB = 'D3SNLTAGWNQ34NTQTPHNZDECFU' @@ -27,6 +28,7 @@ describe('DNS', () => { const branchDomainD = 'D5SNLTAGWNQ34NTQTPHNZDECFU' const partialBranchA = 'AAAA' const partialBranchB = 'BBBB' + // cspell:enable const singleBranch = `enrtree-branch:${branchDomainA}` const doubleBranch = `enrtree-branch:${branchDomainA},${branchDomainB}` const multiComponentBranch = [ @@ -153,7 +155,7 @@ describe('DNS', () => { }) describe('DNS: (integration)', () => { - const publicKey = 'AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE' + const publicKey = 'AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE' // cspell:disable-line const goerliDNS = 'all.goerli.ethdisco.net' const enrTree = `enrtree://${publicKey}@${goerliDNS}` const ipTestRegex = /^\d+\.\d+\.\d+\.\d+$/ // e.g 123.44.55.77 diff --git a/packages/devp2p/test/enr.spec.ts b/packages/devp2p/test/enr.spec.ts index 60b1858740..9882a41137 100644 --- a/packages/devp2p/test/enr.spec.ts +++ b/packages/devp2p/test/enr.spec.ts @@ -10,7 +10,7 @@ describe('ENR tests', () => { // Root DNS entries it('ENR (root): should parse and verify and DNS root entry', () => { const subdomain = ENR.parseAndVerifyRoot(dns.enrRoot, dns.publicKey) - assert.equal(subdomain, 'JORXBYVVM7AEKETX5DGXW44EAY', 'returns correct subdomain') + assert.equal(subdomain, 'JORXBYVVM7AEKETX5DGXW44EAY', 'returns correct subdomain') // cspell:disable-line }) it('ENR (root): should error if DNS root entry is mis-prefixed', () => { @@ -79,9 +79,11 @@ describe('ENR tests', () => { // Branch entries it('ENR (branch): should parse and verify a single component DNS branch entry', () => { const expected = [ + // cspell:disable 'D2SNLTAGWNQ34NTQTPHNZDECFU', '67BLTJEU5R2D5S3B4QKJSBRFCY', 'A2HDMZBB4JIU53VTEGC4TG6P4A', + // cspell:enable ] const branches = ENR.parseBranch(dns.enrBranch) diff --git a/packages/evm/scripts/eofContainerValidator.ts b/packages/evm/scripts/eofContainerValidator.ts index a1265db084..7a15bf0076 100644 --- a/packages/evm/scripts/eofContainerValidator.ts +++ b/packages/evm/scripts/eofContainerValidator.ts @@ -8,7 +8,7 @@ import { createEVM, validateEOF } from '../src/index.js' * This script reads hex strings (either prefixed or non-prefixed with 0x) from stdin * It tries to validate the EOF container, if it is valid, it will print "OK" * If there is a validation error, it will print "err: " - * If the input is emtpy, the program will exit + * If the input is empty, the program will exit */ const common = new Common({ chain: Mainnet }) diff --git a/packages/evm/src/eof/errors.ts b/packages/evm/src/eof/errors.ts index 2d3c3773ce..e3182f1c97 100644 --- a/packages/evm/src/eof/errors.ts +++ b/packages/evm/src/eof/errors.ts @@ -52,7 +52,7 @@ export enum EOFError { // Dangling Bytes DanglingBytes = 'got dangling bytes in body', - // Code verifcation + // Code verification InvalidOpcode = 'invalid opcode', InvalidTerminator = 'invalid terminating opcode', OpcodeIntermediatesOOB = 'invalid opcode: intermediates out-of-bounds', diff --git a/packages/evm/src/evm.ts b/packages/evm/src/evm.ts index d76a7024f9..15b0e8fc85 100644 --- a/packages/evm/src/evm.ts +++ b/packages/evm/src/evm.ts @@ -303,13 +303,13 @@ export class EVM implements EVMInterface { if (gasLimit < BIGINT_0) { if (this.DEBUG) { debugGas( - `Proof of absense access charged(${absenceProofAccessGas}) caused OOG (-> ${gasLimit})`, + `Proof of absence access charged(${absenceProofAccessGas}) caused OOG (-> ${gasLimit})`, ) } return { execResult: OOGResult(message.gasLimit) } } else { if (this.DEBUG) { - debugGas(`Proof of absense access used (${absenceProofAccessGas} gas (-> ${gasLimit}))`) + debugGas(`Proof of absence access used (${absenceProofAccessGas} gas (-> ${gasLimit}))`) } } } diff --git a/packages/evm/src/interpreter.ts b/packages/evm/src/interpreter.ts index 0a0b153cbf..661654322b 100644 --- a/packages/evm/src/interpreter.ts +++ b/packages/evm/src/interpreter.ts @@ -1,3 +1,4 @@ +// cspell:ignore dests import { ConsensusAlgorithm } from '@ethereumjs/common' import { Account, @@ -287,7 +288,7 @@ export class Interpreter { } // if its an invalid opcode with verkle activated, then check if its because of a missing code - // chunk in the witness, and throw appropriate error to distinguish from an actual invalid opcod + // chunk in the witness, and throw appropriate error to distinguish from an actual invalid opcode if ( opCode === 0xfe && this.common.isActivatedEIP(6800) && @@ -527,13 +528,13 @@ export class Interpreter { useGas(amount: bigint, context?: string | Opcode): void { this._runState.gasLeft -= amount if (this._evm.DEBUG) { - let tstr = '' + let tempString = '' if (typeof context === 'string') { - tstr = context + ': ' + tempString = context + ': ' } else if (context !== undefined) { - tstr = `${context.name} fee: ` + tempString = `${context.name} fee: ` } - debugGas(`${tstr}used ${amount} gas (-> ${this._runState.gasLeft})`) + debugGas(`${tempString}used ${amount} gas (-> ${this._runState.gasLeft})`) } if (this._runState.gasLeft < BIGINT_0) { this._runState.gasLeft = BIGINT_0 diff --git a/packages/evm/src/opcodes/util.ts b/packages/evm/src/opcodes/util.ts index 6d474143be..7486281348 100644 --- a/packages/evm/src/opcodes/util.ts +++ b/packages/evm/src/opcodes/util.ts @@ -173,9 +173,9 @@ export function subMemUsage(runState: RunState, offset: bigint, length: bigint, const words = newMemoryWordCount const fee = common.param('memoryGas') - const quadCoeff = common.param('quadCoeffDivGas') + const quadCoefficient = common.param('quadCoeffDivGas') // cspell:disable-line // words * 3 + words ^2 / 512 - let cost = words * fee + (words * words) / quadCoeff + let cost = words * fee + (words * words) / quadCoefficient if (cost > runState.highestMemCost) { const currentHighestMemCost = runState.highestMemCost diff --git a/packages/evm/src/params.ts b/packages/evm/src/params.ts index fc30de4968..8569f464f3 100644 --- a/packages/evm/src/params.ts +++ b/packages/evm/src/params.ts @@ -1,3 +1,4 @@ +// cspell:ignore coeff import type { ParamsDict } from '@ethereumjs/common' export const paramsEVM: ParamsDict = { @@ -24,7 +25,7 @@ export const paramsEVM: ParamsDict = { createGas: 32000, // Base fee of the CREATE opcode callGas: 40, // Base fee of the CALL opcode callStipendGas: 2300, // Free gas given at beginning of call - callValueTransferGas: 9000, // Paid for CALL when the value transfor is non-zero + callValueTransferGas: 9000, // Paid for CALL when the value transfer is non-zero callNewAccountGas: 25000, // Paid for CALL when the destination address didn't exist prior selfdestructRefundGas: 24000, // Refunded following a selfdestruct operation memoryGas: 3, // Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL @@ -96,7 +97,7 @@ export const paramsEVM: ParamsDict = { returnGas: 0, // Base fee of the RETURN opcode invalidGas: 0, // Base fee of the INVALID opcode selfdestructGas: 0, // Base fee of the SELFDESTRUCT opcode - prevrandaoGas: 0, // TODO: these below 0-gas additons might also point to non-clean implementations in the code base + prevrandaoGas: 0, // TODO: these below 0-gas additions might also point to non-clean implementations in the code base // evm stackLimit: 1024, // Maximum size of VM stack allowed callCreateDepth: 1024, // Maximum depth of call/create stack @@ -147,7 +148,7 @@ export const paramsEVM: ParamsDict = { returndatacopyGas: 3, // Base fee of the RETURNDATACOPY opcode }, /** -. * Constantinope HF Meta EIP +. * Constantinople HF Meta EIP . */ 1013: { // gasPrices diff --git a/packages/evm/src/precompiles/05-modexp.ts b/packages/evm/src/precompiles/05-modexp.ts index e0411a474c..ed72fd0689 100644 --- a/packages/evm/src/precompiles/05-modexp.ts +++ b/packages/evm/src/precompiles/05-modexp.ts @@ -1,3 +1,4 @@ +// cspell:ignore mult expmod import { BIGINT_0, BIGINT_1, diff --git a/packages/evm/src/precompiles/0d-bls12-g1msm.ts b/packages/evm/src/precompiles/0d-bls12-g1msm.ts index 257265cb27..44e667f693 100644 --- a/packages/evm/src/precompiles/0d-bls12-g1msm.ts +++ b/packages/evm/src/precompiles/0d-bls12-g1msm.ts @@ -18,7 +18,7 @@ export async function precompile0d(opts: PrecompileInput): Promise { if (opts._debug !== undefined) { opts._debug(`BLS12G1MSM (0x0d) failed: Empty input`) } - return EvmErrorResult(new EvmError(ERROR.BLS_12_381_INPUT_EMPTY), opts.gasLimit) // follow Geths implementation + return EvmErrorResult(new EvmError(ERROR.BLS_12_381_INPUT_EMPTY), opts.gasLimit) // follow Geth's implementation } // TODO: Double-check respectively confirm that this order is really correct that the gas check diff --git a/packages/evm/src/precompiles/10-bls12-g2msm.ts b/packages/evm/src/precompiles/10-bls12-g2msm.ts index f637959f38..d62d0d0c52 100644 --- a/packages/evm/src/precompiles/10-bls12-g2msm.ts +++ b/packages/evm/src/precompiles/10-bls12-g2msm.ts @@ -16,7 +16,7 @@ export async function precompile10(opts: PrecompileInput): Promise { if (opts._debug !== undefined) { opts._debug(`BLS12G2MSM (0x10) failed: Empty input`) } - return EvmErrorResult(new EvmError(ERROR.BLS_12_381_INPUT_EMPTY), opts.gasLimit) // follow Geths implementation + return EvmErrorResult(new EvmError(ERROR.BLS_12_381_INPUT_EMPTY), opts.gasLimit) // follow Geth's implementation } const numPairs = Math.floor(opts.data.length / 288) diff --git a/packages/evm/src/precompiles/bls12_381/noble.ts b/packages/evm/src/precompiles/bls12_381/noble.ts index 31737d5d40..0742095477 100644 --- a/packages/evm/src/precompiles/bls12_381/noble.ts +++ b/packages/evm/src/precompiles/bls12_381/noble.ts @@ -67,7 +67,7 @@ function BLS12_381_FromG1Point(input: AffinePoint): Uint8Array { * @returns Noble G2 point */ function BLS12_381_ToG2Point(input: Uint8Array): any { - // TODO: remove any type, temporary fix due to conflicing @noble/curves versions + // TODO: remove any type, temporary fix due to conflicting @noble/curves versions if (equalsBytes(input, BLS_G2_INFINITY_POINT_BYTES)) { return bls12_381.G2.ProjectivePoint.ZERO } @@ -111,10 +111,10 @@ function BLS12_381_ToFrPoint(input: Uint8Array): bigint { // It should be nevertheless validated if this is (fully) correct, // especially if ">" or ">=" should be applied. // - // Unfortunately the skalar in both test vectors is significantly + // Unfortunately the scalar in both test vectors is significantly // greater than the ORDER threshold, here are th values from both tests: // - // Skalar / Order + // Scalar / Order // 69732848789442042582239751384143889712113271203482973843852656394296700715236n // 52435875175126190479447740508185965837690552500527637822603658699938581184513n // @@ -143,7 +143,7 @@ function BLS12_381_ToFpPoint(fpCoordinate: Uint8Array) { } function BLS12_381_ToFp2Point(fpXCoordinate: Uint8Array, fpYCoordinate: Uint8Array): any { - // TODO: remove any type, temporary fix due to conflicing @noble/curves versions + // TODO: remove any type, temporary fix due to conflicting @noble/curves versions // check if the coordinates are in the field if (bytesToBigInt(fpXCoordinate) >= BLS_FIELD_MODULUS) { throw new EvmError(ERROR.BLS_12_381_FP_NOT_IN_FIELD) @@ -180,12 +180,12 @@ export class NobleBLS implements EVMBLSInterface { mulG1(input: Uint8Array): Uint8Array { // convert input to G1 points, add them, and convert the output to a Uint8Array. const p = BLS12_381_ToG1Point(input.subarray(0, BLS_G1_POINT_BYTE_LENGTH)) - const skalar = BLS12_381_ToFrPoint(input.subarray(BLS_G1_POINT_BYTE_LENGTH, 160)) + const scalar = BLS12_381_ToFrPoint(input.subarray(BLS_G1_POINT_BYTE_LENGTH, 160)) - if (skalar === BIGINT_0) { + if (scalar === BIGINT_0) { return BLS_G1_INFINITY_POINT_BYTES } - const result = p.multiply(skalar) + const result = p.multiply(scalar) return BLS12_381_FromG1Point(result) } @@ -203,12 +203,12 @@ export class NobleBLS implements EVMBLSInterface { mulG2(input: Uint8Array): Uint8Array { // convert input to G2 point/Fr point, add them, and convert the output to a Uint8Array. const p = BLS12_381_ToG2Point(input.subarray(0, BLS_G2_POINT_BYTE_LENGTH)) - const skalar = BLS12_381_ToFrPoint(input.subarray(BLS_G2_POINT_BYTE_LENGTH, 288)) + const scalar = BLS12_381_ToFrPoint(input.subarray(BLS_G2_POINT_BYTE_LENGTH, 288)) - if (skalar === BIGINT_0) { + if (scalar === BIGINT_0) { return BLS_G2_INFINITY_POINT_BYTES } - const result = p.multiply(skalar) + const result = p.multiply(scalar) return BLS12_381_FromG2Point(result) } diff --git a/packages/evm/src/precompiles/bn254/noble.ts b/packages/evm/src/precompiles/bn254/noble.ts index 5f3396602d..6ebe092f00 100644 --- a/packages/evm/src/precompiles/bn254/noble.ts +++ b/packages/evm/src/precompiles/bn254/noble.ts @@ -69,7 +69,7 @@ function toFrPoint(input: Uint8Array): bigint { * @returns Noble G2 point */ function toG2Point(input: Uint8Array): any { - // TODO: remove any type, temporary fix due to conflicing @noble/curves versions + // TODO: remove any type, temporary fix due to conflicting @noble/curves versions if (equalsBytes(input, G2_INFINITY_POINT_BYTES)) { return bn254.G2.ProjectivePoint.ZERO } diff --git a/packages/evm/src/stack.ts b/packages/evm/src/stack.ts index e2ab7e964f..d8ff351cb2 100644 --- a/packages/evm/src/stack.ts +++ b/packages/evm/src/stack.ts @@ -38,7 +38,7 @@ export class Stack { // Length is checked above, so pop shouldn't return undefined // First decrease current length, then read the item and return it // Note: this does thus not delete the item from the internal array - // However, the length is decreased, so it is not accessible to external observors + // However, the length is decreased, so it is not accessible to external observers return this._store[--this._len] } diff --git a/packages/evm/test/customPrecompiles.spec.ts b/packages/evm/test/customPrecompiles.spec.ts index 7829d6e670..e74f13a39a 100644 --- a/packages/evm/test/customPrecompiles.spec.ts +++ b/packages/evm/test/customPrecompiles.spec.ts @@ -145,7 +145,7 @@ describe('EVM -> custom precompiles', () => { 'restored sha precompile - gas correct', ) }) - it('shold copy custom precompiles', async () => { + it('should copy custom precompiles', async () => { const evm = await createEVM({ customPrecompiles: [ { diff --git a/packages/evm/test/eips/eip-3860.spec.ts b/packages/evm/test/eips/eip-3860.spec.ts index 557e479190..09a38485c1 100644 --- a/packages/evm/test/eips/eip-3860.spec.ts +++ b/packages/evm/test/eips/eip-3860.spec.ts @@ -164,7 +164,7 @@ describe('EIP 3860 tests', () => { const result = await evm.runCall(runCallArgs) assert.ok( result.execResult.exceptionError === undefined, - 'succesfully created a contract with data size > MAX_INITCODE_SIZE and allowUnlimitedInitCodeSize active', + 'successfully created a contract with data size > MAX_INITCODE_SIZE and allowUnlimitedInitCodeSize active', ) }) @@ -194,7 +194,7 @@ describe('EIP 3860 tests', () => { // Attempts to create a contract of X size // (the initcode of this contract is just zeros, so STOP opcode // It stores the topmost stack item of this CREATE(2) at slot 0 - // This is either the contract address if it was succesful, or 0 in case of error + // This is either the contract address if it was successful, or 0 in case of error const factoryCode = hexToBytes(`0x600060003560006000${code}600055`) await evm.stateManager.putCode(contractFactory, factoryCode) diff --git a/packages/evm/test/precompiles/05-modexp.spec.ts b/packages/evm/test/precompiles/05-modexp.spec.ts index ade2fb356d..e9dc5edf4f 100644 --- a/packages/evm/test/precompiles/05-modexp.spec.ts +++ b/packages/evm/test/precompiles/05-modexp.spec.ts @@ -35,8 +35,8 @@ describe('Precompiles: MODEXP', () => { common, _EVM: evm, }) - const oput = bytesToHex(result.returnValue) - assert.equal(oput, expect) + const output = bytesToHex(result.returnValue) + assert.equal(output, expect) }) } diff --git a/packages/evm/test/runCall.spec.ts b/packages/evm/test/runCall.spec.ts index 7fd3cbfaee..f8dc027917 100644 --- a/packages/evm/test/runCall.spec.ts +++ b/packages/evm/test/runCall.spec.ts @@ -1,3 +1,4 @@ +// cspell:ignore AACC AAAB import { Common, Hardfork, Mainnet, createCommonFromGethGenesis } from '@ethereumjs/common' import { Account, diff --git a/packages/rlp/src/index.ts b/packages/rlp/src/index.ts index 7d9527bc18..63bba83481 100644 --- a/packages/rlp/src/index.ts +++ b/packages/rlp/src/index.ts @@ -1,3 +1,4 @@ +// cspell:ignore llength export type Input = string | number | bigint | Uint8Array | Array | null | undefined export type NestedUint8Array = Array diff --git a/packages/rlp/test/dataTypes.spec.ts b/packages/rlp/test/dataTypes.spec.ts index ff95ecb621..20105c0563 100644 --- a/packages/rlp/test/dataTypes.spec.ts +++ b/packages/rlp/test/dataTypes.spec.ts @@ -11,7 +11,7 @@ describe('invalid RLPs', () => { // prettier-ignore { input: Uint8Array.from([239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 239, 191, 189, 29, 239, 191, 189, 77, 239, 191, 189, 239, 191, 189, 239, 191, 189, 93, 122, 239, 191, 189, 239, 191, 189, 239, 191, 189, 103, 239, 191, 189, 239, 191, 189, 239, 191, 189, 26, 239, 191, 189, 18, 69, 27, 239, 191, 189, 239, 191, 189, 116, 19, 239, 191, 189, 239, 191, 189, 66, 239, 191, 189, 64, 212, 147, 71, 239, 191, 189, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 239, 191, 189, 11, 222, 155, 122, 54, 42, 194, 169, 239, 191, 189, 70, 239, 191, 189, 72, 239, 191, 189, 239, 191, 189, 54, 53, 239, 191, 189, 100, 73, 239, 191, 189, 55, 239, 191, 189, 239, 191, 189, 59, 1, 239, 191, 189, 109, 239, 191, 189, 239, 191, 189, 93, 239, 191, 189, 208, 128, 239, 191, 189, 239, 191, 189, 0, 239, 191, 189, 239, 191, 189, 239, 191, 189, 15, 66, 64, 239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 4, 239, 191, 189, 79, 103, 239, 191, 189, 85, 239, 191, 189, 239, 191, 189, 239, 191, 189, 74, 239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 54, 239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 83, 239, 191, 189, 14, 239, 191, 189, 239, 191, 189, 239, 191, 189, 4, 63, 239, 191, 189, 63, 239, 191, 189, 41, 239, 191, 189, 239, 191, 189, 239, 191, 189, 67, 28, 239, 191, 189, 239, 191, 189, 11, 239, 191, 189, 31, 239, 191, 189, 239, 191, 189, 104, 96, 100, 239, 191, 189, 239, 191, 189, 12, 239, 191, 189, 239, 191, 189, 206, 152, 239, 191, 189, 239, 191, 189, 31, 112, 111, 239, 191, 189, 239, 191, 189, 65, 239, 191, 189, 41, 239, 191, 189, 239, 191, 189, 53, 84, 11, 239, 191, 189, 239, 191, 189, 12, 102, 24, 12, 42, 105, 109, 239, 191, 189, 58, 239, 191, 189, 4, 239, 191, 189, 104, 82, 9, 239, 191, 189, 6, 66, 91, 43, 38, 102, 117, 239, 191, 189, 105, 239, 191, 189, 239, 191, 189, 239, 191, 189, 89, 127, 239, 191, 189, 114]) }, { - input: hexToBytes('efdebd'), + input: hexToBytes('efdebd'), // cspell:disable-line msg: 'invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds', }, { @@ -19,7 +19,7 @@ describe('invalid RLPs', () => { msg: 'invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds', }, { - input: hexToBytes('efdebdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), + input: hexToBytes('efdebdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), // cspell:disable-line msg: 'invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds', }, ] @@ -57,7 +57,7 @@ describe('RLP encoding (string)', () => { it('length of string >55 should return 0xb7+len(len(data)) plus len(data) plus data', () => { const encodedLongString = RLP.encode( - 'zoo255zoo255zzzzzzzzzzzzssssssssssssssssssssssssssssssssssssssssssssss', + 'zoo255zoo255zzzzzzzzzzzzssssssssssssssssssssssssssssssssssssssssssssss', // cspell:disable-line ) assert.deepEqual(72, encodedLongString.length) assert.deepEqual(encodedLongString[0], 184) @@ -83,7 +83,7 @@ describe('RLP encoding (list)', () => { 'dog', 'god', 'cat', - 'zoo255zoo255zzzzzzzzzzzzssssssssssssssssssssssssssssssssssssssssssssss', + 'zoo255zoo255zzzzzzzzzzzzssssssssssssssssssssssssssssssssssssssssssssss', // cspell:disable-line ] const encodedArrayOfStrings = RLP.encode(data) const str = bytesToUtf8(encodedArrayOfStrings) @@ -92,7 +92,7 @@ describe('RLP encoding (list)', () => { } // Verified with Geth's RLPDump const expected = hexToBytes( - 'f85483646f6783676f6483636174b8467a6f6f3235357a6f6f3235357a7a7a7a7a7a7a7a7a7a7a7a73737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373', + 'f85483646f6783676f6483636174b8467a6f6f3235357a6f6f3235357a7a7a7a7a7a7a7a7a7a7a7a73737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373', // cspell:disable-line ) assert.deepEqual(encodedArrayOfStrings, expected) }) diff --git a/packages/rlp/test/invalid.spec.ts b/packages/rlp/test/invalid.spec.ts index be0280dbf9..ed107b8026 100644 --- a/packages/rlp/test/invalid.spec.ts +++ b/packages/rlp/test/invalid.spec.ts @@ -27,7 +27,7 @@ describe('invalid tests', () => { it('should pass long string sanity check test', function () { // long string invalid test; string length > 55 const longBufferTest = RLP.encode( - 'zoo255zoo255zzzzzzzzzzzzssssssssssssssssssssssssssssssssssssssssssssss', + 'zoo255zoo255zzzzzzzzzzzzssssssssssssssssssssssssssssssssssssssssssssss', // cspell:disable-line ) // sanity checks assert.ok(longBufferTest[0] > 0xb7) @@ -47,7 +47,7 @@ describe('invalid tests', () => { // The tests below are taken from Geth // https://github.com/ethereum/go-ethereum/blob/99be62a9b16fd7b3d1e2e17f1e571d3bef34f122/rlp/decode_test.go -// Not all tests were taken; some which throw due to type errors in Geth are ran against Geth's RLPdump to +// Not all tests were taken; some which throw due to type errors in Geth are ran against Geth's RLPDump to // see if there is a decode error or not. In both cases, the test is converted to either reflect the // expected value, or if the test is invalid, it is added as error test case @@ -63,13 +63,13 @@ const invalidGethCases: string[] = [ 'F90000', 'F90055', 'FA0002FFFF', - 'BFFFFFFFFFFFFFFFFFFF', + 'BFFFFFFFFFFFFFFFFFFF', // cspell:disable-line 'C801', 'CD04040404FFFFFFFFFFFFFFFFFF0303', 'C40102030401', 'C4010203048180', '81', - 'BFFFFFFFFFFFFFFF', + 'BFFFFFFFFFFFFFFF', // cspell:disable-line 'C801', 'c330f9c030f93030ce3030303030303030bd303030303030', '8105', diff --git a/packages/statemanager/src/cache/account.ts b/packages/statemanager/src/cache/account.ts index 9837178873..19419d7132 100644 --- a/packages/statemanager/src/cache/account.ts +++ b/packages/statemanager/src/cache/account.ts @@ -1,3 +1,4 @@ +// cspell:ignore dels import { bytesToUnprefixedHex } from '@ethereumjs/util' import { OrderedMap } from '@js-sdsl/ordered-map' import debugDefault from 'debug' diff --git a/packages/statemanager/src/cache/cache.ts b/packages/statemanager/src/cache/cache.ts index d80c338a2a..1a7738087b 100644 --- a/packages/statemanager/src/cache/cache.ts +++ b/packages/statemanager/src/cache/cache.ts @@ -1,3 +1,4 @@ +// cspell:ignore dels import debugDefault from 'debug' import type { Debugger } from 'debug' diff --git a/packages/statemanager/src/cache/code.ts b/packages/statemanager/src/cache/code.ts index 3aaeb25db8..66954755f5 100644 --- a/packages/statemanager/src/cache/code.ts +++ b/packages/statemanager/src/cache/code.ts @@ -1,3 +1,4 @@ +// cspell:ignore dels import { bytesToUnprefixedHex } from '@ethereumjs/util' import { OrderedMap } from '@js-sdsl/ordered-map' import debugDefault from 'debug' diff --git a/packages/statemanager/src/cache/storage.ts b/packages/statemanager/src/cache/storage.ts index 345e74ad3b..51e18a896f 100644 --- a/packages/statemanager/src/cache/storage.ts +++ b/packages/statemanager/src/cache/storage.ts @@ -1,3 +1,4 @@ +// cspell:ignore dels import { bytesToUnprefixedHex, hexToBytes } from '@ethereumjs/util' import { OrderedMap } from '@js-sdsl/ordered-map' import debugDefault from 'debug' @@ -274,7 +275,7 @@ export class StorageCache extends Cache { // Go through diffMap from the pre-commit checkpoint height. // 1. Iterate through all state pre states // 2. If state pre-state is not in the new (lower) height diff map, take pre commit pre state value - // 3. If state is in new map, take this one, since this superseeds subsequent changes + // 3. If state is in new map, take this one, since this supersedes subsequent changes for (const entry of higherHeightDiffMap.entries()) { const addressHex = entry[0] const higherHeightStorageDiff = entry[1] diff --git a/packages/statemanager/src/stateManager.ts b/packages/statemanager/src/stateManager.ts index 7717544676..5956773341 100644 --- a/packages/statemanager/src/stateManager.ts +++ b/packages/statemanager/src/stateManager.ts @@ -901,8 +901,8 @@ export class DefaultStateManager implements StateManagerInterface { * This means in particular: * 1. For caches instantiated as an LRU cache type * the copy() method will instantiate with an ORDERED_MAP cache - * instead, since copied instantances are mostly used in - * short-term usage contexts and LRU cache instantation would create + * instead, since copied instances are mostly used in + * short-term usage contexts and LRU cache instantiation would create * a large overhead here. * 2. The underlying trie object is initialized with 0 cache size * diff --git a/packages/statemanager/src/statelessVerkleStateManager.ts b/packages/statemanager/src/statelessVerkleStateManager.ts index 0b19a3bad6..c6603ae295 100644 --- a/packages/statemanager/src/statelessVerkleStateManager.ts +++ b/packages/statemanager/src/statelessVerkleStateManager.ts @@ -448,7 +448,7 @@ export class StatelessVerkleStateManager implements StateManagerInterface { balance: typeof balanceRaw === 'string' ? bytesToBigInt(hexToBytes(balanceRaw), true) : null, nonce: typeof nonceRaw === 'string' ? bytesToBigInt(hexToBytes(nonceRaw), true) : null, codeHash: typeof codeHashRaw === 'string' ? hexToBytes(codeHashRaw) : null, - // if codeSizeRaw is null, it means account didnt exist or it was EOA either way codeSize is 0 + // if codeSizeRaw is null, it means account didn't exist or it was EOA either way codeSize is 0 // if codeSizeRaw is undefined, then we pass in null which in our context of partial account means // not specified codeSize: diff --git a/packages/statemanager/test/rpcStateManager.spec.ts b/packages/statemanager/test/rpcStateManager.spec.ts index 1213ed2ec6..22bb7b97ab 100644 --- a/packages/statemanager/test/rpcStateManager.spec.ts +++ b/packages/statemanager/test/rpcStateManager.spec.ts @@ -1,3 +1,4 @@ +// cspell:ignore Ierc import { createBlockFromJsonRpcProvider, createBlockFromRPC } from '@ethereumjs/block' import { Common, Hardfork, Mainnet } from '@ethereumjs/common' import { type EVMRunCallOpts, createEVM } from '@ethereumjs/evm' @@ -131,7 +132,7 @@ describe('RPC State Manager API tests', () => { const spy = vi.spyOn(state, 'getAccountFromProvider') spy.mockImplementation(() => { - throw new Error('shouldnt call me') + throw new Error("shouldn't call me") }) await state.checkpoint() diff --git a/packages/trie/benchmarks/suite.ts b/packages/trie/benchmarks/suite.ts index bcb68e9f4a..5b679ce116 100644 --- a/packages/trie/benchmarks/suite.ts +++ b/packages/trie/benchmarks/suite.ts @@ -1,6 +1,6 @@ import { keccak256 } from 'ethereum-cryptography/keccak.js' // @ts-ignore - package has no types... -import { run, mark, logMem } from 'micro-bmark' +import { run, mark, logMem } from 'micro-bmark' // cspell:disable-line import { Trie } from '../dist/cjs/index.js' import { keys } from './keys' diff --git a/packages/trie/examples/logDemo.ts b/packages/trie/examples/logDemo.ts index 2356ab047e..2aa5bdee21 100644 --- a/packages/trie/examples/logDemo.ts +++ b/packages/trie/examples/logDemo.ts @@ -1,12 +1,12 @@ /** - * Run with DEBUG=ethjs,trie:* to see debug log ouput + * Run with DEBUG=ethjs,trie:* to see debug log output */ import { Trie, createMerkleProof, verifyMerkleProof } from '@ethereumjs/trie' import { utf8ToBytes } from '@ethereumjs/util' const trie_entries: [string, string | null][] = [ ['do', 'verb'], - ['ether', 'wookiedoo'], + ['ether', 'wookiedoo'], // cspell:disable-line ['horse', 'stallion'], ['shaman', 'horse'], ['doge', 'coin'], diff --git a/packages/trie/scripts/view.ts b/packages/trie/scripts/view.ts index 5d2f600027..ee4e48d487 100644 --- a/packages/trie/scripts/view.ts +++ b/packages/trie/scripts/view.ts @@ -9,8 +9,8 @@ import { _walkTrie } from './asyncWalk.js' import type { TrieNode } from '../types.js' import type { Debugger } from 'debug' -const debug = _debug('trieview') -const delimeters = { +const debug = _debug('trieview') // cspell:disable-line +const delimiters = { 0: debug.extend(''), 1: debug.extend('::'), 2: debug.extend('::::'), @@ -18,12 +18,12 @@ const delimeters = { 4: debug.extend('::::::::'), 5: debug.extend('::::::::::'), } as const -type Delimeter = keyof typeof delimeters -const delimiter = (level: Delimeter): void => { - delimeters[level]('-'.repeat(50 - level * 2)) +type Delimiter = keyof typeof delimiters +const delimiter = (level: Delimiter): void => { + delimiters[level]('-'.repeat(50 - level * 2)) } const tNode = ['br', 'lf', 'ex', 'rt', 'nl', 'pf', 'vl'] as const -type TNode = typeof tNode[number] +type TNode = (typeof tNode)[number] const debugN = (type: TNode, d?: Debugger) => { d = d ?? debug const nodeDebuggers = { @@ -43,10 +43,10 @@ function getNodeType(node: TrieNode): TNode { return node instanceof BranchNode ? 'br' : node instanceof ExtensionNode - ? 'ex' - : node instanceof LeafNode - ? 'lf' - : 'nl' + ? 'ex' + : node instanceof LeafNode + ? 'lf' + : 'nl' } function logNode(trie: Trie, node: TrieNode, currentKey: number[]): void { @@ -56,8 +56,8 @@ function logNode(trie: Trie, node: TrieNode, currentKey: number[]): void { debugN('rt').extend(type)( `{ 0x${bytesToHex((trie as any).hash(node.serialize())).slice( 0, - 12 - )}... } ---- \uD83D\uDCA5 \u211B \u2134 \u2134 \u0164 \u0147 \u2134 \u0221 \u2211 \u2737` + 12, + )}... } ---- \uD83D\uDCA5 \u211B \u2134 \u2134 \u0164 \u0147 \u2134 \u0221 \u2211 \u2737`, ) } else { debugN(type)(`{ 0x${bytesToHex((trie as any).hash(node.serialize())).slice(0, 12)}... } ----`) diff --git a/packages/trie/src/proof/range.ts b/packages/trie/src/proof/range.ts index ff8f62b201..a3699989fc 100644 --- a/packages/trie/src/proof/range.ts +++ b/packages/trie/src/proof/range.ts @@ -277,7 +277,7 @@ async function unsetInternal(trie: Trie, left: Nibbles, right: Nibbles): Promise return false } else if (node instanceof BranchNode) { - // Unset all internal nodes in the forkpoint + // Unset all internal nodes in the forkPoint for (let i = left[pos] + 1; i < right[pos]; i++) { node.setBranch(i, null) } diff --git a/packages/trie/src/trie.ts b/packages/trie/src/trie.ts index c64609007c..9914d46af1 100644 --- a/packages/trie/src/trie.ts +++ b/packages/trie/src/trie.ts @@ -236,7 +236,7 @@ export class Trie { if (val === null || equalsBytes(val, value) === false) { // All items of the stack are going to change. // (This is the path from the root node to wherever it needs to insert nodes) - // The items change, because the leaf value is updated, thus all keyhashes in the + // The items change, because the leaf value is updated, thus all keyHashes in the // stack should be updated as well, so that it points to the right key/value pairs of the path const deleteHashes = stack.map((e) => this.hash(e.serialize())) ops = deleteHashes.map((deletedHash) => { @@ -257,7 +257,7 @@ export class Trie { // then update await this._updateNode(appliedKey, value, remaining, stack) if (this._opts.useNodePruning) { - // Only after updating the node we can delete the keyhashes + // Only after updating the node we can delete the keyHashes await this._db.batch(ops) } } @@ -281,7 +281,7 @@ export class Trie { // Only delete if the `key` currently has any value if (this._opts.useNodePruning && node !== null) { const deleteHashes = stack.map((e) => this.hash(e.serialize())) - // Just as with `put`, the stack items all will have their keyhashes updated + // Just as with `put`, the stack items all will have their keyHashes updated // So after deleting the node, one can safely delete these from the DB ops = deleteHashes.map((deletedHash) => { @@ -301,7 +301,7 @@ export class Trie { await this._deleteNode(appliedKey, stack) } if (this._opts.useNodePruning) { - // Only after deleting the node it is possible to delete the keyhashes + // Only after deleting the node it is possible to delete the keyHashes await this._db.batch(ops) } await this.persistRoot() @@ -736,7 +736,7 @@ export class Trie { // However, this violates the trie spec; this should be converted in either an ExtensionNode // Or a LeafNode // Since this branch is deleted, one can thus also delete this branch from the DB - // So add this to the `opStack` and mark the keyhash to be deleted + // So add this to the `opStack` and mark the keyHash to be deleted if (this._opts.useNodePruning) { // If the branchNode has length < 32, it will be a RawNode (Uint8Array[]) instead of a Uint8Array // In that case, we need to serialize and hash it into a Uint8Array, otherwise the operation will throw @@ -848,9 +848,9 @@ export class Trie { * @example * const ops = [ * { type: 'del', key: Uint8Array.from('father') } - * , { type: 'put', key: Uint8Array.from('name'), value: Uint8Array.from('Yuri Irsenovich Kim') } + * , { type: 'put', key: Uint8Array.from('name'), value: Uint8Array.from('Yuri Irsenovich Kim') } // cspell:disable-line * , { type: 'put', key: Uint8Array.from('dob'), value: Uint8Array.from('16 February 1941') } - * , { type: 'put', key: Uint8Array.from('spouse'), value: Uint8Array.from('Kim Young-sook') } + * , { type: 'put', key: Uint8Array.from('spouse'), value: Uint8Array.from('Kim Young-sook') } // cspell:disable-line * , { type: 'put', key: Uint8Array.from('occupation'), value: Uint8Array.from('Clown') } * ] * await trie.batch(ops) diff --git a/packages/trie/src/util/encoding.ts b/packages/trie/src/util/encoding.ts index 1e0708ec75..83b0b63e54 100644 --- a/packages/trie/src/util/encoding.ts +++ b/packages/trie/src/util/encoding.ts @@ -1,3 +1,4 @@ +// cspell:ignore bkey import { concatBytes, hexToBytes, toBytes, unprefixedHexToBytes } from '@ethereumjs/util' import { nibblesTypeToPackedBytes } from './nibbles.js' @@ -164,13 +165,13 @@ export const mergeAndFormatKeyPaths = (pathStrings: string[]) => { let paths: string[] = [] let i = 0 while (i < pathStrings.length) { - const outterPathString = pathStrings[i]!.split('/') - const outterAccountPath = outterPathString[0] - const outterStoragePath = outterPathString[1] + const outerPathString = pathStrings[i]!.split('/') + const outerAccountPath = outerPathString[0] + const outerStoragePath = outerPathString[1] - paths.push(outterAccountPath) - if (outterStoragePath !== undefined) { - paths.push(outterStoragePath) + paths.push(outerAccountPath) + if (outerStoragePath !== undefined) { + paths.push(outerStoragePath) } let j = ++i @@ -179,7 +180,7 @@ export const mergeAndFormatKeyPaths = (pathStrings: string[]) => { const innerAccountPath = innerPathString[0] const innerStoragePath = innerPathString[1] - if (innerAccountPath === outterAccountPath) { + if (innerAccountPath === outerAccountPath) { paths.push(innerStoragePath) } else { ret.push(paths) diff --git a/packages/trie/src/util/nibbles.ts b/packages/trie/src/util/nibbles.ts index 9bc473f310..719d291706 100644 --- a/packages/trie/src/util/nibbles.ts +++ b/packages/trie/src/util/nibbles.ts @@ -1,3 +1,4 @@ +// cspell:ignore bkey import { toBytes } from '@ethereumjs/util' import type { Nibbles } from '../types.js' diff --git a/packages/trie/test/official.spec.ts b/packages/trie/test/official.spec.ts index d70f921067..a8581d4108 100644 --- a/packages/trie/test/official.spec.ts +++ b/packages/trie/test/official.spec.ts @@ -3,7 +3,7 @@ import { assert, describe, it } from 'vitest' import { Trie } from '../src/index.js' -import trieAnyOrderTests from './fixtures/trieanyorder.json' +import trieAnyOrderTests from './fixtures/trieanyorder.json' // cspell:disable-line import trieTests from './fixtures/trietest.json' describe('official tests', () => { diff --git a/packages/trie/test/proof.spec.ts b/packages/trie/test/proof.spec.ts index ae972ac733..09a5de801c 100644 --- a/packages/trie/test/proof.spec.ts +++ b/packages/trie/test/proof.spec.ts @@ -1,3 +1,4 @@ +// cspell:ignore aval import { RLP } from '@ethereumjs/rlp' import { bytesToUtf8, equalsBytes, setLengthLeft, utf8ToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' @@ -32,18 +33,18 @@ describe('simple merkle proofs generation and verification', () => { // traversing into `key22` would touch all the same nodes as traversing into `key2` assert.equal(val, null, 'Expected value at a random key to be null') - let myKey = utf8ToBytes('anyrandomkey') + let myKey = utf8ToBytes('anyRandomKey') proof = await createMerkleProof(trie, myKey) val = await verifyTrieProof(myKey, proof) assert.equal(val, null, 'Expected value to be null') - myKey = utf8ToBytes('anothergarbagekey') // should generate a valid proof of null + myKey = utf8ToBytes('anotherGarbageKey') // should generate a valid proof of null proof = await createMerkleProof(trie, myKey) proof.push(utf8ToBytes('123456')) // extra nodes are just ignored val = await verifyTrieProof(myKey, proof) assert.equal(val, null, 'Expected value to be null') - await trie.put(utf8ToBytes('another'), utf8ToBytes('3498h4riuhgwe')) + await trie.put(utf8ToBytes('another'), utf8ToBytes('3498h4riuhgwe')) // cspell:disable-line // to fail our proof we can request a proof for one key proof = await createMerkleProof(trie, utf8ToBytes('another')) @@ -67,12 +68,12 @@ describe('simple merkle proofs generation and verification', () => { // test an invalid exclusion proof by creating // a valid exclusion proof then making it non-null - myKey = utf8ToBytes('anyrandomkey') + myKey = utf8ToBytes('anyRandomKey') proof = await createMerkleProof(trie, myKey) val = await verifyTrieProof(myKey, proof) assert.equal(val, null, 'Expected value to be null') // now make the key non-null so the exclusion proof becomes invalid - await trie.put(myKey, utf8ToBytes('thisisavalue')) + await trie.put(myKey, utf8ToBytes('thisIsAValue')) try { await createTrieFromProof(proof, { root: trie.root() }) assert.fail(`expected error: 'The provided proof does not have the expected trie root'`) @@ -170,14 +171,14 @@ describe('simple merkle proofs generation and verification', () => { const newTrie = await createTrieFromProof(proof, { useKeyHashing: true }) const trieValue = await newTrie.get(key) - assert.ok(equalsBytes(trieValue!, encodedValue), 'trie value sucessfully copied') + assert.ok(equalsBytes(trieValue!, encodedValue), 'trie value successfully copied') assert.ok(equalsBytes(trie.root(), newTrie.root()), 'root set correctly') const proof2 = await createMerkleProof(trie, key2) await updateTrieFromMerkleProof(newTrie, proof2) const trieValue2 = await newTrie.get(key2) - assert.ok(equalsBytes(trieValue2!, encodedValue2), 'trie value succesfully updated') + assert.ok(equalsBytes(trieValue2!, encodedValue2), 'trie value successfully updated') assert.ok(equalsBytes(trie.root(), newTrie.root()), 'root set correctly') const trieValue3 = await newTrie.get(key3) @@ -209,7 +210,7 @@ describe('simple merkle proofs generation and verification', () => { const updatedNewSafeValue = await newTrie.get(safeKey) assert.ok( equalsBytes(updatedNewSafeValue!, safeValue), - 'succesfully set the trie to the new root and got the correct value', + 'successfully set the trie to the new root and got the correct value', ) }) }) diff --git a/packages/trie/test/proof/range.spec.ts b/packages/trie/test/proof/range.spec.ts index 4fa8eaa74c..ba6fde5d9c 100644 --- a/packages/trie/test/proof/range.spec.ts +++ b/packages/trie/test/proof/range.spec.ts @@ -83,7 +83,7 @@ async function verify( startKey?: Uint8Array, endKey?: Uint8Array, keys?: Uint8Array[], - vals?: Uint8Array[], + values?: Uint8Array[], ) { startKey = startKey ?? entries[start][0] endKey = endKey ?? entries[end][0] @@ -93,7 +93,7 @@ async function verify( startKey, endKey, keys ?? targetRange.map(([key]) => key), - vals ?? targetRange.map(([, val]) => val), + values ?? targetRange.map(([, val]) => val), [...(await createMerkleProof(trie, startKey)), ...(await createMerkleProof(trie, endKey))], ) } diff --git a/packages/trie/test/trie/checkpoint.spec.ts b/packages/trie/test/trie/checkpoint.spec.ts index aac6de1dfb..85ee293b10 100644 --- a/packages/trie/test/trie/checkpoint.spec.ts +++ b/packages/trie/test/trie/checkpoint.spec.ts @@ -208,7 +208,7 @@ describe('testing checkpoints', () => { const KEY = utf8ToBytes('last_block_height') const KEY_ROOT = keccak256(ROOT_DB_KEY) - // Initialise State + // Initialize State const CommittedState = await createTrie({ useKeyHashing: true, useNodePruning: true, diff --git a/packages/trie/test/trie/secure.spec.ts b/packages/trie/test/trie/secure.spec.ts index eade5ecabe..228f4d7b87 100644 --- a/packages/trie/test/trie/secure.spec.ts +++ b/packages/trie/test/trie/secure.spec.ts @@ -61,7 +61,7 @@ describe('SecureTrie proof', () => { it('read back data written with hashed key', async () => { const trie = new Trie({ useKeyHashing: true, db: new MapDB() }) - // skip key transformation if the key is already hashed like data recieved in snapsync + // skip key transformation if the key is already hashed like data received in snapsync await trie.put(keccak256(utf8ToBytes('key1aa')), utf8ToBytes('01234'), true) const val = await trie.get(utf8ToBytes('key1aa')) diff --git a/packages/trie/test/util/encodingUtils.spec.ts b/packages/trie/test/util/encodingUtils.spec.ts index d647c47929..ba30a5120e 100644 --- a/packages/trie/test/util/encodingUtils.spec.ts +++ b/packages/trie/test/util/encodingUtils.spec.ts @@ -69,7 +69,7 @@ describe('encoding', () => { }) it('should return the correct hex-encoded key in "hex" encoding', () => { - const path = 'aabbcc' + const path = 'aabbcc' // cspell:disable-line const extension: Nibbles = [10, 11, 12] const result = pathToHexKey(path, extension, 'hex') diff --git a/packages/trie/test/util/log.spec.ts b/packages/trie/test/util/log.spec.ts index be4e7157b4..0131defbcd 100644 --- a/packages/trie/test/util/log.spec.ts +++ b/packages/trie/test/util/log.spec.ts @@ -7,7 +7,7 @@ import { Trie } from '../../src/trie.js' describe('Run Trie script with DEBUG enabled', async () => { const trie_entries: [string, string | null][] = [ ['do', 'verb'], - ['ether', 'wookiedoo'], + ['ether', 'wookiedoo'], // cspell:disable-line ['doge', 'coin'], ['ether', null], ['dog', 'puppy'], diff --git a/packages/tx/examples/transactions.ts b/packages/tx/examples/transactions.ts index 8d7509bde3..34d3a4e0fa 100644 --- a/packages/tx/examples/transactions.ts +++ b/packages/tx/examples/transactions.ts @@ -22,7 +22,7 @@ const privateKey = hexToBytes('0xe331b6d69882b4cb4ea581d88e0b604039a3de5967688d3 const signedTx = tx.sign(privateKey) // We have a signed transaction. -// Now for it to be fully fundable the account that we signed it with needs to have a certain amount of wei in to. +// In order to send the transaction, the account that we signed it with needs to have a certain amount of wei in to. // To see how much this account needs we can use the getUpfrontCost() method. const feeCost = signedTx.getUpfrontCost() console.log('Total Amount of wei needed:' + feeCost.toString()) diff --git a/packages/tx/examples/txFactory.ts b/packages/tx/examples/txFactory.ts index 3030469732..9929712363 100644 --- a/packages/tx/examples/txFactory.ts +++ b/packages/tx/examples/txFactory.ts @@ -5,7 +5,7 @@ import type { EIP1559CompatibleTx } from '@ethereumjs/tx' const common = new Common({ chain: Mainnet, hardfork: Hardfork.London }) -const txData = { type: 2, maxFeePerGas: BigInt(20) } // Creates an EIP-1559 compatible transac +const txData = { type: 2, maxFeePerGas: BigInt(20) } // Creates an EIP-1559 compatible transaction const tx = createTxFromTxData(txData, { common }) if (tx.supports(Capability.EIP1559FeeMarket)) { diff --git a/packages/tx/src/4844/constructors.ts b/packages/tx/src/4844/constructors.ts index bbd7749a20..0d18994683 100644 --- a/packages/tx/src/4844/constructors.ts +++ b/packages/tx/src/4844/constructors.ts @@ -68,8 +68,8 @@ const validateBlobTransactionNetworkWrapper = ( * Notes: * - `chainId` will be set automatically if not provided * - All parameters are optional and have some basic default values - * - `blobs` cannot be supplied as well as `kzgCommittments`, `blobVersionedHashes`, `kzgProofs` - * - If `blobs` is passed in, `kzgCommittments`, `blobVersionedHashes`, `kzgProofs` will be derived by the constructor + * - `blobs` cannot be supplied as well as `kzgCommitments`, `blobVersionedHashes`, `kzgProofs` + * - If `blobs` is passed in, `kzgCommitments`, `blobVersionedHashes`, `kzgProofs` will be derived by the constructor */ export function create4844BlobTx(txData: TxData, opts?: TxOptions) { if (opts?.common?.customCrypto?.kzg === undefined) { diff --git a/packages/tx/test/eip3860.spec.ts b/packages/tx/test/eip3860.spec.ts index d954fc2538..a9c1ab0df7 100644 --- a/packages/tx/test/eip3860.spec.ts +++ b/packages/tx/test/eip3860.spec.ts @@ -91,12 +91,12 @@ describe('[EIP3860 tests]', () => { { data, type: txType }, { common, allowUnlimitedInitCodeSize: true }, ) - const eip3860DeactivedTx = createTxFromTxData( + const eip3860DeactivatedTx = createTxFromTxData( { data, type: txType }, { common, allowUnlimitedInitCodeSize: false }, ) assert.ok( - eip3860ActiveTx.getDataGas() === eip3860DeactivedTx.getDataGas(), + eip3860ActiveTx.getDataGas() === eip3860DeactivatedTx.getDataGas(), 'charged initcode analysis gas', ) } diff --git a/packages/tx/test/eip4844.spec.ts b/packages/tx/test/eip4844.spec.ts index fb37d81b6b..0f03ca50f4 100644 --- a/packages/tx/test/eip4844.spec.ts +++ b/packages/tx/test/eip4844.spec.ts @@ -529,7 +529,7 @@ describe('Network wrapper tests', () => { }), 'commitment for blob at index 0 does not match versionedHash', undefined, - 'throws when versioned hashes dont match kzg commitments', + "throws when versioned hashes don't match kzg commitments", ) }) }) diff --git a/packages/tx/test/fromRpc.spec.ts b/packages/tx/test/fromRpc.spec.ts index ded73b5524..d7fdc45028 100644 --- a/packages/tx/test/fromRpc.spec.ts +++ b/packages/tx/test/fromRpc.spec.ts @@ -76,11 +76,15 @@ describe('[normalizeTxParams]', () => { const normedTx = normalizeTxParams(rpcTx) const tx = createTxFromTxData(normedTx) assert.equal(normedTx.gasLimit, 21000n, 'correctly converted "gas" to "gasLimit"') - assert.equal(bytesToHex(tx.hash()), rpcTx.hash, 'converted normed tx data to transaction objec') + assert.equal( + bytesToHex(tx.hash()), + rpcTx.hash, + 'converted normed tx data to transaction object', + ) }) }) -describe('fromRPC: interpret v/r/s vals of 0x0 as undefined for Optimism system txs', () => { +describe('fromRPC: interpret v/r/s values of 0x0 as undefined for Optimism system txs', () => { it('should work', async () => { for (const txType of txTypes) { ;(optimismTx as any).type = txType diff --git a/packages/tx/test/legacy.spec.ts b/packages/tx/test/legacy.spec.ts index cc66613124..f9b420f6b1 100644 --- a/packages/tx/test/legacy.spec.ts +++ b/packages/tx/test/legacy.spec.ts @@ -17,7 +17,7 @@ import { createLegacyTxFromRLP, } from '../src/index.js' -import txFixturesEip155 from './json/ttTransactionTestEip155VitaliksTests.json' +import txFixturesEip155 from './json/ttTransactionTestEip155VitaliksTests.json' // cspell:disable-line import txFixtures from './json/txs.json' import type { TransactionType, TxData, TypedTransaction } from '../src/index.js' @@ -62,7 +62,7 @@ describe('[Transaction]', () => { const nonEIP2930Common = new Common({ chain: Mainnet, hardfork: Hardfork.Istanbul }) assert.ok( createLegacyTx({}, { common: nonEIP2930Common }), - 'should initialize on a pre-Berlin Harfork (EIP-2930 not activated)', + 'should initialize on a pre-Berlin Hardfork (EIP-2930 not activated)', ) let common = new Common({ chain: Goerli }) const txData = txFixtures[3].raw.map((rawTxData) => hexToBytes(rawTxData as PrefixedHexString)) diff --git a/packages/tx/test/types.ts b/packages/tx/test/types.ts index c37d36a18b..4208329e57 100644 --- a/packages/tx/test/types.ts +++ b/packages/tx/test/types.ts @@ -1,3 +1,4 @@ +// cspell:ignore Vitaliks export type ForkName = | 'London+3860' | 'London' @@ -52,8 +53,8 @@ export type ForksData = { export type OfficialTransactionTestData = { _info: { comment: string - filledwith: string - lllcversion: string + filledwith: string // cspell:disable-line + lllcversion: string // cspell:disable-line source: string sourceHash: string } diff --git a/packages/util/examples/signature.ts b/packages/util/examples/signature.ts index 2ff0a1a4c2..2c3faf77f9 100644 --- a/packages/util/examples/signature.ts +++ b/packages/util/examples/signature.ts @@ -2,11 +2,11 @@ import { bytesToHex, ecrecover, hexToBytes } from '@ethereumjs/util' const chainId = BigInt(3) // Ropsten -const echash = hexToBytes('0x82ff40c0a986c6a5cfad4ddf4c3aa6996f1a7837f9c398e17e5de5cbd5a12b28') +const ecHash = hexToBytes('0x82ff40c0a986c6a5cfad4ddf4c3aa6996f1a7837f9c398e17e5de5cbd5a12b28') const r = hexToBytes('0x99e71a99cb2270b8cac5254f9e99b6210c6c10224a1579cf389ef88b20a1abe9') const s = hexToBytes('0x129ff05af364204442bdb53ab6f18a99ab48acc9326fa689f228040429e3ca66') const v = BigInt(41) -const pubkey = ecrecover(echash, v, r, s, chainId) +const pubkey = ecrecover(ecHash, v, r, s, chainId) console.log(`Recovered public key ${bytesToHex(pubkey)} from valid signature values`) diff --git a/packages/util/src/asyncEventEmitter.ts b/packages/util/src/asyncEventEmitter.ts index e5eefc1ffe..977332a24e 100644 --- a/packages/util/src/asyncEventEmitter.ts +++ b/packages/util/src/asyncEventEmitter.ts @@ -1,3 +1,4 @@ +// cspell:ignore patarapolw /** * Ported to Typescript from original implementation below: * https://github.com/ahultgren/async-eventemitter -- MIT licensed diff --git a/packages/util/src/blobs.ts b/packages/util/src/blobs.ts index 1aec3aeb5c..db38a57ff9 100644 --- a/packages/util/src/blobs.ts +++ b/packages/util/src/blobs.ts @@ -1,3 +1,4 @@ +// cspell:ignore pdata import { sha256 } from 'ethereum-cryptography/sha256.js' import { utf8ToBytes } from './bytes.js' diff --git a/packages/util/src/bytes.ts b/packages/util/src/bytes.ts index 7226c5b4b5..e8cfaa2e39 100644 --- a/packages/util/src/bytes.ts +++ b/packages/util/src/bytes.ts @@ -5,7 +5,7 @@ import { bytesToHex as _bytesToUnprefixedHex } from 'ethereum-cryptography/utils import { assertIsArray, assertIsBytes, assertIsHexString } from './helpers.js' import { isHexString, padToEven, stripHexPrefix } from './internal.js' -import type { PrefixedHexString, TransformabletoBytes } from './types.js' +import type { PrefixedHexString, TransformableToBytes } from './types.js' const BIGINT_0 = BigInt(0) @@ -272,7 +272,7 @@ export type ToBytesInputTypes = | bigint | Uint8Array | number[] - | TransformabletoBytes + | TransformableToBytes | null | undefined @@ -473,7 +473,7 @@ export const randomBytes = (length: number): Uint8Array => { /** * This mirrors the functionality of the `ethereum-cryptography` export except - * it skips the check to validate that every element of `arrays` is indead a `uint8Array` + * it skips the check to validate that every element of `arrays` is indeed a `uint8Array` * Can give small performance gains on large arrays * @param {Uint8Array[]} arrays an array of Uint8Arrays * @returns {Uint8Array} one Uint8Array with all the elements of the original set diff --git a/packages/util/src/internal.ts b/packages/util/src/internal.ts index 4af836eaa4..12a750a1a1 100644 --- a/packages/util/src/internal.ts +++ b/packages/util/src/internal.ts @@ -1,3 +1,4 @@ +// cspell:ignore nickdodson /* The MIT License diff --git a/packages/util/src/kzg.ts b/packages/util/src/kzg.ts index 256d2e35a4..a2d91301d7 100644 --- a/packages/util/src/kzg.ts +++ b/packages/util/src/kzg.ts @@ -25,7 +25,7 @@ export interface Kzg { /** * @deprecated This initialization method is deprecated since trusted setup loading is done directly in the reference KZG library - * initialization or should othewise be assured independently before KZG libary usage. + * initialization or should otherwise be assured independently before KZG library usage. * * @param kzgLib a KZG implementation (defaults to c-kzg) * @param a dictionary of trusted setup options diff --git a/packages/util/src/types.ts b/packages/util/src/types.ts index 2cc0df8f9c..f9bc736eb7 100644 --- a/packages/util/src/types.ts +++ b/packages/util/src/types.ts @@ -17,7 +17,7 @@ export type BytesLike = | number[] | number | bigint - | TransformabletoBytes + | TransformableToBytes | PrefixedHexString /* @@ -30,7 +30,7 @@ export type PrefixedHexString = `0x${string}` */ export type AddressLike = Address | Uint8Array | PrefixedHexString -export interface TransformabletoBytes { +export interface TransformableToBytes { toBytes?(): Uint8Array } diff --git a/packages/util/src/verkle.ts b/packages/util/src/verkle.ts index 7f6e2dc3cf..8be738518c 100644 --- a/packages/util/src/verkle.ts +++ b/packages/util/src/verkle.ts @@ -37,7 +37,7 @@ export interface VerkleCrypto { /** * @dev Returns the 31-bytes verkle tree stem for a given address and tree index. * @dev Assumes that the verkle node width = 256 - * @param ffi The verkle ffi object from verkle-crypotography-wasm. + * @param ffi The verkle ffi object from verkle-cryptography-wasm. * @param address The address to generate the tree key for. * @param treeIndex The index of the tree to generate the key for. Defaults to 0. * @return The 31-bytes verkle tree stem as a Uint8Array. @@ -63,7 +63,7 @@ export function getVerkleStem( /** * Verifies that the executionWitness is valid for the given prestateRoot. - * @param ffi The verkle ffi object from verkle-crypotography-wasm. + * @param ffi The verkle ffi object from verkle-cryptography-wasm. * @param prestateRoot The prestateRoot matching the executionWitness. * @param executionWitness The verkle execution witness. * @returns {boolean} Whether or not the executionWitness belongs to the prestateRoot. diff --git a/packages/util/src/withdrawal.ts b/packages/util/src/withdrawal.ts index d8f2a133e7..daa2e53f10 100644 --- a/packages/util/src/withdrawal.ts +++ b/packages/util/src/withdrawal.ts @@ -43,7 +43,7 @@ export class Withdrawal { public readonly validatorIndex: bigint, public readonly address: Address, /** - * withdrawal amount in Gwei to match the CL repesentation and eventually ssz withdrawalsRoot + * withdrawal amount in Gwei to match the CL representation and eventually ssz withdrawalsRoot */ public readonly amount: bigint, ) {} diff --git a/packages/util/test/account.spec.ts b/packages/util/test/account.spec.ts index b9ef96541d..cdf9f79150 100644 --- a/packages/util/test/account.spec.ts +++ b/packages/util/test/account.spec.ts @@ -1,3 +1,4 @@ +// cspell:ignore testh sant testize import { RLP } from '@ethereumjs/rlp' import { assert, describe, it } from 'vitest' @@ -602,7 +603,7 @@ describe('Utility Functions', () => { '0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', ] - const eip1191ChecksummAddresses = { + const eip1191ChecksumAddresses = { 1: [ '0x88021160c5C792225E4E5452585947470010289d', '0x27b1FdB04752bBc536007a920D24ACB045561c26', @@ -651,7 +652,7 @@ describe('Utility Functions', () => { describe('EIP1191', () => { it('Should encode the example addresses correctly', () => { - for (const [chainId, addresses] of Object.entries(eip1191ChecksummAddresses)) { + for (const [chainId, addresses] of Object.entries(eip1191ChecksumAddresses)) { for (const addr of addresses) { assert.equal(toChecksumAddress(addr.toLowerCase(), Number(chainId)), addr) assert.equal( @@ -712,7 +713,7 @@ describe('Utility Functions', () => { describe('EIP1191', () => { it('Should return true for the example addresses', () => { - for (const [chainId, addresses] of Object.entries(eip1191ChecksummAddresses)) { + for (const [chainId, addresses] of Object.entries(eip1191ChecksumAddresses)) { for (const addr of addresses) { assert.ok(isValidChecksumAddress(addr, Number(chainId))) assert.ok(isValidChecksumAddress(addr, intToBytes(parseInt(chainId)))) @@ -734,7 +735,7 @@ describe('Utility Functions', () => { }) it('Should return false if the wrong chain id is used', () => { - for (const [chainId, addresses] of Object.entries(eip1191ChecksummAddresses)) { + for (const [chainId, addresses] of Object.entries(eip1191ChecksumAddresses)) { for (const addr of addresses) { assert.notOk(isValidChecksumAddress(addr, Number(chainId) + 1)) } diff --git a/packages/util/test/bytes.spec.ts b/packages/util/test/bytes.spec.ts index cf031f98af..5e797deb11 100644 --- a/packages/util/test/bytes.spec.ts +++ b/packages/util/test/bytes.spec.ts @@ -260,7 +260,7 @@ describe('toBytes', () => { assert.throws(() => toBytes('0xR'), '0xR') }) - it('should convert a TransformabletoBytes like the Address class (i.e. provides a toBytes method)', () => { + it('should convert a TransformableToBytes like the Address class (i.e. provides a toBytes method)', () => { const str = '0x2f015c60e0be116b1f0cd534704db9c92118fb6a' const address = createAddressFromString(str) const addressBytes = toBytes(address) @@ -329,7 +329,7 @@ describe('validateNoLeadingZeroes', () => { const noLeadingZeroes = { a: toBytes('0x123'), } - const noleadingZeroBytes = { + const noLeadingZeroBytes = { a: toBytes('0x01'), } const leadingZeroBytes = { @@ -360,7 +360,7 @@ describe('validateNoLeadingZeroes', () => { 'does not throw when undefined passed in', ) assert.doesNotThrow( - () => validateNoLeadingZeroes(noleadingZeroBytes), + () => validateNoLeadingZeroes(noLeadingZeroBytes), 'does not throw when value has leading zero bytes', ) }) @@ -454,7 +454,7 @@ describe('hexToBytes', () => { it('should throw on invalid hex', () => { assert.throws(() => { - hexToBytes('0xinvalidhexstring') + hexToBytes('0xInvalidHexString') }) assert.throws(() => { hexToBytes('0xfz') diff --git a/packages/util/test/provider.spec.ts b/packages/util/test/provider.spec.ts index bd20df314a..5a8eb08f84 100644 --- a/packages/util/test/provider.spec.ts +++ b/packages/util/test/provider.spec.ts @@ -86,7 +86,7 @@ describe('fetchFromProvider', () => { vi.unstubAllGlobals() }) - it('handles the corner case of res.text() failing because of a network error not recieving the full response', async () => { + it('handles the corner case of res.text() failing because of a network error not receiving the full response', async () => { vi.stubGlobal('fetch', async (_url: string, _req: any) => { return { text: async () => { diff --git a/packages/util/test/signature.spec.ts b/packages/util/test/signature.spec.ts index 7e05c34295..4bd493ea24 100644 --- a/packages/util/test/signature.spec.ts +++ b/packages/util/test/signature.spec.ts @@ -15,13 +15,13 @@ import { utf8ToBytes, } from '../src/index.js' -const echash = hexToBytes('0x82ff40c0a986c6a5cfad4ddf4c3aa6996f1a7837f9c398e17e5de5cbd5a12b28') -const ecprivkey = hexToBytes('0x3c9229289a6125f7fdf1885a77bb12c37a8d3b4962d936f7e3084dece32a3ca1') +const ecHash = hexToBytes('0x82ff40c0a986c6a5cfad4ddf4c3aa6996f1a7837f9c398e17e5de5cbd5a12b28') +const ecPrivKey = hexToBytes('0x3c9229289a6125f7fdf1885a77bb12c37a8d3b4962d936f7e3084dece32a3ca1') const chainId = BigInt(3) // ropsten describe('ecsign', () => { it('should produce a signature', () => { - const sig = ecsign(echash, ecprivkey) + const sig = ecsign(ecHash, ecPrivKey) assert.deepEqual( sig.r, hexToBytes('0x99e71a99cb2270b8cac5254f9e99b6210c6c10224a1579cf389ef88b20a1abe9'), @@ -34,7 +34,7 @@ describe('ecsign', () => { }) it('should produce a signature for Ropsten testnet', () => { - const sig = ecsign(echash, ecprivkey, chainId) + const sig = ecsign(ecHash, ecPrivKey, chainId) assert.deepEqual( sig.r, hexToBytes('0x99e71a99cb2270b8cac5254f9e99b6210c6c10224a1579cf389ef88b20a1abe9'), @@ -54,7 +54,7 @@ describe('ecsign', () => { '0x129ff05af364204442bdb53ab6f18a99ab48acc9326fa689f228040429e3ca66', ) - const sig = ecsign(echash, ecprivkey, BigInt(150)) + const sig = ecsign(ecHash, ecPrivKey, BigInt(150)) assert.deepEqual(sig.r, expectedSigR) assert.deepEqual(sig.s, expectedSigS) assert.equal(sig.v, BigInt(150 * 2 + 35)) @@ -70,7 +70,7 @@ describe('ecsign', () => { ) const expectedSigV = BigInt('68361967398315795') - const sigBuffer = ecsign(echash, ecprivkey, bytesToBigInt(chainIDBuffer)) + const sigBuffer = ecsign(ecHash, ecPrivKey, bytesToBigInt(chainIDBuffer)) assert.deepEqual(sigBuffer.r, expectedSigR) assert.deepEqual(sigBuffer.s, expectedSigS) assert.equal(sigBuffer.v, expectedSigV) @@ -82,50 +82,50 @@ describe('ecrecover', () => { const r = hexToBytes('0x99e71a99cb2270b8cac5254f9e99b6210c6c10224a1579cf389ef88b20a1abe9') const s = hexToBytes('0x129ff05af364204442bdb53ab6f18a99ab48acc9326fa689f228040429e3ca66') const v = BigInt(27) - const pubkey = ecrecover(echash, v, r, s) - assert.deepEqual(pubkey, privateToPublic(ecprivkey)) + const pubkey = ecrecover(ecHash, v, r, s) + assert.deepEqual(pubkey, privateToPublic(ecPrivKey)) }) it('should recover a public key (chainId = 3)', () => { const r = hexToBytes('0x99e71a99cb2270b8cac5254f9e99b6210c6c10224a1579cf389ef88b20a1abe9') const s = hexToBytes('0x129ff05af364204442bdb53ab6f18a99ab48acc9326fa689f228040429e3ca66') const v = BigInt(41) - const pubkey = ecrecover(echash, v, r, s, chainId) - assert.deepEqual(pubkey, privateToPublic(ecprivkey)) + const pubkey = ecrecover(ecHash, v, r, s, chainId) + assert.deepEqual(pubkey, privateToPublic(ecPrivKey)) }) it('should recover a public key (chainId = 150)', () => { const chainId = BigInt(150) const r = hexToBytes('0x99e71a99cb2270b8cac5254f9e99b6210c6c10224a1579cf389ef88b20a1abe9') const s = hexToBytes('0x129ff05af364204442bdb53ab6f18a99ab48acc9326fa689f228040429e3ca66') const v = BigInt(chainId * BigInt(2) + BigInt(35)) - const pubkey = ecrecover(echash, v, r, s, chainId) - assert.deepEqual(pubkey, privateToPublic(ecprivkey)) + const pubkey = ecrecover(ecHash, v, r, s, chainId) + assert.deepEqual(pubkey, privateToPublic(ecPrivKey)) }) it('should recover a public key (v = 0)', () => { const r = hexToBytes('0x99e71a99cb2270b8cac5254f9e99b6210c6c10224a1579cf389ef88b20a1abe9') const s = hexToBytes('0x129ff05af364204442bdb53ab6f18a99ab48acc9326fa689f228040429e3ca66') const v = BigInt(0) - const pubkey = ecrecover(echash, v, r, s) - assert.deepEqual(pubkey, privateToPublic(ecprivkey)) + const pubkey = ecrecover(ecHash, v, r, s) + assert.deepEqual(pubkey, privateToPublic(ecPrivKey)) }) it('should fail on an invalid signature (v = 21)', () => { const r = hexToBytes('0x99e71a99cb2270b8cac5254f9e99b6210c6c10224a1579cf389ef88b20a1abe9') const s = hexToBytes('0x129ff05af364204442bdb53ab6f18a99ab48acc9326fa689f228040429e3ca66') assert.throws(function () { - ecrecover(echash, BigInt(21), r, s) + ecrecover(ecHash, BigInt(21), r, s) }) }) it('should fail on an invalid signature (v = 29)', () => { const r = hexToBytes('0x99e71a99cb2270b8cac5254f9e99b6210c6c10224a1579cf389ef88b20a1abe9') const s = hexToBytes('0x129ff05af364204442bdb53ab6f18a99ab48acc9326fa689f228040429e3ca66') assert.throws(function () { - ecrecover(echash, BigInt(29), r, s) + ecrecover(ecHash, BigInt(29), r, s) }) }) it('should fail on an invalid signature (swapped points)', () => { const r = hexToBytes('0x99e71a99cb2270b8cac5254f9e99b6210c6c10224a1579cf389ef88b20a1abe9') const s = hexToBytes('0x129ff05af364204442bdb53ab6f18a99ab48acc9326fa689f228040429e3ca66') assert.throws(function () { - ecrecover(echash, BigInt(27), s, r) + ecrecover(ecHash, BigInt(27), s, r) }) }) it('should return the right sender when using very high chain id / v values', () => { diff --git a/packages/util/test/withdrawal.spec.ts b/packages/util/test/withdrawal.spec.ts index b090ac361c..2aa7754164 100644 --- a/packages/util/test/withdrawal.spec.ts +++ b/packages/util/test/withdrawal.spec.ts @@ -78,10 +78,10 @@ describe('Withdrawal', () => { }) it('toBytesArray from withdrawalData', () => { - const withdrawalsDatatoBytesArr = withdrawalsGethVector.map((withdrawal) => + const withdrawalsDataToBytesArr = withdrawalsGethVector.map((withdrawal) => Withdrawal.toBytesArray(withdrawal as WithdrawalData), ) - const withdrawalsDataToRlp = bytesToHex(encode(withdrawalsDatatoBytesArr)) + const withdrawalsDataToRlp = bytesToHex(encode(withdrawalsDataToBytesArr)) assert.equal(gethWithdrawalsRlp, withdrawalsDataToRlp, 'The withdrawals to buffer should match') }) diff --git a/packages/verkle/src/node/leafNode.ts b/packages/verkle/src/node/leafNode.ts index ceac0b02f4..1ce9704681 100644 --- a/packages/verkle/src/node/leafNode.ts +++ b/packages/verkle/src/node/leafNode.ts @@ -127,7 +127,7 @@ export class LeafNode extends BaseVerkleNode { case VerkleLeafNodeValue.Untouched: return undefined case VerkleLeafNodeValue.Deleted: - // Return zeroes if a value is "deleted" (i.e. overwitten with zeroes) + // Return zeroes if a value is "deleted" (i.e. overwritten with zeroes) return new Uint8Array(32) default: return value diff --git a/packages/vm/benchmarks/mockchain.ts b/packages/vm/benchmarks/mockchain.ts index fb413978d1..0318176c8a 100644 --- a/packages/vm/benchmarks/mockchain.ts +++ b/packages/vm/benchmarks/mockchain.ts @@ -9,10 +9,10 @@ export class Mockchain { async _init() {} getBlock(num: bigint): any { - const bhash = this._hashes[num.toString()] + const bHash = this._hashes[num.toString()] return { hash() { - return bhash + return bHash }, } } diff --git a/packages/vm/examples/helpers/tx-builder.ts b/packages/vm/examples/helpers/tx-builder.ts index c859cb3152..e0117c6680 100644 --- a/packages/vm/examples/helpers/tx-builder.ts +++ b/packages/vm/examples/helpers/tx-builder.ts @@ -1,4 +1,4 @@ -import { defaultAbiCoder as AbiCoder, Interface } from '@ethersproject/abi' +import { defaultAbiCoder as AbiCoder, Interface } from '@ethersproject/abi' // cspell:disable-line import type { LegacyTxData } from '@ethereumjs/tx' diff --git a/packages/vm/examples/run-solidity-contract.ts b/packages/vm/examples/run-solidity-contract.ts index 1f5e49680e..237b50c0fd 100644 --- a/packages/vm/examples/run-solidity-contract.ts +++ b/packages/vm/examples/run-solidity-contract.ts @@ -3,7 +3,7 @@ import { Common, Hardfork, Mainnet } from '@ethereumjs/common' import { createLegacyTx } from '@ethereumjs/tx' import { bytesToHex, createAddressFromPrivateKey, hexToBytes } from '@ethereumjs/util' import { VM, runTx } from '@ethereumjs/vm' -import { defaultAbiCoder as AbiCoder, Interface } from '@ethersproject/abi' +import { defaultAbiCoder as AbiCoder, Interface } from '@ethersproject/abi' // cspell:disable-line import { readFileSync } from 'fs' import path from 'path' import solc from 'solc' @@ -15,7 +15,7 @@ import { buildTransaction, encodeDeployment, encodeFunction } from './helpers/tx import type { Address } from '@ethereumjs/util' const INITIAL_GREETING = 'Hello, World!' -const SECOND_GREETING = 'Hola, Mundo!' +const SECOND_GREETING = 'Hola, Mundo!' // cspell:disable-line const common = new Common({ chain: Mainnet, hardfork: Hardfork.Istanbul }) const block = createBlock({ header: { extraData: new Uint8Array(97) } }, { common }) diff --git a/packages/vm/examples/runGoerliBlock.ts b/packages/vm/examples/runGoerliBlock.ts index 855ebd407b..ff97e13316 100644 --- a/packages/vm/examples/runGoerliBlock.ts +++ b/packages/vm/examples/runGoerliBlock.ts @@ -12,7 +12,7 @@ const main = async () => { const vm = await VM.create({ common, setHardfork: true }) const block = createBlockFromRPC(goerliBlock2, undefined, { common }) - const result = await runBlock(vm, { block, generate: true, skipHeaderValidation: true }) // we skip header validaiton since we are running a block without the full Ethereum history available + const result = await runBlock(vm, { block, generate: true, skipHeaderValidation: true }) // we skip header validation since we are running a block without the full Ethereum history available console.log(`The state root for Goerli block 2 is ${bytesToHex(result.stateRoot)}`) } diff --git a/packages/vm/src/buildBlock.ts b/packages/vm/src/buildBlock.ts index 82604b573d..7f3acc5ea5 100644 --- a/packages/vm/src/buildBlock.ts +++ b/packages/vm/src/buildBlock.ts @@ -62,7 +62,7 @@ export class BlockBuilder { blobGasUsed = BIGINT_0 /** * Value of the block, represented by the final transaction fees - * acruing to the miner. + * accruing to the miner. */ private _minerValue = BIGINT_0 diff --git a/packages/vm/src/emitEVMProfile.ts b/packages/vm/src/emitEVMProfile.ts index c06140ca3a..c60342f89b 100644 --- a/packages/vm/src/emitEVMProfile.ts +++ b/packages/vm/src/emitEVMProfile.ts @@ -56,7 +56,7 @@ export function emitEVMProfile(logs: EVMPerformanceLogOutput[], profileTitle: st return padStr(str, 0).length - 2 } - // Step one: calculate the length of each colum + // Step one: calculate the length of each column const colLength: number[] = [] for (const entry of logs) { diff --git a/packages/vm/src/params.ts b/packages/vm/src/params.ts index 3ee5fd980c..1d3a576b2c 100644 --- a/packages/vm/src/params.ts +++ b/packages/vm/src/params.ts @@ -20,7 +20,7 @@ export const paramsVM: ParamsDict = { minerReward: '3000000000000000000', // the amount a miner get rewarded for mining a block }, /** -. * Constantinope HF Meta EIP +. * Constantinople HF Meta EIP . */ 1013: { // pow @@ -61,7 +61,7 @@ export const paramsVM: ParamsDict = { . */ 4788: { // config - historicalRootsLength: 8191, // The modulo parameter of the beaconroot ring buffer in the beaconroot statefull precompile + historicalRootsLength: 8191, // The modulo parameter of the beaconroot ring buffer in the beaconroot stateful precompile }, /** * Ethereum state using a unified verkle tree (experimental) diff --git a/packages/vm/src/requests.ts b/packages/vm/src/requests.ts index 522d63f1f6..52baccb219 100644 --- a/packages/vm/src/requests.ts +++ b/packages/vm/src/requests.ts @@ -176,9 +176,9 @@ const accumulateDeposits = async ( // 5. Repeat steps 3-4 for each field const pubKeyIdx = bytesToInt(log[2].slice(0, 32)) const pubKeySize = bytesToInt(log[2].slice(pubKeyIdx, pubKeyIdx + 32)) - const withdrawalCredsIdx = bytesToInt(log[2].slice(32, 64)) - const withdrawalCredsSize = bytesToInt( - log[2].slice(withdrawalCredsIdx, withdrawalCredsIdx + 32), + const withdrawalCreditsIdx = bytesToInt(log[2].slice(32, 64)) + const withdrawalCreditsSize = bytesToInt( + log[2].slice(withdrawalCreditsIdx, withdrawalCreditsIdx + 32), ) const amountIdx = bytesToInt(log[2].slice(64, 96)) const amountSize = bytesToInt(log[2].slice(amountIdx, amountIdx + 32)) @@ -188,8 +188,8 @@ const accumulateDeposits = async ( const indexSize = bytesToInt(log[2].slice(indexIdx, indexIdx + 32)) const pubkey = log[2].slice(pubKeyIdx + 32, pubKeyIdx + 32 + pubKeySize) const withdrawalCredentials = log[2].slice( - withdrawalCredsIdx + 32, - withdrawalCredsIdx + 32 + withdrawalCredsSize, + withdrawalCreditsIdx + 32, + withdrawalCreditsIdx + 32 + withdrawalCreditsSize, ) const amountBytes = log[2].slice(amountIdx + 32, amountIdx + 32 + amountSize) const amountBytesBigEndian = new Uint8Array([ diff --git a/packages/vm/src/runBlock.ts b/packages/vm/src/runBlock.ts index 3c637932a6..f7e7b20aea 100644 --- a/packages/vm/src/runBlock.ts +++ b/packages/vm/src/runBlock.ts @@ -497,7 +497,7 @@ export async function accumulateParentBlockHash( const historyAddress = new Address(bigIntToAddressBytes(vm.common.param('historyStorageAddress'))) const historyServeWindow = vm.common.param('historyServeWindow') - // getAccount with historyAddress will throw error as witnesses are not bundeled + // getAccount with historyAddress will throw error as witnesses are not bundled // but we need to put account so as to query later for slot try { if ((await vm.stateManager.getAccount(historyAddress)) === undefined) { @@ -541,7 +541,7 @@ export async function accumulateParentBeaconBlockRoot(vm: VM, root: Uint8Array, /** * Note: (by Jochem) - * If we don't do vm (put account if undefined / non-existant), block runner crashes because the beacon root address does not exist + * If we don't do vm (put account if undefined / non-existent), block runner crashes because the beacon root address does not exist * vm is hence (for me) again a reason why it should /not/ throw if the address does not exist * All ethereum accounts have empty storage by default */ diff --git a/packages/vm/src/runTx.ts b/packages/vm/src/runTx.ts index b30bd7b465..8a5a932b60 100644 --- a/packages/vm/src/runTx.ts +++ b/packages/vm/src/runTx.ts @@ -425,7 +425,7 @@ async function _runTx(vm: VM, opts: RunTxOpts): Promise { const writtenAddresses = new Set() if (tx.supports(Capability.EIP7702EOACode)) { - // Add contract code for authroity tuples provided by EIP 7702 tx + // Add contract code for authority tuples provided by EIP 7702 tx const authorizationList = (tx).authorizationList const MAGIC = new Uint8Array([5]) for (let i = 0; i < authorizationList.length; i++) { diff --git a/packages/vm/src/types.ts b/packages/vm/src/types.ts index cb736c3a0c..3171143edf 100644 --- a/packages/vm/src/types.ts +++ b/packages/vm/src/types.ts @@ -64,7 +64,7 @@ export interface EIP4844BlobTxReceipt extends PostByzantiumTxReceipt { /** * blob gas price for block transaction was included in * - * Note: This valus is not included in the `receiptRLP` used for encoding the `receiptsRoot` in a block + * Note: This values is not included in the `receiptRLP` used for encoding the `receiptsRoot` in a block * and is only provided as part of receipt metadata. */ blobGasPrice: bigint diff --git a/packages/vm/src/vm.ts b/packages/vm/src/vm.ts index d523f1ac28..0b69e3dfe0 100644 --- a/packages/vm/src/vm.ts +++ b/packages/vm/src/vm.ts @@ -182,7 +182,7 @@ export class VM { * * Associated caches will be deleted and caches will be re-initialized for a more short-term focused * usage, being less memory intense (the statemanager caches will switch to using an ORDERED_MAP cache - * datastructure more suitable for short-term usage, the trie node LRU cache will not be activated at all). + * data structure more suitable for short-term usage, the trie node LRU cache will not be activated at all). * To fine-tune this behavior (if the shallow-copy-returned object has a longer life span e.g.) you can set * the `downlevelCaches` option to `false`. * diff --git a/packages/vm/test/api/EIPs/eip-2929.spec.ts b/packages/vm/test/api/EIPs/eip-2929.spec.ts index d5d1c8b59c..7982c8eb20 100644 --- a/packages/vm/test/api/EIPs/eip-2929.spec.ts +++ b/packages/vm/test/api/EIPs/eip-2929.spec.ts @@ -209,7 +209,7 @@ describe('EIP 2929: gas cost tests', () => { }) // Calls the `identity`-precompile (cheap), then calls an account (expensive) - // and `staticcall`s the sameaccount (cheap) + // and `staticcall`s the same account (cheap) it('should charge for pre-compiles and staticcalls correctly', async () => { const test = { code: '0x60008080808060046000f15060008080808060ff6000f15060008080808060ff6000fa5000', diff --git a/packages/vm/test/api/EIPs/eip-2935-historical-block-hashes.spec.ts b/packages/vm/test/api/EIPs/eip-2935-historical-block-hashes.spec.ts index 30ccd89911..4d20f65691 100644 --- a/packages/vm/test/api/EIPs/eip-2935-historical-block-hashes.spec.ts +++ b/packages/vm/test/api/EIPs/eip-2935-historical-block-hashes.spec.ts @@ -137,8 +137,8 @@ describe('EIP 2935: historical block hashes', () => { await vm.stateManager.putCode(historyAddress, contract2935Code) const result = await runTx(vm, { tx, block, skipHardForkValidation: true }) - const blockHashi = result.execResult.returnValue - return blockHashi + const blockHash = result.execResult.returnValue + return blockHash } it(`should validate the deployment tx`, async () => { @@ -264,7 +264,7 @@ describe('EIP 2935: historical block hashes', () => { block: lastBlock, }) - // contract will only have hashes between blocksActivation -1 and blocksToBuild -1 thresholded by + // contract will only have hashes between blocksActivation -1 and blocksToBuild -1 threshold by // historyServeWindow window if ( i >= blocksActivation - 1 && @@ -296,15 +296,15 @@ describe('EIP 2935: historical block hashes', () => { // should be able to resolve blockhash via contract code but from the blocksActivation -1 onwards for (const i of [blocksActivation - 1, blocksActivation, blocksToBuild - 1]) { - const blockHashi = await testBlockhashContract(vm, block, BigInt(i)) - const blocki = await blockchain.getBlock(i) - assert.ok(equalsBytes(blockHashi, blocki.hash())) + const blockHashI = await testBlockhashContract(vm, block, BigInt(i)) + const blockI = await blockchain.getBlock(i) + assert.ok(equalsBytes(blockHashI, blockI.hash())) } // should be able to return 0 if input >= current block for (const i of [blocksToBuild, blocksToBuild + 100]) { - const blockHashi = await testBlockhashContract(vm, block, BigInt(i)) - assert.ok(equalsBytes(blockHashi, setLengthLeft(bigIntToBytes(BigInt(0)), 32))) + const blockHashI = await testBlockhashContract(vm, block, BigInt(i)) + assert.ok(equalsBytes(blockHashI, setLengthLeft(bigIntToBytes(BigInt(0)), 32))) } }) } diff --git a/packages/vm/test/api/EIPs/eip-3198-BaseFee.spec.ts b/packages/vm/test/api/EIPs/eip-3198-BaseFee.spec.ts index c60cd4d01d..95c0093b73 100644 --- a/packages/vm/test/api/EIPs/eip-3198-BaseFee.spec.ts +++ b/packages/vm/test/api/EIPs/eip-3198-BaseFee.spec.ts @@ -81,9 +81,9 @@ describe('EIP3198 tests', () => { // Track stack let stack: any = [] - vm.evm.events!.on('step', (istep: InterpreterStep) => { - if (istep.opcode.name === 'STOP') { - stack = istep.stack + vm.evm.events!.on('step', (iStep: InterpreterStep) => { + if (iStep.opcode.name === 'STOP') { + stack = iStep.stack } }) diff --git a/packages/vm/test/api/EIPs/eip-4399-supplant-difficulty-opcode-with-prevrando.spec.ts b/packages/vm/test/api/EIPs/eip-4399-supplant-difficulty-opcode-with-prevrando.spec.ts index f92f729b1d..26d3472296 100644 --- a/packages/vm/test/api/EIPs/eip-4399-supplant-difficulty-opcode-with-prevrando.spec.ts +++ b/packages/vm/test/api/EIPs/eip-4399-supplant-difficulty-opcode-with-prevrando.spec.ts @@ -23,9 +23,9 @@ describe('EIP-4399 -> 0x44 (DIFFICULTY) should return PREVRANDAO', () => { // Track stack let stack: any = [] - vm.evm.events!.on('step', (istep: InterpreterStep) => { - if (istep.opcode.name === 'STOP') { - stack = istep.stack + vm.evm.events!.on('step', (iStep: InterpreterStep) => { + if (iStep.opcode.name === 'STOP') { + stack = iStep.stack } }) diff --git a/packages/vm/test/api/EIPs/eip-4788-beaconroot.spec.ts b/packages/vm/test/api/EIPs/eip-4788-beaconroot.spec.ts index 9b784b8c2b..6fad3808e1 100644 --- a/packages/vm/test/api/EIPs/eip-4788-beaconroot.spec.ts +++ b/packages/vm/test/api/EIPs/eip-4788-beaconroot.spec.ts @@ -135,7 +135,7 @@ async function runBlockTest(input: { timestampBlock: bigint // Timestamp of the block (this is saved in the precompile) blockRoot: bigint // Blockroot of the block (also saved in the precompile) extLeft?: number // Extend length left of the input (defaults to 32) - extRight?: number // Extend lenght right of the input (defaults to 32) - happens after extendLeft + extRight?: number // Extend length right of the input (defaults to 32) - happens after extendLeft expRet: bigint // Expected return value expCallStatus: bigint // Expected call status (either 0 or 1) }) { diff --git a/packages/vm/test/api/EIPs/eip-4895-withdrawals.spec.ts b/packages/vm/test/api/EIPs/eip-4895-withdrawals.spec.ts index 87b421572f..66f276cb37 100644 --- a/packages/vm/test/api/EIPs/eip-4895-withdrawals.spec.ts +++ b/packages/vm/test/api/EIPs/eip-4895-withdrawals.spec.ts @@ -127,7 +127,7 @@ describe('EIP4895 tests', () => { assert.deepEqual(zeros(0), slotValue, 'withdrawals do not invoke code') }) - it('EIP4895: state updation should exclude 0 amount updates', async () => { + it('EIP4895: state update should exclude 0 amount updates', async () => { const vm = await VM.create({ common }) await vm.stateManager.generateCanonicalGenesis!(parseGethGenesisState(genesisJSON)) diff --git a/packages/vm/test/api/EIPs/eip-7002.spec.ts b/packages/vm/test/api/EIPs/eip-7002.spec.ts index 58ed2e9c70..7850812765 100644 --- a/packages/vm/test/api/EIPs/eip-7002.spec.ts +++ b/packages/vm/test/api/EIPs/eip-7002.spec.ts @@ -131,7 +131,7 @@ describe('EIP-7002 tests', () => { // Ensure the requests are correct assert.ok(equalsBytes(sourceAddressRequest, tx.getSenderAddress().bytes)) assert.ok(equalsBytes(validatorPubkey, validatorPubkeyRequest)) - // the direct byte comparision fails because leading zeros have been stripped + // the direct byte comparison fails because leading zeros have been stripped // off the amountBytes because it was serialized in request from bigint assert.equal(bytesToBigInt(amountBytes), bytesToBigInt(amountRequest)) diff --git a/packages/vm/test/api/bloom.spec.ts b/packages/vm/test/api/bloom.spec.ts index 7c52154a50..a8fb7da60f 100644 --- a/packages/vm/test/api/bloom.spec.ts +++ b/packages/vm/test/api/bloom.spec.ts @@ -12,7 +12,7 @@ describe('bloom', () => { assert.deepEqual(b.bitvector, utils.zeros(byteSize), 'should be empty') }) - it('shouldnt initialize with invalid bitvector', () => { + it("shouldn't initialize with invalid bitvector", () => { assert.throws( () => new Bloom(utils.zeros(byteSize / 2)), /bitvectors must be 2048 bits long/, @@ -31,7 +31,7 @@ describe('bloom', () => { assert.isTrue(b.check(utf8ToBytes('value 2')), 'should contain string "value 2"') }) - it('check shouldnt be tautology', () => { + it("check shouldn't be tautology", () => { const b = new Bloom() assert.isFalse(b.check(utf8ToBytes('random value')), 'should not contain string "random value"') }) diff --git a/packages/vm/test/api/buildBlock.spec.ts b/packages/vm/test/api/buildBlock.spec.ts index 6c1a8d159e..c51764504e 100644 --- a/packages/vm/test/api/buildBlock.spec.ts +++ b/packages/vm/test/api/buildBlock.spec.ts @@ -268,7 +268,7 @@ describe('BlockBuilder', () => { 'block should be in reverted status', ) } catch (error: any) { - assert.fail('shoud not throw') + assert.fail('should not throw') } blockBuilder = await buildBlock(vm, { parentBlock: genesisBlock }) @@ -289,7 +289,7 @@ describe('BlockBuilder', () => { 'block should be in reverted status', ) } catch (error: any) { - assert.fail('shoud not throw') + assert.fail('should not throw') } }) diff --git a/packages/vm/test/api/customChain.spec.ts b/packages/vm/test/api/customChain.spec.ts index c1fd066733..bec1b7ea3c 100644 --- a/packages/vm/test/api/customChain.spec.ts +++ b/packages/vm/test/api/customChain.spec.ts @@ -8,7 +8,7 @@ import { createAddressFromString, hexToBytes, } from '@ethereumjs/util' -import { Interface } from '@ethersproject/abi' +import { Interface } from '@ethersproject/abi' // cspell:disable-line import { assert, describe, it } from 'vitest' import { runTx } from '../../src/index.js' diff --git a/packages/vm/test/api/index.spec.ts b/packages/vm/test/api/index.spec.ts index dcd8e2f107..57fd219792 100644 --- a/packages/vm/test/api/index.spec.ts +++ b/packages/vm/test/api/index.spec.ts @@ -76,26 +76,26 @@ describe('VM -> Default EVM / Custom EVM Opts', () => { it('Default EVM should use VM common', async () => { const common = new Common({ chain: Mainnet, hardfork: Hardfork.Byzantium }) const vm = await VM.create({ common }) - assert.equal((vm.evm as EVM).common.hardfork(), 'byzantium', 'use modfied HF from VM common') + assert.equal((vm.evm as EVM).common.hardfork(), 'byzantium', 'use modified HF from VM common') const copiedVM = await vm.shallowCopy() assert.equal( (copiedVM.evm as EVM).common.hardfork(), 'byzantium', - 'use modfied HF from VM common (for shallowCopied VM)', + 'use modified HF from VM common (for shallowCopied VM)', ) }) it('Default EVM should prefer common from evmOpts if provided (same logic for blockchain, statemanager)', async () => { const common = new Common({ chain: Mainnet, hardfork: Hardfork.Byzantium }) const vm = await VM.create({ evmOpts: { common } }) - assert.equal((vm.evm as EVM).common.hardfork(), 'byzantium', 'use modfied HF from evmOpts') + assert.equal((vm.evm as EVM).common.hardfork(), 'byzantium', 'use modified HF from evmOpts') const copiedVM = await vm.shallowCopy() assert.equal( (copiedVM.evm as EVM).common.hardfork(), 'byzantium', - 'use modfied HF from evmOpts (for shallowCopied VM)', + 'use modified HF from evmOpts (for shallowCopied VM)', ) }) }) diff --git a/packages/vm/test/api/muirGlacier/index.spec.ts b/packages/vm/test/api/muirGlacier/index.spec.ts index 4a53c90a55..cd55690e1e 100644 --- a/packages/vm/test/api/muirGlacier/index.spec.ts +++ b/packages/vm/test/api/muirGlacier/index.spec.ts @@ -5,7 +5,7 @@ import { assert, describe, it } from 'vitest' import { VM } from '../../../src/index.js' describe('General MuirGlacier VM tests', () => { - it('should accept muirGlacier harfork option for supported chains', async () => { + it('should accept muirGlacier hardfork option for supported chains', async () => { const common = new Common({ chain: Mainnet, hardfork: Hardfork.MuirGlacier }) const vm = await VM.create({ common }) assert.ok(vm.stateManager) diff --git a/packages/vm/test/api/runTx.spec.ts b/packages/vm/test/api/runTx.spec.ts index c6e1c2d3df..8d60e7da61 100644 --- a/packages/vm/test/api/runTx.spec.ts +++ b/packages/vm/test/api/runTx.spec.ts @@ -1,3 +1,4 @@ +// cspell:ignore Kintsugi import { createBlock, createBlockHeader } from '@ethereumjs/block' import { Blockchain, createBlockchain } from '@ethereumjs/blockchain' import { Common, Goerli, Hardfork, Mainnet, createCommonFromGethGenesis } from '@ethereumjs/common' diff --git a/packages/vm/test/api/tester/tester.config.spec.ts b/packages/vm/test/api/tester/tester.config.spec.ts index 7dea44a143..62ce7fb441 100644 --- a/packages/vm/test/api/tester/tester.config.spec.ts +++ b/packages/vm/test/api/tester/tester.config.spec.ts @@ -8,7 +8,7 @@ describe('test runner config tests', () => { const common = getCommon('byzantium') assert.ok(common.hardfork() === Hardfork.Byzantium) }) - it('should initialize common with the right hardfork uppercased', () => { + it('should initialize common with the right hardfork upper-cased', () => { let common = getCommon('Byzantium') assert.ok(common.hardfork() === Hardfork.Byzantium) common = getCommon('BYZANTIUM') diff --git a/packages/vm/test/api/utils.ts b/packages/vm/test/api/utils.ts index ebcea00bb4..a5418227d6 100644 --- a/packages/vm/test/api/utils.ts +++ b/packages/vm/test/api/utils.ts @@ -94,7 +94,7 @@ export function getTransaction( txParams['maxPriorityFeePerGas'] = BigInt(10) } else if (txType === TransactionType.BlobEIP4844) { if (common.customCrypto?.kzg === undefined) { - throw new Error('kzg instance required to instantiate blobg txs') + throw new Error('kzg instance required to instantiate blob txs') } txParams['gasPrice'] = undefined txParams['maxFeePerGas'] = BigInt(1000000000) diff --git a/packages/wallet/src/hdkey.ts b/packages/wallet/src/hdkey.ts index b4fddac7ea..ea3794f2cb 100644 --- a/packages/wallet/src/hdkey.ts +++ b/packages/wallet/src/hdkey.ts @@ -1,3 +1,4 @@ +// cspell:ignore xprv xpub import { mnemonicToSeedSync } from 'ethereum-cryptography/bip39/index.js' import { HDKey } from 'ethereum-cryptography/hdkey.js' diff --git a/packages/wallet/src/thirdparty.ts b/packages/wallet/src/thirdparty.ts index 756e3aae15..568ab0b1d6 100644 --- a/packages/wallet/src/thirdparty.ts +++ b/packages/wallet/src/thirdparty.ts @@ -1,3 +1,4 @@ +// cspell:ignore ivsize cryptojs import { bytesToUtf8, concatBytes, unprefixedHexToBytes, utf8ToBytes } from '@ethereumjs/util' import { base64 } from '@scure/base' import { decrypt } from 'ethereum-cryptography/aes.js' @@ -44,12 +45,12 @@ function mergeEvpKdfOptsWithDefaults(opts?: Partial): EvpKdfOpts { * * Algorithm form https://www.openssl.org/docs/manmaster/crypto/EVP_BytesToKey.html * - * FIXME: not optimised at all + * FIXME: not optimized at all */ function evp_kdf(data: Uint8Array, salt: Uint8Array, opts?: Partial) { const params = mergeEvpKdfOptsWithDefaults(opts) - // A single EVP iteration, returns `D_i`, where block equlas to `D_(i-1)` + // A single EVP iteration, returns `D_i`, where block equals to `D_(i-1)` function iter(block: Uint8Array) { if (params.digest !== 'md5') throw new Error('Only md5 is supported in evp_kdf') let hash = md5.create() diff --git a/packages/wallet/src/wallet.ts b/packages/wallet/src/wallet.ts index b49cb56c98..d3e5b391a2 100644 --- a/packages/wallet/src/wallet.ts +++ b/packages/wallet/src/wallet.ts @@ -1,3 +1,4 @@ +// cspell:ignore uuidv kdfparams dklen xprv xpub import { bytesToHex, bytesToUnprefixedHex, @@ -565,7 +566,7 @@ export class Wallet { } /** - * Returns an Etherem Version 3 Keystore Format object representing the wallet + * Returns an Ethereum Version 3 Keystore Format object representing the wallet * * @param password The password used to encrypt the Keystore. * @param opts The options for the keystore. See [its spec](https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition) for more info. @@ -633,7 +634,7 @@ export class Wallet { public getV3Filename(timestamp?: number): string { /* * We want a timestamp like 2016-03-15T17-11-33.007598288Z. Date formatting - * is a pain in Javascript, everbody knows that. We could use moment.js, + * is a pain in Javascript, everybody knows that. We could use moment.js, * but decide to do it manually in order to save space. * * toJSON() returns a pretty close version, so let's use it. It is not UTC though,