Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ A successful run should show something like this:
enr: undefined,
nodeVersion: '0.82.0',
l1ChainId: 31337,
protocolVersion: 1,
rollupVersion: 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any thing needed in the migration notes?

Also I am adding this PR as a gating requirement for testnet - lmk if not

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in #13179

l1ContractAddresses: {
rollupAddress: EthAddress<0x759f145841f36282f23e0935697c7b2e00401902>,
registryAddress: EthAddress<0xd5448148ccca5b2f27784c72265fc37201741778>,
Expand Down
2 changes: 1 addition & 1 deletion spartan/aztec-network/templates/pxe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ spec:
- |
curl -s -X POST -H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","method":"pxe_getNodeInfo","params":[],"id":67}' \
127.0.0.1:{{ .Values.pxe.service.nodePort }} | grep -q '"protocolVersion":1'
127.0.0.1:{{ .Values.pxe.service.nodePort }} | grep -q '"rollupVersion":1'
initialDelaySeconds: {{ .Values.pxe.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.pxe.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.pxe.readinessProbe.timeoutSeconds }}
Expand Down
6 changes: 3 additions & 3 deletions yarn-project/accounts/src/dapp/dapp_interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ export class DefaultDappInterface extends DefaultAccountInterface {
authWitnessProvider: AuthWitnessProvider,
userAddress: CompleteAddress,
dappAddress: AztecAddress,
nodeInfo: Pick<NodeInfo, 'l1ChainId' | 'protocolVersion'>,
nodeInfo: Pick<NodeInfo, 'l1ChainId' | 'rollupVersion'>,
) {
super(authWitnessProvider, userAddress, nodeInfo);
this.entrypoint = new DefaultDappEntrypoint(
userAddress.address,
authWitnessProvider,
dappAddress,
nodeInfo.l1ChainId,
nodeInfo.protocolVersion,
nodeInfo.rollupVersion,
);
}

static createFromUserWallet(wallet: AccountWallet, dappAddress: AztecAddress): DefaultDappInterface {
return new DefaultDappInterface(wallet, wallet.getCompleteAddress(), dappAddress, {
l1ChainId: wallet.getChainId().toNumber(),
protocolVersion: wallet.getVersion().toNumber(),
rollupVersion: wallet.getVersion().toNumber(),
});
}
}
6 changes: 3 additions & 3 deletions yarn-project/accounts/src/defaults/account_interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ export class DefaultAccountInterface implements AccountInterface {
constructor(
private authWitnessProvider: AuthWitnessProvider,
private address: CompleteAddress,
nodeInfo: Pick<NodeInfo, 'l1ChainId' | 'protocolVersion'>,
nodeInfo: Pick<NodeInfo, 'l1ChainId' | 'rollupVersion'>,
) {
this.entrypoint = new DefaultAccountEntrypoint(
address.address,
authWitnessProvider,
nodeInfo.l1ChainId,
nodeInfo.protocolVersion,
nodeInfo.rollupVersion,
);
this.chainId = new Fr(nodeInfo.l1ChainId);
this.version = new Fr(nodeInfo.protocolVersion);
this.version = new Fr(nodeInfo.rollupVersion);
}

createTxExecutionRequest(
Expand Down
31 changes: 15 additions & 16 deletions yarn-project/aztec-node/src/aztec-node/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
const l1ContractsAddresses = await RegistryContract.collectAddresses(
publicClient,
config.l1Contracts.registryAddress,
config.version ?? 'canonical',
config.rollupVersion ?? 'canonical',
);

// Overwrite the passed in vars.
Expand All @@ -197,13 +197,13 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
client: publicClient,
});

const versionFromRollup = Number(await rollup.read.getVersion());
const rollupVersionFromRollup = Number(await rollup.read.getVersion());

config.version ??= versionFromRollup;
config.rollupVersion ??= rollupVersionFromRollup;

if (config.version !== versionFromRollup) {
if (config.rollupVersion !== rollupVersionFromRollup) {
log.warn(
`Registry looked up and returned a rollup with version (${config.version}), but this does not match with version detected from the rollup directly: (${versionFromRollup}).`,
`Registry looked up and returned a rollup with version (${config.rollupVersion}), but this does not match with version detected from the rollup directly: (${rollupVersionFromRollup}).`,
);
}

Expand Down Expand Up @@ -276,7 +276,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
sequencer,
validatorsSentinel,
ethereumChain.chainInfo.id,
config.version,
config.rollupVersion,
new GlobalVariableBuilder(config),
proofVerifier,
telemetry,
Expand Down Expand Up @@ -325,20 +325,19 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
}

