diff --git a/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts b/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts index d06d144b86ba..3a1b4ddb0ce1 100644 --- a/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts +++ b/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts @@ -107,8 +107,7 @@ export class JsonRpcHttpClient implements IJsonRpcHttpClient { jwtSecret?: Uint8Array; /** If jwtSecret and jwtId are provided, jwtId will be included in JwtClaim.id */ jwtId?: string; - /** If jwtSecret is provided, jwtVersion will be included in JwtClaim.clv. - * jwtVersion has default value of empty string */ + /** If jwtSecret and jwtVersion are provided, jwtVersion will be included in JwtClaim.clv. */ jwtVersion?: string; /** Retry attempts */ retryAttempts?: number; @@ -133,7 +132,7 @@ export class JsonRpcHttpClient implements IJsonRpcHttpClient { this.jwtSecret = opts?.jwtSecret; this.jwtId = opts?.jwtId; - this.jwtVersion = opts?.jwtVersion ?? ""; + this.jwtVersion = opts?.jwtVersion; this.metrics = opts?.metrics ?? null; this.metrics?.configUrlsCount.set(urls.length); diff --git a/packages/beacon-node/test/unit/eth1/jwt.test.ts b/packages/beacon-node/test/unit/eth1/jwt.test.ts index d3a7a250d7ed..5ebcdc17e355 100644 --- a/packages/beacon-node/test/unit/eth1/jwt.test.ts +++ b/packages/beacon-node/test/unit/eth1/jwt.test.ts @@ -12,7 +12,7 @@ describe("ExecutionEngine / jwt", () => { it("encode/decode correctly with id and clv", () => { const jwtSecret = Buffer.from(Array.from({length: 32}, () => Math.round(Math.random() * 255))); - const claim = {iat: Math.floor(new Date().getTime() / 1000), id: "4ac0", clv: "v1.11.3"}; + const claim = {iat: Math.floor(new Date().getTime() / 1000), id: "4ac0", clv: "Lodestar/v0.36.0/80c248bb"}; const token = encodeJwtToken(claim, jwtSecret); const decoded = decodeJwtToken(token, jwtSecret); expect(decoded).toEqual(claim); diff --git a/packages/cli/src/cmds/beacon/handler.ts b/packages/cli/src/cmds/beacon/handler.ts index 4ad83b3b9f77..a56916cdb232 100644 --- a/packages/cli/src/cmds/beacon/handler.ts +++ b/packages/cli/src/cmds/beacon/handler.ts @@ -195,14 +195,14 @@ export async function beaconHandlerInit(args: BeaconArgs & GlobalArgs) { if (args.private) { beaconNodeOptions.set({network: {private: true}}); } else { + const versionStr = `Lodestar/${version}`; + const simpleVersionStr = version.split("/")[0]; // Add simple version string for libp2p agent version - beaconNodeOptions.set({network: {version: version.split("/")[0]}}); + beaconNodeOptions.set({network: {version: simpleVersionStr}}); // Add User-Agent header to all builder requests - beaconNodeOptions.set({executionBuilder: {userAgent: `Lodestar/${version}`}}); + beaconNodeOptions.set({executionBuilder: {userAgent: versionStr}}); // Set jwt version with version string - beaconNodeOptions.set({executionEngine: {jwtVersion: `Lodestar/${version}`}}); - // Set jwt version with version string - beaconNodeOptions.set({eth1: {jwtVersion: `Lodestar/${version}`}}); + beaconNodeOptions.set({executionEngine: {jwtVersion: versionStr}, eth1: {jwtVersion: versionStr}}); } // Render final options diff --git a/packages/cli/src/options/beaconNodeOptions/eth1.ts b/packages/cli/src/options/beaconNodeOptions/eth1.ts index 2c8e49294fcc..196deb59161f 100644 --- a/packages/cli/src/options/beaconNodeOptions/eth1.ts +++ b/packages/cli/src/options/beaconNodeOptions/eth1.ts @@ -15,7 +15,6 @@ export type Eth1Args = { export function parseArgs(args: Eth1Args & Partial): IBeaconNodeOptions["eth1"] { let jwtSecretHex: string | undefined; let jwtId: string | undefined; - let jwtVersion: string | undefined; let providerUrls = args["eth1.providerUrls"];