Skip to content

Commit 86d353a

Browse files
authored
Client trusted setup path fixes (#2526)
* Copy trustedSetup folder to client dist folder on build * Switch to self-contained trusted setup path creations where possible (particularly for bin/cli.ts in Client)
1 parent bad735b commit 86d353a

File tree

9 files changed

+9
-9
lines changed

9 files changed

+9
-9
lines changed

packages/client/bin/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ async function run() {
579579

580580
// TODO sharding: Just initialize kzg library now, in future it can be optimized to be
581581
// loaded and initialized on the sharding hardfork activation
582-
initKZG(kzg, __dirname + '/../../client/lib/trustedSetups/devnet4.txt')
582+
initKZG(kzg, __dirname + '/../lib/trustedSetups/devnet4.txt')
583583
// Give network id precedence over network name
584584
const chain = args.networkId ?? args.network ?? Chain.Mainnet
585585

packages/client/devnets/4844-interop/tools/txGenerator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const input = process.argv[3] // text to generate blob from
1717
const genesisJson = require(process.argv[4]) // Genesis parameters
1818
const pkey = Buffer.from(process.argv[5], 'hex') // private key of tx sender as unprefixed hex string
1919

20-
initKZG(kzg, __dirname + '/../../../client/lib/trustedSetups/devnet4.txt')
20+
initKZG(kzg, __dirname + '/../../../lib/trustedSetups/devnet4.txt')
2121

2222
const sender = Address.fromPrivateKey(pkey)
2323
const common = Common.fromGethGenesis(genesisJson, {

packages/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
],
3232
"scripts": {
3333
"binWorkaround": "test -f dist/bin/cli.js || echo 'install fails if bin script does not exist (https://github.com/npm/cli/issues/2632), creating placeholder file at \"dist/bin/cli.js\"' && mkdir -p 'dist/bin' && touch dist/bin/cli.js",
34-
"build": "npm run build:common",
34+
"build": "npm run build:common && mkdir -p ./lib/trustedSetup/ && cp -Rf ./lib/trustedSetups ./dist/lib/",
3535
"build:browser": "../../config/cli/ts-build.sh browser && npm run bundle && rm -rf dist.browser",
3636
"build:common": "../../config/cli/ts-build.sh",
3737
"bundle": "webpack",

packages/client/test/miner/pendingBlock.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ tape('[PendingBlock]', async (t) => {
248248
} catch {
249249
/** ensure kzg is setup */
250250
}
251-
initKZG(kzg, __dirname + '/../../../client/lib/trustedSetups/devnet4.txt')
251+
initKZG(kzg, __dirname + '/../../lib/trustedSetups/devnet4.txt')
252252
const gethGenesis = require('../../../block/test/testdata/4844-hardfork.json')
253253
const common = Common.fromGethGenesis(gethGenesis, {
254254
chain: 'customChain',

packages/client/test/rpc/engine/getBlobsBundleV1.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const validPayloadAttributes = {
2525

2626
const validPayload = [validForkChoiceState, { ...validPayloadAttributes, withdrawals: [] }]
2727

28-
initKZG(kzg, __dirname + '/../../../../client/lib/trustedSetups/devnet4.txt')
28+
initKZG(kzg, __dirname + '/../../../lib/trustedSetups/devnet4.txt')
2929
const method = 'engine_getBlobsBundleV1'
3030

3131
tape(`${method}: call with invalid payloadId`, async (t) => {

packages/client/test/rpc/eth/sendRawTransaction.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ tape('blob EIP 4844 transaction', async (t) => {
220220
} catch {
221221
// NOOP - just verifying KZG is ready if not already
222222
}
223-
initKZG(kzg, __dirname + '/../../../../client/lib/trustedSetups/devnet4.txt')
223+
initKZG(kzg, __dirname + '/../../../lib/trustedSetups/devnet4.txt')
224224
const gethGenesis = require('../../../../block/test/testdata/4844-hardfork.json')
225225
const common = Common.fromGethGenesis(gethGenesis, {
226226
chain: 'customChain',

packages/client/test/sim/simutils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type { Client } from 'jayson/promise'
1717

1818
export const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms))
1919
// Initialize the kzg object with the kzg library
20-
initKZG(kzg, __dirname + '/../../../client/lib/trustedSetups/devnet4.txt')
20+
initKZG(kzg, __dirname + '/../../lib/trustedSetups/devnet4.txt')
2121

2222
export async function waitForELOnline(client: Client): Promise<string> {
2323
for (let i = 0; i < 15; i++) {

packages/client/test/sim/txGenerator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const MAX_BLOBS_PER_TX = 2
1818
const MAX_USEFUL_BYTES_PER_TX = USEFUL_BYTES_PER_BLOB * MAX_BLOBS_PER_TX - 1
1919
const BLOB_SIZE = BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_BLOB
2020

21-
initKZG(kzg, __dirname + '/../../../tx/trustedSetup/devnet4.txt')
21+
initKZG(kzg, __dirname + '/../../lib/trustedSetup/devnet4.txt')
2222
const pkey = Buffer.from('45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8', 'hex')
2323
const sender = Address.fromPrivateKey(pkey)
2424

packages/tx/src/kzg/kzg.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export let kzg: Kzg = {
1818
* @param kzgLib a KZG implementation (defaults to c-kzg)
1919
* @param trustedSetupPath the full path (e.g. "/home/linux/devnet4.txt") to a kzg trusted setup text file
2020
*/
21-
export function initKZG(kzgLib: Kzg, trustedSetupPath = __dirname + '/devnet4.txt') {
21+
export function initKZG(kzgLib: Kzg, trustedSetupPath: string) {
2222
kzg = kzgLib
2323
kzg.loadTrustedSetup(trustedSetupPath)
2424
}

0 commit comments

Comments
 (0)