Skip to content

Commit

Permalink
remove almost all cspell:ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
jochem-brouwer committed Aug 16, 2024
1 parent dd1f2ff commit 50eaf1e
Show file tree
Hide file tree
Showing 42 changed files with 180 additions and 199 deletions.
13 changes: 12 additions & 1 deletion config/cspell-ts.json
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,17 @@
"dedicatedly",
"EVMBLS",
"EVMBN",
"EVMONEs"
"EVMONEs",
"INTURN",
"NOTURN",
"Andras",
"Radics",
"Fedor",
"Indutny",
"Kademlia",
"Slominski",
"patarapolw",
"nickdodson",
"Kintsugi"
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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\" -e \"./packages/wallet/test\" -c ./config/cspell-ts.json \"./packages/**/*.ts\" --cache --show-suggestions --show-context",
"cspell:ts": "npx cspell --gitignore -e \"./packages/ethereum-tests\" -e \"./packages/wallet/test\" -e \"./packages/client/archive\" -c ./config/cspell-ts.json \"./packages/**/*.ts\" --cache --show-suggestions --show-context",
"cspell:md": "npx cspell --gitignore -e \"./packages/ethereum-tests\" -e \"./packages/client/withdrawals-testnet/**\" -e \"./packages/**/docs\" -c ./config/cspell-md.json \"**.md\" --cache --show-suggestions --show-context",
"docs:build": "npm run docs:build --workspaces --if-present",
"e2e:inject": "node ./scripts/e2e-inject-resolutions.js",
Expand Down
33 changes: 17 additions & 16 deletions packages/block/src/from-beacon-payload.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// cspell:ignore breq
import { bigIntToHex } from '@ethereumjs/util'

import type { ExecutionPayload } from './types.js'
Expand Down Expand Up @@ -157,27 +156,29 @@ export function executionPayloadFromBeaconPayload(payload: BeaconPayloadJson): E

