diff --git a/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts b/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts index cd51cd006c2..23301343881 100644 --- a/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts +++ b/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts @@ -68,7 +68,7 @@ export class AztecRPCServer implements AztecRPC { private contractDataOracle: ContractDataOracle; private simulator: AcirSimulator; private log: DebugLogger; - private clientInfo: string; + private sandboxVersion: string; constructor( private keyStore: KeyStore, @@ -82,8 +82,7 @@ export class AztecRPCServer implements AztecRPC { this.contractDataOracle = new ContractDataOracle(db, node); this.simulator = getAcirSimulator(db, node, node, node, keyStore, this.contractDataOracle); - const { version, name } = getPackageInfo(); - this.clientInfo = `${name.split('/')[name.split('/').length - 1]}@${version}`; + this.sandboxVersion = getPackageInfo().version; } /** @@ -345,11 +344,11 @@ export class AztecRPCServer implements AztecRPC { ]); return { - version, + sandboxVersion: this.sandboxVersion, + compatibleNargoVersion: NoirVersion.tag, chainId, + version, rollupAddress, - client: this.clientInfo, - compatibleNargoVersion: NoirVersion.tag, }; } diff --git a/yarn-project/aztec.js/src/contract/contract.test.ts b/yarn-project/aztec.js/src/contract/contract.test.ts index 8c450c7429c..a8f61ad50a1 100644 --- a/yarn-project/aztec.js/src/contract/contract.test.ts +++ b/yarn-project/aztec.js/src/contract/contract.test.ts @@ -29,11 +29,11 @@ describe('Contract Class', () => { const mockTxReceipt = { type: 'TxReceipt' } as any as TxReceipt; const mockViewResultValue = 1; const mockNodeInfo: NodeInfo = { + sandboxVersion: 'vx.x.x', + compatibleNargoVersion: 'vx.x.x-aztec.x', version: 1, chainId: 2, rollupAddress: EthAddress.random(), - client: '', - compatibleNargoVersion: 'vx.x.x-aztec.x', }; const defaultAbi: ContractAbi = { diff --git a/yarn-project/cli/src/client.test.ts b/yarn-project/cli/src/client.test.ts index d4e6de3fdb9..10a8445acf9 100644 --- a/yarn-project/cli/src/client.test.ts +++ b/yarn-project/cli/src/client.test.ts @@ -13,19 +13,19 @@ describe('client', () => { }); it('checks versions match', async () => { - rpc.getNodeInfo.mockResolvedValue({ client: 'rpc@0.1.0-alpha47' } as NodeInfo); + rpc.getNodeInfo.mockResolvedValue({ sandboxVersion: '0.1.0-alpha47' } as NodeInfo); await checkServerVersion(rpc, '0.1.0-alpha47'); }); it('reports mismatch on older rpc version', async () => { - rpc.getNodeInfo.mockResolvedValue({ client: 'rpc@0.1.0-alpha47' } as NodeInfo); + rpc.getNodeInfo.mockResolvedValue({ sandboxVersion: '0.1.0-alpha47' } as NodeInfo); await expect(checkServerVersion(rpc, '0.1.0-alpha48')).rejects.toThrowError( /is older than the expected by this CLI/, ); }); it('reports mismatch on newer rpc version', async () => { - rpc.getNodeInfo.mockResolvedValue({ client: 'rpc@0.1.0-alpha48' } as NodeInfo); + rpc.getNodeInfo.mockResolvedValue({ sandboxVersion: '0.1.0-alpha48' } as NodeInfo); await expect(checkServerVersion(rpc, '0.1.0-alpha47')).rejects.toThrowError( /is newer than the expected by this CLI/, ); diff --git a/yarn-project/cli/src/client.ts b/yarn-project/cli/src/client.ts index 26dd39a4431..d2a297580a7 100644 --- a/yarn-project/cli/src/client.ts +++ b/yarn-project/cli/src/client.ts @@ -51,25 +51,26 @@ class VersionMismatchError extends Error {} */ export async function checkServerVersion(rpc: AztecRPC, expectedVersionRange: string) { const serverName = 'Aztec Sandbox'; - const { client } = await rpc.getNodeInfo(); - if (!client) { + const { sandboxVersion } = await rpc.getNodeInfo(); + if (!sandboxVersion) { throw new VersionMismatchError(`Couldn't determine ${serverName} version. You may run into issues.`); } - const version = client.split('@')[1]; - if (!version || !valid(version)) { - throw new VersionMismatchError(`Missing or invalid version identifier for ${serverName} (${version ?? 'empty'}).`); - } else if (!satisfies(version, expectedVersionRange)) { - if (gtr(version, expectedVersionRange)) { + if (!sandboxVersion || !valid(sandboxVersion)) { + throw new VersionMismatchError( + `Missing or invalid version identifier for ${serverName} (${sandboxVersion ?? 'empty'}).`, + ); + } else if (!satisfies(sandboxVersion, expectedVersionRange)) { + if (gtr(sandboxVersion, expectedVersionRange)) { throw new VersionMismatchError( - `${serverName} is running version ${version} which is newer than the expected by this CLI (${expectedVersionRange}). Consider upgrading your CLI to a newer version.`, + `${serverName} is running version ${sandboxVersion} which is newer than the expected by this CLI (${expectedVersionRange}). Consider upgrading your CLI to a newer version.`, ); - } else if (ltr(version, expectedVersionRange)) { + } else if (ltr(sandboxVersion, expectedVersionRange)) { throw new VersionMismatchError( - `${serverName} is running version ${version} which is older than the expected by this CLI (${expectedVersionRange}). Consider upgrading your ${serverName} to a newer version.`, + `${serverName} is running version ${sandboxVersion} which is older than the expected by this CLI (${expectedVersionRange}). Consider upgrading your ${serverName} to a newer version.`, ); } else { throw new VersionMismatchError( - `${serverName} is running version ${version} which does not match the expected by this CLI (${expectedVersionRange}).`, + `${serverName} is running version ${sandboxVersion} which does not match the expected by this CLI (${expectedVersionRange}).`, ); } } diff --git a/yarn-project/types/src/interfaces/aztec_rpc.ts b/yarn-project/types/src/interfaces/aztec_rpc.ts index fbd00968925..d45b9a12bd6 100644 --- a/yarn-project/types/src/interfaces/aztec_rpc.ts +++ b/yarn-project/types/src/interfaces/aztec_rpc.ts @@ -37,25 +37,25 @@ export interface DeployedContract { */ export type NodeInfo = { /** - * The version number of the node. + * Version as tracked in the aztec-packages repository. */ - version: number; + sandboxVersion: string; /** - * The network's chain id. + * The nargo version compatible with this sandbox version */ - chainId: number; + compatibleNargoVersion: string; /** - * The rollup contract address + * L1 chain id. */ - rollupAddress: EthAddress; + chainId: number; /** - * Identifier of the client software. + * Protocol version. */ - client: string; + version: number; /** - * The nargo version compatible with this node. + * The rollup contract address */ - compatibleNargoVersion: string; + rollupAddress: EthAddress; }; /** Provides up to which block has been synced by different components. */