public async getNodeInfo(): Promise<NodeInfo> {
const [nodeVersion, protocolVersion, chainId, enr, contractAddresses, protocolContractAddresses] =
await Promise.all([
this.getNodeVersion(),
this.getVersion(),
this.getChainId(),
this.getEncodedEnr(),
this.getL1ContractAddresses(),
this.getProtocolContractAddresses(),
]);
const [nodeVersion, rollupVersion, chainId, enr, contractAddresses, protocolContractAddresses] = await Promise.all([
this.getNodeVersion(),
this.getVersion(),
this.getChainId(),
this.getEncodedEnr(),
this.getL1ContractAddresses(),
this.getProtocolContractAddresses(),
]);

const nodeInfo: NodeInfo = {
nodeVersion,
l1ChainId: chainId,
protocolVersion,
rollupVersion,
enr,
l1ContractAddresses: contractAddresses,
protocolContractAddresses: protocolContractAddresses,
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec.js/src/account_manager/account_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ export class AccountManager {
);
}

const { l1ChainId: chainId, protocolVersion } = await this.pxe.getNodeInfo();
const { l1ChainId: chainId, rollupVersion } = await this.pxe.getNodeInfo();
// We use a signerless wallet with the multi call entrypoint in order to make multiple calls in one go.
// If we used getWallet, the deployment would get routed via the account contract entrypoint
// and it can't be used unless the contract is initialized.
const wallet = new SignerlessWallet(this.pxe, new DefaultMultiCallEntrypoint(chainId, protocolVersion));
const wallet = new SignerlessWallet(this.pxe, new DefaultMultiCallEntrypoint(chainId, rollupVersion));

return new DeployMethod(
this.getPublicKeys(),
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/contract/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ describe('Contract Class', () => {
const mockNodeInfo: NodeInfo = {
nodeVersion: 'vx.x.x',
l1ChainId: 1,
protocolVersion: 2,
rollupVersion: 2,
l1ContractAddresses: l1Addresses,
enr: undefined,
protocolContractAddresses: {
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec.js/src/fee/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export async function simulateWithoutSignature(
const gasSettings = GasSettings.default({ maxFeesPerGas });
const fee = { gasSettings, paymentMethod };

const { l1ChainId: chainId, protocolVersion } = await wallet.getNodeInfo();
const entrypoint = new DefaultEntrypoint(chainId, protocolVersion);
const { l1ChainId: chainId, rollupVersion } = await wallet.getNodeInfo();
const entrypoint = new DefaultEntrypoint(chainId, rollupVersion);
const signerlessTxExecutionRequest = await entrypoint.createTxExecutionRequest(request, fee, {});

const simulationResult = await wallet.simulateTx(signerlessTxExecutionRequest, false, undefined, undefined, true);
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec.js/src/wallet/signerless_wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export class SignerlessWallet extends BaseWallet {
): Promise<TxExecutionRequest> {
let entrypoint = this.entrypoint;
if (!entrypoint) {
const { l1ChainId: chainId, protocolVersion } = await this.pxe.getNodeInfo();
entrypoint = new DefaultEntrypoint(chainId, protocolVersion);
const { l1ChainId: chainId, rollupVersion } = await this.pxe.getNodeInfo();
entrypoint = new DefaultEntrypoint(chainId, rollupVersion);
}

return entrypoint.createTxExecutionRequest(execution, fee, options);
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/cli/src/cmds/pxe/get_node_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function getNodeInfo(
logJson({
nodeVersion: info.nodeVersion,
l1ChainId: info.l1ChainId,
protocolVersion: info.protocolVersion,
rollupVersion: info.rollupVersion,
enr: info.enr,
l1ContractAddresses: {
rollup: info.l1ContractAddresses.rollupAddress.toString(),
Expand All @@ -47,7 +47,7 @@ export async function getNodeInfo(
} else {
log(`Node Version: ${info.nodeVersion}`);
log(`Chain Id: ${info.l1ChainId}`);
log(`Protocol Version: ${info.protocolVersion}`);
log(`Rollup Version: ${info.rollupVersion}`);
log(`Node ENR: ${info.enr}`);
log(`L1 Contract Addresses:`);
log(` Rollup Address: ${info.l1ContractAddresses.rollupAddress.toString()}`);
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/cli/src/utils/setup_contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ export async function setupSponsoredFPC(
const SponsoredFPCContract = await getSponsoredFPCContract();
const address = await getSponsoredFPCAddress();
const paymentMethod = new SponsoredFeePaymentMethod(address);
const { l1ChainId: chainId, protocolVersion } = await pxe.getNodeInfo();
const { l1ChainId: chainId, rollupVersion } = await pxe.getNodeInfo();

const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId, protocolVersion));
const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId, rollupVersion));

const deployTx = SponsoredFPCContract.deploy(deployer).send({
contractAddressSalt: new Fr(SPONSORED_FPC_SALT),
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/src/bench/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ export async function createNewPXE(
startingBlock: number = INITIAL_L2_BLOCK_NUM,
): Promise<PXEService> {
const l1Contracts = await node.getL1ContractAddresses();
const { l1ChainId, protocolVersion } = await node.getNodeInfo();
const { l1ChainId, rollupVersion } = await node.getNodeInfo();
const pxeConfig = {
l2StartingBlock: startingBlock,
l2BlockPollingIntervalMS: 100,
dataDirectory: undefined,
dataStoreMapSizeKB: 1024 * 1024,
l1Contracts,
l1ChainId,
version: protocolVersion,
rollupVersion,
} as PXEServiceConfig;
const pxe = await createPXEService(node, pxeConfig);
await pxe.registerContract(contract);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('e2e_sandbox_example', () => {
logger.info(format('Aztec Sandbox Info ', nodeInfo));
// docs:end:setup

expect(typeof nodeInfo.protocolVersion).toBe('number');
expect(typeof nodeInfo.rollupVersion).toBe('number');
expect(typeof nodeInfo.l1ChainId).toBe('number');
expect(typeof nodeInfo.l1ContractAddresses.rollupAddress).toBe('object');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ describe('L1Publisher integration', () => {

coinbase = config.coinbase || EthAddress.random();
feeRecipient = config.feeRecipient || (await AztecAddress.random());
version = config.version ?? 1;
version = config.rollupVersion ?? 1;

const fork = await worldStateSynchronizer.fork();

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_authwit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('e2e_authwit_tests', () => {

const nodeInfo = await wallets[0].getNodeInfo();
chainId = new Fr(nodeInfo.l1ChainId);
version = new Fr(nodeInfo.protocolVersion);
version = new Fr(nodeInfo.rollupVersion);

auth = await AuthWitTestContract.deploy(wallets[0]).send().deployed();
});
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/src/fixtures/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,8 @@ export async function getSponsoredFPCAddress() {
* Deploy a sponsored FPC contract to a running instance.
*/
export async function setupSponsoredFPC(pxe: PXE) {
const { l1ChainId: chainId, protocolVersion } = await pxe.getNodeInfo();
const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId, protocolVersion));
const { l1ChainId: chainId, rollupVersion } = await pxe.getNodeInfo();
const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId, rollupVersion));

// Make the contract pay for the deployment fee itself
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/entrypoints/src/default_entrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { ExecutionPayload } from './payload.js';
* Default implementation of the entrypoint interface. It calls a function on a contract directly
*/
export class DefaultEntrypoint implements EntrypointInterface {
constructor(private chainId: number, private protocolVersion: number) {}
constructor(private chainId: number, private rollupVersion: number) {}

async createTxExecutionRequest(
exec: ExecutionPayload,
Expand Down Expand Up @@ -39,7 +39,7 @@ export class DefaultEntrypoint implements EntrypointInterface {
call.to,
call.selector,
hashedArguments[0].hash,
new TxContext(this.chainId, this.protocolVersion, fee.gasSettings),
new TxContext(this.chainId, this.rollupVersion, fee.gasSettings),
[...hashedArguments, ...extraHashedArgs],
authWitnesses,
capsules,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/foundation/src/config/env_var.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export type EnvVar =
| 'VALIDATOR_DISABLED'
| 'VALIDATOR_PRIVATE_KEY'
| 'VALIDATOR_REEXECUTE'
| 'VERSION'
| 'ROLLUP_VERSION'
| 'WS_BLOCK_CHECK_INTERVAL_MS'
| 'WS_PROVEN_BLOCKS_ONLY'
| 'WS_BLOCK_REQUEST_BATCH_SIZE'
Expand Down
10 changes: 7 additions & 3 deletions yarn-project/node-lib/src/actions/snapshot-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import type { SharedNodeConfig } from '../config/index.js';
const MIN_L1_BLOCKS_TO_TRIGGER_REPLACE = 86400 / 2 / 12;

type SnapshotSyncConfig = Pick<SharedNodeConfig, 'syncMode' | 'snapshotsUrl'> &
Pick<ChainConfig, 'l1ChainId' | 'version'> &
Pick<ChainConfig, 'l1ChainId' | 'rollupVersion'> &
Pick<ArchiverConfig, 'archiverStoreMapSizeKb' | 'maxLogs'> &
Required<DataStoreConfig> &
EthereumClientConfig & {
Expand All @@ -44,7 +44,7 @@ export async function trySnapshotSync(config: SnapshotSyncConfig, log: Logger) {
let downloadDir: string | undefined;

try {
const { syncMode, snapshotsUrl, dataDirectory, l1ChainId, version: l2Version, l1Contracts } = config;
const { syncMode, snapshotsUrl, dataDirectory, l1ChainId, rollupVersion, l1Contracts } = config;
if (syncMode === 'full') {
log.debug('Snapshot sync is disabled. Running full sync.', { syncMode: syncMode });
return false;
Expand Down Expand Up @@ -96,7 +96,11 @@ export async function trySnapshotSync(config: SnapshotSyncConfig, log: Logger) {
return false;
}

const indexMetadata: SnapshotsIndexMetadata = { l1ChainId, l2Version, rollupAddress: l1Contracts.rollupAddress };
const indexMetadata: SnapshotsIndexMetadata = {
l1ChainId,
rollupVersion,
rollupAddress: l1Contracts.rollupAddress,
};
let snapshot: SnapshotMetadata | undefined;
try {
snapshot = await getLatestSnapshotMetadata(indexMetadata, fileStore);
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/node-lib/src/actions/upload-snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { mkdtemp } from 'fs/promises';
import { tmpdir } from 'os';
import { join } from 'path';

type UploadSnapshotConfig = Pick<ChainConfig, 'l1ChainId' | 'version'> & Pick<DataStoreConfig, 'dataDirectory'>;
type UploadSnapshotConfig = Pick<ChainConfig, 'l1ChainId' | 'rollupVersion'> & Pick<DataStoreConfig, 'dataDirectory'>;

/**
* Pauses the archiver and world state sync, creates backups of the archiver and world state lmdb environments,
Expand Down Expand Up @@ -64,7 +64,7 @@ async function buildSnapshotMetadata(

return {
l1ChainId: config.l1ChainId,
l2Version: config.version,
rollupVersion: config.rollupVersion,
rollupAddress,
l2BlockNumber,
l2BlockHash,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/p2p/src/testbench/worker_client_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const workerPath = path.join(__dirname, '../../dest/testbench/p2p_client_testben

const testChainConfig: ChainConfig = {
l1ChainId: 31337,
version: 1,
rollupVersion: 1,
l1Contracts: {
rollupAddress: EthAddress.random(),
},
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/p2p/src/versioning.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ describe('versioning', () => {
l1Contracts: {
rollupAddress: EthAddress.random(),
},
version: 3,
rollupVersion: 3,
};
});

it.each([true, false])('sets and compares versions with xxhash=%s', (useXxHash: boolean) => {
const versions = setAztecEnrKey(enr, chainConfig, useXxHash);
expect(versions.l1ChainId).toEqual(1);
expect(versions.l2ChainVersion).toEqual(3);
expect(versions.rollupVersion).toEqual(3);
expect(versions.l1RollupAddress).toEqual(chainConfig.l1Contracts.rollupAddress);
expect(versionSet).toHaveLength(useXxHash ? 8 : 33);

Expand Down
Loading