From 4e4082ace70bfd5eb5575bb5d61a2b6dfb60a18a Mon Sep 17 00:00:00 2001 From: Gabriel Rocheleau Date: Fri, 6 Sep 2024 15:46:26 -0400 Subject: [PATCH] monorepo: more adjustments related to json and rpc (#3639) * monorepo: more adjustments related to json and rpc * client: helpRPC casing * wallet: revert wallet test updates --------- Co-authored-by: Jochem Brouwer --- config/cspell-ts.json | 2 ++ packages/block/src/block/constructors.ts | 4 +-- packages/block/src/from-beacon-payload.ts | 2 +- packages/block/src/header/header.ts | 14 +++++----- packages/block/test/eip7685block.spec.ts | 7 +++-- .../block/test/from-beacon-payload.spec.ts | 4 +-- packages/block/test/from-rpc.spec.ts | 6 ++-- .../client/archive/libp2p/cli-libp2p.spec.ts | 4 +-- packages/client/bin/cli.ts | 4 +-- packages/client/bin/startRPC.ts | 6 ++-- packages/client/src/execution/vmexecution.ts | 4 +-- packages/client/src/rpc/helpers.ts | 2 +- packages/client/src/rpc/modules/eth.ts | 28 +++++++++---------- packages/client/src/rpc/modules/txpool.ts | 4 +-- packages/client/src/util/rpc.ts | 14 +++++----- packages/client/test/cli/cli.spec.ts | 2 +- .../test/rpc/engine/newPayloadV3.spec.ts | 10 +++---- .../test/rpc/engine/newPayloadV4.spec.ts | 4 +-- packages/common/examples/fromGeth.ts | 2 +- packages/common/src/common.ts | 2 +- packages/common/src/constructors.ts | 4 +-- packages/statemanager/examples/evm.ts | 2 +- scripts/check-dependencies.js | 10 +++---- 23 files changed, 72 insertions(+), 69 deletions(-) diff --git a/config/cspell-ts.json b/config/cspell-ts.json index 4b95f2ab9d..8c59d40808 100644 --- a/config/cspell-ts.json +++ b/config/cspell-ts.json @@ -12,6 +12,8 @@ } ], "words": [ + "!Json", + "!Rpc", "Hardfork", "hardfork", "Chainstart", diff --git a/packages/block/src/block/constructors.ts b/packages/block/src/block/constructors.ts index a80135973f..be48558e0b 100644 --- a/packages/block/src/block/constructors.ts +++ b/packages/block/src/block/constructors.ts @@ -471,8 +471,8 @@ export async function createBlockFromExecutionPayload( } /** - * Method to retrieve a block from a beacon payload json - * @param payload json of a beacon beacon fetched from beacon apis + * Method to retrieve a block from a beacon payload JSON + * @param payload JSON of a beacon beacon fetched from beacon apis * @param opts {@link BlockOptions} * @returns the block constructed block */ diff --git a/packages/block/src/from-beacon-payload.ts b/packages/block/src/from-beacon-payload.ts index da775dce6a..6492f15534 100644 --- a/packages/block/src/from-beacon-payload.ts +++ b/packages/block/src/from-beacon-payload.ts @@ -30,7 +30,7 @@ type BeaconConsolidationRequest = { target_pubkey: PrefixedHexString } -// Payload json that one gets using the beacon apis +// Payload JSON that one gets using the beacon apis // curl localhost:5052/eth/v2/beacon/blocks/56610 | jq .data.message.body.execution_payload export type BeaconPayloadJSON = { parent_hash: PrefixedHexString diff --git a/packages/block/src/header/header.ts b/packages/block/src/header/header.ts index 568fb38b4e..9f24919f56 100644 --- a/packages/block/src/header/header.ts +++ b/packages/block/src/header/header.ts @@ -740,7 +740,7 @@ export class BlockHeader { const withdrawalAttr = this.withdrawalsRoot ? { withdrawalsRoot: bytesToHex(this.withdrawalsRoot) } : {} - const jsonDict: JSONHeader = { + const JSONDict: JSONHeader = { parentHash: bytesToHex(this.parentHash), uncleHash: bytesToHex(this.uncleHash), coinbase: this.coinbase.toString(), @@ -759,19 +759,19 @@ export class BlockHeader { nonce: bytesToHex(this.nonce), } if (this.common.isActivatedEIP(1559)) { - jsonDict.baseFeePerGas = bigIntToHex(this.baseFeePerGas!) + JSONDict.baseFeePerGas = bigIntToHex(this.baseFeePerGas!) } if (this.common.isActivatedEIP(4844)) { - jsonDict.blobGasUsed = bigIntToHex(this.blobGasUsed!) - jsonDict.excessBlobGas = bigIntToHex(this.excessBlobGas!) + JSONDict.blobGasUsed = bigIntToHex(this.blobGasUsed!) + JSONDict.excessBlobGas = bigIntToHex(this.excessBlobGas!) } if (this.common.isActivatedEIP(4788)) { - jsonDict.parentBeaconBlockRoot = bytesToHex(this.parentBeaconBlockRoot!) + JSONDict.parentBeaconBlockRoot = bytesToHex(this.parentBeaconBlockRoot!) } if (this.common.isActivatedEIP(7685)) { - jsonDict.requestsRoot = bytesToHex(this.requestsRoot!) + JSONDict.requestsRoot = bytesToHex(this.requestsRoot!) } - return jsonDict + return JSONDict } /** diff --git a/packages/block/test/eip7685block.spec.ts b/packages/block/test/eip7685block.spec.ts index bec0196d0a..6b3f314f6c 100644 --- a/packages/block/test/eip7685block.spec.ts +++ b/packages/block/test/eip7685block.spec.ts @@ -17,6 +17,7 @@ import { createBlockHeader, } from '../src/index.js' +import type { JSONRPCBlock } from '../src/index.js' import type { CLRequest, CLRequestType } from '@ethereumjs/util' function getRandomDepositRequest(): CLRequest { @@ -153,9 +154,9 @@ describe('fromRPC tests', () => { common, }, ) - const jsonBlock = block.toJSON() - const rpcBlock: any = { ...jsonBlock.header, requests: jsonBlock.requests } - const createBlockFromJSON = createBlockFromRPC(rpcBlock, undefined, { common }) + const JSONBlock = block.toJSON() + const RPCBlock = { ...JSONBlock.header, requests: JSONBlock.requests } + const createBlockFromJSON = createBlockFromRPC(RPCBlock as JSONRPCBlock, undefined, { common }) assert.deepEqual(block.hash(), createBlockFromJSON.hash()) }) }) diff --git a/packages/block/test/from-beacon-payload.spec.ts b/packages/block/test/from-beacon-payload.spec.ts index 0705dbffb5..0b46c60c30 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 underlying 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 underlying 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 d0da8fa32e..92b467d9fe 100644 --- a/packages/block/test/from-rpc.spec.ts +++ b/packages/block/test/from-rpc.spec.ts @@ -42,7 +42,7 @@ describe('[fromRPC]: block #2924874', () => { }) describe('[fromRPC]:', () => { - it('Should create a block with json data that includes a transaction with value parameter as integer string', () => { + it('Should create a block with JSON data that includes a transaction with value parameter as integer string', () => { const common = new Common({ chain: Mainnet, hardfork: Hardfork.London }) const valueAsIntegerString = '1' const blockDataTransactionValueAsInteger = blockData @@ -58,7 +58,7 @@ describe('[fromRPC]:', () => { ) }) - it('Should create a block with json data that includes a transaction with defaults with gasPrice parameter as integer string', () => { + it('Should create a block with JSON data that includes a transaction with defaults with gasPrice parameter as integer string', () => { const common = new Common({ chain: Mainnet, hardfork: Hardfork.London }) const gasPriceAsIntegerString = '1' const blockDataTransactionGasPriceAsInteger = blockData @@ -74,7 +74,7 @@ describe('[fromRPC]:', () => { ) }) - it('should create a block given json data that includes a difficulty parameter of type integer string', () => { + it('should create a block given JSON data that includes a difficulty parameter of type integer string', () => { const common = new Common({ chain: Mainnet, hardfork: Hardfork.London }) const blockDifficultyAsInteger = createBlockFromRPC( blockDataDifficultyAsInteger as JSONRPCBlock, diff --git a/packages/client/archive/libp2p/cli-libp2p.spec.ts b/packages/client/archive/libp2p/cli-libp2p.spec.ts index 57ca7d08e1..a8a4ebd495 100644 --- a/packages/client/archive/libp2p/cli-libp2p.spec.ts +++ b/packages/client/archive/libp2p/cli-libp2p.spec.ts @@ -12,7 +12,7 @@ const end = (child: ChildProcessWithoutNullStreams, hasEnded: boolean) => { assert.ok(res, 'client shut down successfully') } -describe('[CLI] rpc', () => { +describe('[CLI] RPC', () => { it('libp2p should start up', () => { const file = require.resolve('../../dist/bin/cli.js') const child = spawn(process.execPath, [ @@ -34,7 +34,7 @@ describe('[CLI] rpc', () => { assert.ok(true, 'libp2p server started') const bootnodeAddressArray = message.split(' ') const bootnodeAddressIndex = bootnodeAddressArray.findIndex((chunk: string) => - chunk.startsWith('url=') + chunk.startsWith('url='), ) const bootNodeAddress = bootnodeAddressArray[bootnodeAddressIndex].split('=')[1] child2 = spawn(process.execPath, [ diff --git a/packages/client/bin/cli.ts b/packages/client/bin/cli.ts index 3d3458603d..64a2b5559d 100755 --- a/packages/client/bin/cli.ts +++ b/packages/client/bin/cli.ts @@ -59,7 +59,7 @@ import { Event } from '../src/types.js' import { parseMultiaddrs } from '../src/util/index.js' import { setupMetrics } from '../src/util/metrics.js' -import { helprpc, startRPCServers } from './startRPC.js' +import { helpRPC, startRPCServers } from './startRPC.js' import type { Logger } from '../src/logging.js' import type { FullEthereumService } from '../src/service/index.js' @@ -924,7 +924,7 @@ const stopClient = async ( async function run() { if (args.helpRPC === true) { // Output RPC help and exit - return helprpc() + return helpRPC() } // TODO sharding: Just initialize kzg library now, in future it can be optimized to be diff --git a/packages/client/bin/startRPC.ts b/packages/client/bin/startRPC.ts index 5741cdd1b5..8c3fde355e 100644 --- a/packages/client/bin/startRPC.ts +++ b/packages/client/bin/startRPC.ts @@ -119,7 +119,7 @@ export function startRPCServers(client: EthereumClient, args: RPCArgs) { if (rpc) { rpcHttpServer = createRPCServerListener({ - rpcCors, + RPCCors: rpcCors, server, withEngineMiddleware: withEngineMethods && rpcEngineAuth @@ -179,7 +179,7 @@ export function startRPCServers(client: EthereumClient, args: RPCArgs) { }) servers.push(server) const rpcHttpServer = createRPCServerListener({ - rpcCors, + RPCCors: rpcCors, server, withEngineMiddleware: rpcEngineAuth ? { @@ -228,7 +228,7 @@ export function startRPCServers(client: EthereumClient, args: RPCArgs) { /** * Output RPC help and exit */ -export function helprpc() { +export function helpRPC() { console.log('-'.repeat(27)) console.log('JSON-RPC: Supported Methods') console.log('-'.repeat(27)) diff --git a/packages/client/src/execution/vmexecution.ts b/packages/client/src/execution/vmexecution.ts index 238d3f3082..c601e98700 100644 --- a/packages/client/src/execution/vmexecution.ts +++ b/packages/client/src/execution/vmexecution.ts @@ -815,13 +815,13 @@ export class VMExecution extends Execution { // save the data in spec test compatible manner const blockNumStr = `${errorBlock.header.number}` const file = `${this.config.getInvalidPayloadsDir()}/${blockNumStr}.json` - const jsonDump = { + const JSONDump = { [blockNumStr]: { parent: headBlock.toExecutionPayload(), execute: errorBlock.toExecutionPayload(), }, } - writeFileSync(file, JSON.stringify(jsonDump, null, 2)) + writeFileSync(file, JSON.stringify(JSONDump, null, 2)) this.config.logger.warn(`${errorMsg}:\n${error} payload saved to=${file}`) } else { this.config.logger.warn(`${errorMsg}:\n${error}`) diff --git a/packages/client/src/rpc/helpers.ts b/packages/client/src/rpc/helpers.ts index 8ab01a2dd8..24cc138b40 100644 --- a/packages/client/src/rpc/helpers.ts +++ b/packages/client/src/rpc/helpers.ts @@ -36,7 +36,7 @@ export function callWithStackTrace(handler: Function, debug: boolean) { /** * Returns tx formatted to the standard JSON-RPC fields */ -export const jsonRPCTx = (tx: TypedTransaction, block?: Block, txIndex?: number): JSONRPCTx => { +export const toJSONRPCTx = (tx: TypedTransaction, block?: Block, txIndex?: number): JSONRPCTx => { const txJSON = tx.toJSON() return { blockHash: block ? bytesToHex(block.hash()) : null, diff --git a/packages/client/src/rpc/modules/eth.ts b/packages/client/src/rpc/modules/eth.ts index 55992fa7b4..ae2132c484 100644 --- a/packages/client/src/rpc/modules/eth.ts +++ b/packages/client/src/rpc/modules/eth.ts @@ -35,7 +35,7 @@ import { } from '@ethereumjs/vm' import { INTERNAL_ERROR, INVALID_HEX_STRING, INVALID_PARAMS, PARSE_ERROR } from '../error-code.js' -import { callWithStackTrace, getBlockByOption, jsonRPCTx } from '../helpers.js' +import { callWithStackTrace, getBlockByOption, toJSONRPCTx } from '../helpers.js' import { middleware, validators } from '../validation.js' import type { Chain } from '../../blockchain/index.js' @@ -102,7 +102,7 @@ type JSONRPCLog = { /** * Returns block formatted to the standard JSON-RPC fields */ -const jsonRPCBlock = async ( +const toJSONRPCBlock = async ( block: Block, chain: Chain, includeTransactions: boolean, @@ -110,7 +110,7 @@ const jsonRPCBlock = async ( const json = block.toJSON() const header = json!.header! const transactions = block.transactions.map((tx, txIndex) => - includeTransactions ? jsonRPCTx(tx, block, txIndex) : bytesToHex(tx.hash()), + includeTransactions ? toJSONRPCTx(tx, block, txIndex) : bytesToHex(tx.hash()), ) const withdrawalsAttr = header.withdrawalsRoot !== undefined @@ -154,7 +154,7 @@ const jsonRPCBlock = async ( /** * Returns log formatted to the standard JSON-RPC fields */ -const jsonRPCLog = async ( +const toJSONRPCLog = async ( log: Log, block?: Block, tx?: TypedTransaction, @@ -175,7 +175,7 @@ const jsonRPCLog = async ( /** * Returns receipt formatted to the standard JSON-RPC fields */ -const jsonRPCReceipt = async ( +const toJSONRPCReceipt = async ( receipt: TxReceipt, gasUsed: bigint, effectiveGasPrice: bigint, @@ -198,7 +198,7 @@ const jsonRPCReceipt = async ( gasUsed: bigIntToHex(gasUsed), contractAddress: contractAddress?.toString() ?? null, logs: await Promise.all( - receipt.logs.map((l, i) => jsonRPCLog(l, block, tx, txIndex, logIndex + i)), + receipt.logs.map((l, i) => toJSONRPCLog(l, block, tx, txIndex, logIndex + i)), ), logsBloom: bytesToHex(receipt.bitvector), root: @@ -680,7 +680,7 @@ export class Eth { try { const block = await this._chain.getBlock(hexToBytes(blockHash)) - return await jsonRPCBlock(block, this._chain, includeTransactions) + return await toJSONRPCBlock(block, this._chain, includeTransactions) } catch (error) { return null } @@ -702,7 +702,7 @@ export class Eth { } try { const block = await getBlockByOption(blockOpt, this._chain) - const response = await jsonRPCBlock(block, this._chain, includeTransactions) + const response = await toJSONRPCBlock(block, this._chain, includeTransactions) return response } catch { return null @@ -812,7 +812,7 @@ export class Eth { } const tx = block.transactions[txIndex] - return jsonRPCTx(tx, block, txIndex) + return toJSONRPCTx(tx, block, txIndex) } catch (error: any) { throw { code: INVALID_PARAMS, @@ -837,7 +837,7 @@ export class Eth { } const tx = block.transactions[txIndex] - return jsonRPCTx(tx, block, txIndex) + return toJSONRPCTx(tx, block, txIndex) } catch (error: any) { throw { code: INVALID_PARAMS, @@ -859,7 +859,7 @@ export class Eth { const [_receipt, blockHash, txIndex] = result const block = await this._chain.getBlock(blockHash) const tx = block.transactions[txIndex] - return jsonRPCTx(tx, block, txIndex) + return toJSONRPCTx(tx, block, txIndex) } /** @@ -969,7 +969,7 @@ export class Eth { block.header.baseFeePerGas! : (tx as LegacyTx).gasPrice - return jsonRPCReceipt( + return toJSONRPCReceipt( r, totalGasSpent, effectiveGasPrice, @@ -1031,7 +1031,7 @@ export class Eth { const { totalGasSpent, createdAddress } = runBlockResult.results[txIndex] const { blobGasPrice, blobGasUsed } = runBlockResult.receipts[txIndex] as EIP4844BlobTxReceipt - return jsonRPCReceipt( + return toJSONRPCReceipt( receipt, totalGasSpent, effectiveGasPrice, @@ -1130,7 +1130,7 @@ export class Eth { const logs = await this.receiptsManager.getLogs(from, to, addressBytes, formattedTopics) return Promise.all( logs.map(({ log, block, tx, txIndex, logIndex }) => - jsonRPCLog(log, block, tx, txIndex, logIndex), + toJSONRPCLog(log, block, tx, txIndex, logIndex), ), ) } diff --git a/packages/client/src/rpc/modules/txpool.ts b/packages/client/src/rpc/modules/txpool.ts index 575f06f8ef..2f0a17d621 100644 --- a/packages/client/src/rpc/modules/txpool.ts +++ b/packages/client/src/rpc/modules/txpool.ts @@ -1,4 +1,4 @@ -import { callWithStackTrace, jsonRPCTx } from '../helpers.js' +import { callWithStackTrace, toJSONRPCTx } from '../helpers.js' import { middleware } from '../validation.js' import type { EthereumClient } from '../../index.js' @@ -37,7 +37,7 @@ export class TxPool { for (const pool of this._txpool.pool) { const pendingForAcct = new Map() for (const tx of pool[1]) { - pendingForAcct.set(tx.tx.nonce, jsonRPCTx(tx.tx)) + pendingForAcct.set(tx.tx.nonce, toJSONRPCTx(tx.tx)) } if (pendingForAcct.size > 0) pending.set('0x' + pool[0], Object.fromEntries(pendingForAcct)) } diff --git a/packages/client/src/util/rpc.ts b/packages/client/src/util/rpc.ts index c19ee94d32..763e036ff0 100644 --- a/packages/client/src/util/rpc.ts +++ b/packages/client/src/util/rpc.ts @@ -12,7 +12,7 @@ import type { Logger } from '../logging.js' import type { RPCManager } from '../rpc/index.js' import type { IncomingMessage } from 'connect' import type { HttpServer } from 'jayson/promise' -const { json: jsonParser } = bodyParser +const { json: JSONParser } = bodyParser const { decode } = jwt const algorithm: TAlgorithm = 'HS256' @@ -29,7 +29,7 @@ type CreateRPCServerReturn = { namespaces: string } type CreateRPCServerListenerOpts = { - rpcCors?: string + RPCCors?: string server: any withEngineMiddleware?: WithEngineMiddleware } @@ -182,12 +182,12 @@ function checkHeaderAuth(req: any, jwtSecret: Uint8Array): void { } export function createRPCServerListener(opts: CreateRPCServerListenerOpts): HttpServer { - const { server, withEngineMiddleware, rpcCors } = opts + const { server, withEngineMiddleware, RPCCors } = opts const app = Connect() as any - if (typeof rpcCors === 'string') app.use(cors({ origin: rpcCors })) + if (typeof RPCCors === 'string') app.use(cors({ origin: RPCCors })) // GOSSIP_MAX_SIZE_BELLATRIX is proposed to be 10MiB - app.use(jsonParser({ limit: '11mb' })) + app.use(JSONParser({ limit: '11mb' })) if (withEngineMiddleware) { const { jwtSecret, unlessFn } = withEngineMiddleware @@ -212,7 +212,7 @@ export function createRPCServerListener(opts: CreateRPCServerListenerOpts): Http } export function createWsRPCServerListener(opts: CreateWSServerOpts): HttpServer | undefined { - const { server, withEngineMiddleware, rpcCors } = opts + const { server, withEngineMiddleware, RPCCors } = opts // Get the server to hookup upgrade request on let httpServer = opts.httpServer @@ -220,7 +220,7 @@ export function createWsRPCServerListener(opts: CreateWSServerOpts): HttpServer const app = Connect() // In case browser pre-flights the upgrade request with an options request // more likely in case of wss connection - if (typeof rpcCors === 'string') app.use(cors({ origin: rpcCors })) + if (typeof RPCCors === 'string') app.use(cors({ origin: RPCCors })) httpServer = createServer(app) } const wss = server.websocket({ noServer: true }) diff --git a/packages/client/test/cli/cli.spec.ts b/packages/client/test/cli/cli.spec.ts index 5390031cb3..8b5e0ad51f 100644 --- a/packages/client/test/cli/cli.spec.ts +++ b/packages/client/test/cli/cli.spec.ts @@ -763,7 +763,7 @@ describe('[CLI]', () => { if (message.includes('Initializing Ethereumjs client')) { assert.ok( message.includes('network=customChain'), - 'Client respects custom chain parameters json file option', + 'Client respects custom chain parameters JSON file option', ) } if (message.includes('Client started successfully')) { diff --git a/packages/client/test/rpc/engine/newPayloadV3.spec.ts b/packages/client/test/rpc/engine/newPayloadV3.spec.ts index 915a8b6e4f..76347e8ee6 100644 --- a/packages/client/test/rpc/engine/newPayloadV3.spec.ts +++ b/packages/client/test/rpc/engine/newPayloadV3.spec.ts @@ -17,7 +17,7 @@ describe(`${method}: call with executionPayloadV3`, () => { engine: true, }) const rpc = getRPCClient(server) - // get the genesis json with current date + // get the genesis JSON with current date const validBlock = { ...blockData, withdrawals: [], @@ -33,9 +33,9 @@ describe(`${method}: call with executionPayloadV3`, () => { }) it('valid data', async () => { - // get the genesis json with late enough 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 + // deep copy JSON and add shanghai and cancun to genesis to avoid contamination const cancunJSON = JSON.parse(JSON.stringify(genesisJSON)) cancunJSON.config.shanghaiTime = cancunTime cancunJSON.config.cancunTime = cancunTime @@ -71,9 +71,9 @@ describe(`${method}: call with executionPayloadV3`, () => { }) it('fcU and verify that no errors occur on new payload', async () => { - // get the genesis json with late enough 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 + // deep copy JSON and add shanghai and cancun to genesis to avoid contamination const cancunJSON = JSON.parse(JSON.stringify(genesisJSON)) cancunJSON.config.shanghaiTime = cancunTime cancunJSON.config.cancunTime = cancunTime diff --git a/packages/client/test/rpc/engine/newPayloadV4.spec.ts b/packages/client/test/rpc/engine/newPayloadV4.spec.ts index 65395423fd..bf4e335f3d 100644 --- a/packages/client/test/rpc/engine/newPayloadV4.spec.ts +++ b/packages/client/test/rpc/engine/newPayloadV4.spec.ts @@ -33,7 +33,7 @@ const validPayload = [ function readyPragueGenesis(genesisJSON: any) { const pragueTime = 1689945325 - // deep copy json and add shanghai and cancun to genesis to avoid contamination + // deep copy JSON and add shanghai and cancun to genesis to avoid contamination const pragueJSON = JSON.parse(JSON.stringify(genesisJSON)) pragueJSON.config.shanghaiTime = pragueTime pragueJSON.config.cancunTime = pragueTime @@ -45,7 +45,7 @@ function readyPragueGenesis(genesisJSON: any) { describe(`${method}: call with executionPayloadV4`, () => { it('valid data', async () => { - // get the genesis json with late enough date with respect to block data in batchBlocks + // get the genesis JSON with late enough date with respect to block data in batchBlocks const { pragueJSON, pragueTime } = readyPragueGenesis(genesisJSON) const { service, server } = await setupChain(pragueJSON, 'post-merge', { engine: true }) diff --git a/packages/common/examples/fromGeth.ts b/packages/common/examples/fromGeth.ts index e12aa7f5f6..6bad8a5f36 100644 --- a/packages/common/examples/fromGeth.ts +++ b/packages/common/examples/fromGeth.ts @@ -4,7 +4,7 @@ import { hexToBytes } from '@ethereumjs/util' import genesisJSON from './genesisData/post-merge.json' const genesisHash = hexToBytes('0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a') -// Load geth genesis json file into lets say `genesisJSON` and optional `chain` and `genesisHash` +// Load geth genesis JSON file into lets say `genesisJSON` and optional `chain` and `genesisHash` const common = createCommonFromGethGenesis(genesisJSON, { chain: 'customChain', genesisHash }) // If you don't have `genesisHash` while initiating common, you can later configure common (for e.g. // after calculating it via `blockchain`) diff --git a/packages/common/src/common.ts b/packages/common/src/common.ts index 0b07ac5d84..7f04065540 100644 --- a/packages/common/src/common.ts +++ b/packages/common/src/common.ts @@ -811,7 +811,7 @@ export class Common { * parameters based on the consensus algorithm * * Expected returns (parameters must be present in - * the respective chain json files): + * the respective chain JSON files): * * ethash: empty object * clique: period, epoch diff --git a/packages/common/src/constructors.ts b/packages/common/src/constructors.ts index 0e6c69cc09..66950734d3 100644 --- a/packages/common/src/constructors.ts +++ b/packages/common/src/constructors.ts @@ -33,8 +33,8 @@ export function createCustomCommon( } /** - * Static method to load and set common from a geth genesis json - * @param genesisJSON json of geth configuration + * Static method to load and set common from a geth genesis JSON + * @param genesisJSON JSON of geth configuration * @param opts additional {@link GethConfigOpts} for configuring common * @returns Common */ diff --git a/packages/statemanager/examples/evm.ts b/packages/statemanager/examples/evm.ts index 5e767aa137..26777fd60a 100644 --- a/packages/statemanager/examples/evm.ts +++ b/packages/statemanager/examples/evm.ts @@ -9,7 +9,7 @@ const main = async () => { const state = new RPCStateManager({ provider, blockTag }) const evm = await createEVM({ blockchain, stateManager: state }) // note that evm is ready to run BLOCKHASH opcodes (over RPC) } catch (e) { - console.log(e.message) // fetch would fail because provider url is not real. please replace provider with a valid rpc url string. + console.log(e.message) // fetch would fail because provider url is not real. please replace provider with a valid RPC url string. } } void main() diff --git a/scripts/check-dependencies.js b/scripts/check-dependencies.js index ea08066208..ade14f1e0a 100644 --- a/scripts/check-dependencies.js +++ b/scripts/check-dependencies.js @@ -12,7 +12,7 @@ const IGNORE_FOR_PACKAGES = { //exampleDependency: ["examplePackage"] } -function checkPeerDepedencies(packageJson) { +function checkPeerDependencies(packageJson) { if (packageJson.peerDependencies === undefined) { return true } @@ -27,7 +27,7 @@ function checkPeerDepedencies(packageJson) { for (const dependency of Object.keys(packageJson.peerDependencies)) { if (packageJson.devDependencies[dependency] === undefined) { console.error( - `${packageJson.name} has ${dependency} as peerDependency, but not as devDependency` + `${packageJson.name} has ${dependency} as peerDependency, but not as devDependency`, ) success = false @@ -37,7 +37,7 @@ function checkPeerDepedencies(packageJson) { if (packageJson.peerDependencies[dependency] !== packageJson.devDependencies[dependency]) { console.error( - `${packageJson.name} has different versions of ${dependency} as peerDependency and devDependency` + `${packageJson.name} has different versions of ${dependency} as peerDependency and devDependency`, ) success = false @@ -116,7 +116,7 @@ function getAllPackageJsonPaths() { const packageNames = fs.readdirSync(path.join(__dirname, '..', 'packages')) const packageJsons = packageNames.map((p) => - path.join(__dirname, '..', 'packages', p, 'package.json') + path.join(__dirname, '..', 'packages', p, 'package.json'), ) packageJsons.push(path.join(__dirname, '..', 'package.json')) @@ -134,7 +134,7 @@ function main() { } const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')) - const peersOk = checkPeerDepedencies(packageJson) + const peersOk = checkPeerDependencies(packageJson) const dependencyMap = getDependencyMap(packageJson) dependencyMaps.push(dependencyMap)