// requests
if (payload.deposit_requests !== undefined && payload.deposit_requests !== null) {
executionPayload.depositRequests = payload.deposit_requests.map((breq) => ({
pubkey: breq.pubkey,
withdrawalCredentials: breq.withdrawal_credentials,
amount: breq.amount,
signature: breq.signature,
index: breq.index,
executionPayload.depositRequests = payload.deposit_requests.map((beaconRequest) => ({
pubkey: beaconRequest.pubkey,
withdrawalCredentials: beaconRequest.withdrawal_credentials,
amount: beaconRequest.amount,
signature: beaconRequest.signature,
index: beaconRequest.index,
}))
}
if (payload.withdrawal_requests !== undefined && payload.withdrawal_requests !== null) {
executionPayload.withdrawalRequests = payload.withdrawal_requests.map((breq) => ({
sourceAddress: breq.source_address,
validatorPubkey: breq.validator_pubkey,
amount: breq.amount,
executionPayload.withdrawalRequests = payload.withdrawal_requests.map((beaconRequest) => ({
sourceAddress: beaconRequest.source_address,
validatorPubkey: beaconRequest.validator_pubkey,
amount: beaconRequest.amount,
}))
}
if (payload.consolidation_requests !== undefined && payload.consolidation_requests !== null) {
executionPayload.consolidationRequests = payload.consolidation_requests.map((breq) => ({
sourceAddress: breq.source_address,
sourcePubkey: breq.source_pubkey,
targetPubkey: breq.target_pubkey,
}))
executionPayload.consolidationRequests = payload.consolidation_requests.map(
(beaconRequest) => ({
sourceAddress: beaconRequest.source_address,
sourcePubkey: beaconRequest.source_pubkey,
targetPubkey: beaconRequest.target_pubkey,
}),
)
}

if (payload.execution_witness !== undefined && payload.execution_witness !== null) {
Expand Down
9 changes: 4 additions & 5 deletions packages/block/src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// cspell:ignore accum
import { RLP } from '@ethereumjs/rlp'
import { Trie } from '@ethereumjs/trie'
import { BlobEIP4844Transaction } from '@ethereumjs/tx'
Expand Down Expand Up @@ -110,10 +109,10 @@ export const getNumBlobs = (transactions: TypedTransaction[]) => {
export const fakeExponential = (factor: bigint, numerator: bigint, denominator: bigint) => {
let i = BIGINT_1
let output = BIGINT_0
let numerator_accum = factor * denominator
while (numerator_accum > BIGINT_0) {
output += numerator_accum
numerator_accum = (numerator_accum * numerator) / (denominator * i)
let numerator_accumulator = factor * denominator
while (numerator_accumulator > BIGINT_0) {
output += numerator_accumulator
numerator_accumulator = (numerator_accumulator * numerator) / (denominator * i)
i++
}

Expand Down
16 changes: 9 additions & 7 deletions packages/block/test/from-rpc.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// 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'
Expand All @@ -12,9 +11,9 @@ import {
import * as alchemy14151203 from './testdata/alchemy14151203.json'
import * as infuraGoerliBlock10536893 from './testdata/infura-goerli-block-10536893.json'
import * as infura15571241woTxs from './testdata/infura15571241.json'
import * as infura15571241wTxs from './testdata/infura15571241wtxns.json'
import * as infura2000004woTxs from './testdata/infura2000004wotxns.json'
import * as infura2000004wTxs from './testdata/infura2000004wtxs.json'
import * as infura15571241wTxs from './testdata/infura15571241wtxns.json' // cspell:disable-line
import * as infura2000004woTxs from './testdata/infura2000004wotxns.json' // cspell:disable-line
import * as infura2000004wTxs from './testdata/infura2000004wtxs.json' // cspell:disable-line
import * as blockDataDifficultyAsInteger from './testdata/testdata-from-rpc-difficulty-as-integer.json'
import * as testDataFromRpcGoerliLondon from './testdata/testdata-from-rpc-goerli-london.json'
import * as blockDataWithUncles from './testdata/testdata-from-rpc-with-uncles.json'
Expand Down Expand Up @@ -134,6 +133,7 @@ describe('[fromRPC] - Alchemy/Infura API block responses', () => {
it('should create pre and post merge blocks from Infura API responses to eth_getBlockByHash and eth_getBlockByNumber', () => {
const common = new Common({ chain: Mainnet })
let block = createBlockFromRPC(infura2000004woTxs as JsonRpcBlock, [], {
// cspell:disable-line
common,
setHardfork: true,
})
Expand All @@ -142,13 +142,14 @@ describe('[fromRPC] - Alchemy/Infura API block responses', () => {
infura2000004woTxs.hash,
'created premerge block w/o txns',
)
block = createBlockFromRPC(infura2000004wTxs as JsonRpcBlock, [], { common, setHardfork: true })
block = createBlockFromRPC(infura2000004wTxs as JsonRpcBlock, [], { common, setHardfork: true }) // cspell:disable-line
assert.equal(
bytesToHex(block.hash()),
infura2000004wTxs.hash,
'created premerge block with txns',
)
block = createBlockFromRPC(infura15571241woTxs as JsonRpcBlock, [], {
// cspell:disable-line
common,
setHardfork: true,
})
Expand All @@ -159,6 +160,7 @@ describe('[fromRPC] - Alchemy/Infura API block responses', () => {
)

block = createBlockFromRPC(infura15571241wTxs as JsonRpcBlock, [], {
// cspell:disable-line
common,
setHardfork: true,
})
Expand All @@ -171,7 +173,7 @@ describe('[fromRPC] - Alchemy/Infura API block responses', () => {

it('should correctly parse a cancun block over rpc', () => {
const common = new Common({ chain: Goerli, hardfork: Hardfork.Cancun })
const block = blockHeaderFromRpc(infuraGoerliBlock10536893 as JsonRpcBlock, { common })
const block = blockHeaderFromRpc(infuraGoerliBlock10536893 as JsonRpcBlock, { common }) // cspell:disable-line
const hash = hexToBytes(infuraGoerliBlock10536893.hash as PrefixedHexString)
assert.ok(equalsBytes(block.hash(), hash))
})
Expand All @@ -187,7 +189,7 @@ describe('[fromJsonRpcProvider]', () => {
global.fetch = async (_url: string, req: any) => {
const json = JSON.parse(req.body)
if (json.params[0] === '0x1850b014065b23d804ecf71a8a4691d076ca87c2e6fb8fe81ee20a4d8e884c24') {
const txData = await import(`./testdata/infura15571241wtxns.json`)
const txData = await import(`./testdata/infura15571241wtxns.json`) // cspell:disable-line
return {
ok: true,
status: 200,
Expand Down
1 change: 0 additions & 1 deletion packages/block/test/header.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// cspell:ignore NOTURN
import { Common, Goerli, Hardfork, Mainnet } from '@ethereumjs/common'
import { RLP } from '@ethereumjs/rlp'
import {
Expand Down
1 change: 0 additions & 1 deletion packages/blockchain/src/blockchain.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// cspell:ignore NOTURN
import { Block, BlockHeader, createBlock } from '@ethereumjs/block'
import { Common, ConsensusAlgorithm, ConsensusType, Hardfork, Mainnet } from '@ethereumjs/common'
import {
Expand Down
5 changes: 2 additions & 3 deletions packages/blockchain/src/consensus/clique.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// cspell:ignore NOTURN addrs
import {
cliqueEpochTransitionSigners,
cliqueIsEpochTransition,
Expand Down Expand Up @@ -548,8 +547,8 @@ export class CliqueConsensus implements Consensus {
const states = RLP.decode(signerStates as Uint8Array) as [Uint8Array, Uint8Array[]]
return states.map((state) => {
const blockNum = bytesToBigInt(state[0] as Uint8Array)
const addrs = (<any>state[1]).map((bytes: Uint8Array) => new Address(bytes))
return [blockNum, addrs]
const addresses = (<any>state[1]).map((bytes: Uint8Array) => new Address(bytes))
return [blockNum, addresses]
}) as CliqueLatestSignerStates
}

Expand Down
15 changes: 7 additions & 8 deletions packages/blockchain/test/clique.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// cspell:ignore NOTURN deauth unforked
import {
cliqueEpochTransitionSigners,
createBlock,
Expand Down Expand Up @@ -536,7 +535,7 @@ describe('Clique: Initialization', () => {
blocks[blocks.length - 1].header.number + BigInt(1),
),
[A.address, B.address],
'deauth votes',
'deauthorized votes',
)
})

Expand All @@ -556,7 +555,7 @@ describe('Clique: Initialization', () => {
)
})

it('Clique Voting: Changes reaching consensus out of bounds (via a deauth) execute on touch', async () => {
it('Clique Voting: Changes reaching consensus out of bounds (via a deauthorization) execute on touch', async () => {
const { blocks, blockchain } = await initWithSigners([A, B, C, D])
await addNextBlock(blockchain, blocks, A, [C, false])
await addNextBlock(blockchain, blocks, B)
Expand All @@ -578,7 +577,7 @@ describe('Clique: Initialization', () => {
)
})

it('Clique Voting: Changes reaching consensus out of bounds (via a deauth) may go out of consensus on first touch', async () => {
it('Clique Voting: Changes reaching consensus out of bounds (via a deauthorization) may go out of consensus on first touch', async () => {
const { blocks, blockchain } = await initWithSigners([A, B, C, D])
await addNextBlock(blockchain, blocks, A, [C, false])
await addNextBlock(blockchain, blocks, B)
Expand Down Expand Up @@ -803,15 +802,15 @@ describe('clique: reorgs', () => {
const { blocks, blockchain } = await initWithSigners([A, B])
const genesis = blocks[0]
await addNextBlock(blockchain, blocks, A, [C, true])
const headBlockUnforked = await addNextBlock(blockchain, blocks, B, [C, true])
const headBlockNotForked = await addNextBlock(blockchain, blocks, B, [C, true]) // cspell:disable-line
assert.deepEqual(
(blockchain.consensus as CliqueConsensus).cliqueActiveSigners(
blocks[blocks.length - 1].header.number + BigInt(1),
),
[A.address, B.address, C.address],
'address C added to signers',
)
assert.deepEqual((await blockchain.getCanonicalHeadBlock()).hash(), headBlockUnforked.hash())
assert.deepEqual((await blockchain.getCanonicalHeadBlock()).hash(), headBlockNotForked.hash())
await addNextBlockReorg(blockchain, blocks, genesis, B)
const headBlock = await addNextBlock(blockchain, blocks, A)
assert.deepEqual((await blockchain.getCanonicalHeadBlock()).hash(), headBlock.hash())
Expand Down Expand Up @@ -853,7 +852,7 @@ describe('clique: reorgs', () => {
await addNextBlock(blockchain, blocks, A, [C, true], undefined, common)
await addNextBlock(blockchain, blocks, B, [C, true], undefined, common)
await addNextBlock(blockchain, blocks, A, undefined, undefined, common)
const headBlockUnforked = await addNextBlock(
const headBlockNotForked = await addNextBlock(
blockchain,
blocks,
B,
Expand All @@ -868,7 +867,7 @@ describe('clique: reorgs', () => {
[A.address, B.address, C.address],
'address C added to signers'
)
assert.deepEqual((await blockchain.getCanonicalHeadBlock()).hash(), headBlockUnforked.hash())
assert.deepEqual((await blockchain.getCanonicalHeadBlock()).hash(), headBlockNotForked.hash())
await addNextBlockReorg(blockchain, blocks, genesis, B, undefined, undefined, common)
await addNextBlock(blockchain, blocks, A, undefined, undefined, common)
Expand Down
9 changes: 4 additions & 5 deletions packages/blockchain/test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// cspell:ignore staletest
import {
createBlock,
createBlockFromRLPSerializedBlock,
Expand Down Expand Up @@ -445,11 +444,11 @@ describe('blockchain test', () => {
calcDifficultyFromHeader: blocks[14].header,
})

blockchain._heads['staletest'] = blockchain._headHeaderHash
blockchain._heads['staleTest'] = blockchain._headHeaderHash

await blockchain.putHeader(forkHeader)

assert.deepEqual(blockchain._heads['staletest'], blocks[14].hash(), 'should update stale head')
assert.deepEqual(blockchain._heads['staleTest'], blocks[14].hash(), 'should update stale head')
assert.deepEqual(blockchain._headBlockHash, blocks[14].hash(), 'should update stale headBlock')
})

Expand All @@ -470,11 +469,11 @@ describe('blockchain test', () => {
calcDifficultyFromHeader: blocks[14].header,
})

blockchain._heads['staletest'] = blockchain._headHeaderHash
blockchain._heads['staleTest'] = blockchain._headHeaderHash

await blockchain.putHeader(forkHeader)

assert.deepEqual(blockchain._heads['staletest'], blocks[14].hash(), 'should update stale head')
assert.deepEqual(blockchain._heads['staleTest'], blocks[14].hash(), 'should update stale head')
assert.deepEqual(blockchain._headBlockHash, blocks[14].hash(), 'should update stale headBlock')

await blockchain.delBlock(forkHeader.hash())
Expand Down
7 changes: 3 additions & 4 deletions packages/client/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// 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'
Expand Down Expand Up @@ -277,7 +276,7 @@ export interface ConfigOptions {

/**
* If there is a reorg, this is a safe distance from which
* to try to refetch and refeed the blocks.
* to try to refetch and re-feed the blocks.
*/
safeReorgDistance?: number

Expand Down Expand Up @@ -387,7 +386,7 @@ export class Config {

public static readonly SYNCED_STATE_REMOVAL_PERIOD = 60000
// engine new payload calls can come in batch of 64, keeping 128 as the lookup factor
public static readonly ENGINE_PARENTLOOKUP_MAX_DEPTH = 128
public static readonly ENGINE_PARENT_LOOKUP_MAX_DEPTH = 128
public static readonly ENGINE_NEWPAYLOAD_MAX_EXECUTE = 2
public static readonly ENGINE_NEWPAYLOAD_MAX_TXS_EXECUTE = 200
public static readonly SNAP_AVAILABILITY_DEPTH = BigInt(128)
Expand Down Expand Up @@ -528,7 +527,7 @@ export class Config {
this.syncedStateRemovalPeriod =
options.syncedStateRemovalPeriod ?? Config.SYNCED_STATE_REMOVAL_PERIOD
this.engineParentLookupMaxDepth =
options.engineParentLookupMaxDepth ?? Config.ENGINE_PARENTLOOKUP_MAX_DEPTH
options.engineParentLookupMaxDepth ?? Config.ENGINE_PARENT_LOOKUP_MAX_DEPTH
this.engineNewpayloadMaxExecute =
options.engineNewpayloadMaxExecute ?? Config.ENGINE_NEWPAYLOAD_MAX_EXECUTE
this.engineNewpayloadMaxTxsExecute =
Expand Down
1 change: 0 additions & 1 deletion packages/client/src/ext/qheap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// cspell:ignore Andras Radics
/**
* nodejs heap, classic array implementation
*
Expand Down
1 change: 0 additions & 1 deletion packages/client/src/miner/miner.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// cspell:ignore NOTURN
import { type BlockHeader, createSealedCliqueBlockHeader } from '@ethereumjs/block'
import { ConsensusType, Hardfork } from '@ethereumjs/common'
import { Ethash } from '@ethereumjs/ethash'
Expand Down
11 changes: 5 additions & 6 deletions packages/client/src/net/server/rlpxserver.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// cspell:ignore pirl ubiq gwhale prichain
import { DPT as Devp2pDPT, RLPx as Devp2pRLPx } from '@ethereumjs/devp2p'
import { bytesToUnprefixedHex, unprefixedHexToBytes, utf8ToBytes } from '@ethereumjs/util'

Expand Down Expand Up @@ -73,11 +72,11 @@ export class RlpxServer extends Server {
'go1.6',
'go1.7',
'quorum',
'pirl',
'ubiq',
'gmc',
'gwhale',
'prichain',
'pirl', // cspell:disable-line
'ubiq', // cspell:disable-line
'gmc', // cspell:disable-line
'gwhale', // cspell:disable-line
'prichain', // cspell:disable-line
]
}

Expand Down
3 changes: 1 addition & 2 deletions packages/client/src/util/parse.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// cspell:ignore WHATWG
import { hexToBytes } from '@ethereumjs/util'
import { isMultiaddr, multiaddr } from '@multiformats/multiaddr'
import { URL } from 'url'
Expand Down Expand Up @@ -60,7 +59,7 @@ export function parseMultiaddrs(input: MultiaddrLike): Multiaddr[] {
const { ip6, port } = matchip6.groups!
return multiaddr(`/ip6/${ip6}/tcp/${port}`)
}
// parse using WHATWG URL API
// parse using WHATWG URL API // cspell:disable-line
const { hostname: ip, port } = new URL(s)
if (ip && port) {
return multiaddr(`/ip4/${ip}/tcp/${port}`)
Expand Down
11 changes: 5 additions & 6 deletions packages/client/test/rpc/engine/kaustinen6.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// cspell:ignore gethk vecs
import {
BlockHeader,
createBlockFromExecutionPayload,
Expand Down Expand Up @@ -33,7 +32,7 @@ const genesisVerkleBlockHash = '0x3fe165c03e7a77d1e3759362ebeeb16fd964cb411ce11f
* a. On the saved blocks, comma separated (were produced for kaustinen4 )
* `TEST_SAVED_NUMBERS=353,368,374,467 npx vitest run test/rpc/engine/kaustinen5.spec.ts`
* b. Geth produced testvectors (were produced for kaustinen5)
* `TEST_GETH_VEC_DIR=test/testdata/gethk5vecs DEBUG=ethjs,vm:*,evm:*,statemanager:verkle* npx vitest run test/rpc/engine/kaustinen6.spec.ts`
* `TEST_GETH_VEC_DIR=test/testdata/gethk5vecs DEBUG=ethjs,vm:*,evm:*,statemanager:verkle* npx vitest run test/rpc/engine/kaustinen6.spec.ts` // cspell:disable-line
*/

const originalValidate = (BlockHeader as any).prototype._consensusFormatValidation
Expand Down Expand Up @@ -147,10 +146,10 @@ describe(`valid verkle network setup`, async () => {

if (process.env.TEST_GETH_VEC_DIR !== undefined) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
const gethVecs = await loadGethVectors(process.env.TEST_GETH_VEC_DIR, { common })
let parent = gethVecs[0]
for (let i = 1; i < gethVecs.length; i++) {
const execute = gethVecs[i]
const gethVectors = await loadGethVectors(process.env.TEST_GETH_VEC_DIR, { common })
let parent = gethVectors[0]
for (let i = 1; i < gethVectors.length; i++) {
const execute = gethVectors[i]
it(`run geth vector: ${execute.blockNumber}`, async (context) => {
await runBlock({ common, chain, rpc }, { parent, execute }, false, context)
parent = execute
Expand Down
Loading

0 comments on commit 50eaf1e

Please sign in to comment.