Skip to content

Commit 7f49ac8

Browse files
author
AztecBot
committed
Merge branch 'next' into merge-train/barretenberg
2 parents 7e96db3 + b9a62d5 commit 7f49ac8

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

yarn-project/ethereum/src/deploy_l1_contracts.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ import { retryUntil } from '@aztec/foundation/retry';
88
import { type PrivateKeyAccount, privateKeyToAccount } from 'viem/accounts';
99

1010
import { createEthereumChain } from './chain.js';
11+
import { createExtendedL1Client } from './client.js';
1112
import { DefaultL1ContractsConfig } from './config.js';
1213
import { RollupContract } from './contracts/rollup.js';
1314
import { type DeployL1ContractsArgs, type Operator, deployL1Contracts } from './deploy_l1_contracts.js';
1415
import { startAnvil } from './test/start_anvil.js';
16+
import type { ExtendedViemWalletClient } from './types.js';
1517

1618
describe('deploy_l1_contracts', () => {
1719
let privateKey: PrivateKeyAccount;
@@ -28,6 +30,7 @@ describe('deploy_l1_contracts', () => {
2830
const chainId = process.env.L1_CHAIN_ID ? parseInt(process.env.L1_CHAIN_ID, 10) : 31337;
2931
let rpcUrl = process.env.L1_RPC_URL;
3032
let stop: () => Promise<void> = () => Promise.resolve();
33+
let client: ExtendedViemWalletClient;
3134

3235
beforeAll(async () => {
3336
logger = createLogger('ethereum:test:deploy_l1_contracts');
@@ -45,6 +48,8 @@ describe('deploy_l1_contracts', () => {
4548
if (!rpcUrl) {
4649
({ stop, rpcUrl } = await startAnvil());
4750
}
51+
52+
client = createExtendedL1Client([rpcUrl], privateKey, createEthereumChain([rpcUrl], chainId).chainInfo);
4853
});
4954

5055
afterAll(async () => {
@@ -127,4 +132,20 @@ describe('deploy_l1_contracts', () => {
127132
);
128133
}
129134
});
135+
136+
it('deploys and adds 48 initialValidators', async () => {
137+
const initialValidators = times(48, () => {
138+
const addr = EthAddress.random();
139+
const bn254SecretKey = new SecretValue(Fr.random().toBigInt());
140+
return { attester: addr, withdrawer: addr, bn254SecretKey };
141+
});
142+
143+
const deployment = await deploy({ initialValidators, aztecTargetCommitteeSize: initialValidators.length });
144+
const rollup = new RollupContract(client, deployment.l1ContractAddresses.rollupAddress);
145+
146+
expect(await rollup.getActiveAttesterCount()).toEqual(BigInt(initialValidators.length));
147+
expect((await rollup.getAttesters()).map(a => a.toLowerCase()).sort()).toEqual(
148+
initialValidators.map(({ attester }) => attester.toString().toLowerCase()).sort(),
149+
);
150+
});
130151
});

yarn-project/ethereum/src/deploy_l1_contracts.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -810,14 +810,19 @@ export const addMultipleValidators = async (
810810

811811
logger.info(`Adding ${validators.length} validators to the rollup`);
812812

813-
await deployer.l1TxUtils.sendAndMonitorTransaction({
814-
to: multiAdder.toString(),
815-
data: encodeFunctionData({
816-
abi: MultiAdderArtifact.contractAbi,
817-
functionName: 'addValidators',
818-
args: [validatorsTuples],
819-
}),
820-
});
813+
await deployer.l1TxUtils.sendAndMonitorTransaction(
814+
{
815+
to: multiAdder.toString(),
816+
data: encodeFunctionData({
817+
abi: MultiAdderArtifact.contractAbi,
818+
functionName: 'addValidators',
819+
args: [validatorsTuples],
820+
}),
821+
},
822+
{
823+
gasLimit: 45_000_000n,
824+
},
825+
);
821826

822827
const validatorCountAfter = await rollup.getActiveAttesterCount();
823828
if (validatorCountAfter < validatorCount + BigInt(validators.length)) {

yarn-project/ethereum/src/test/start_anvil.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export async function startAnvil(
3434
blockTime: opts.l1BlockTime,
3535
stopTimeout: 1000,
3636
accounts: opts.accounts ?? 20,
37+
gasLimit: 45_000_000n,
3738
});
3839

3940
// Listen to the anvil output to get the port.

0 commit comments

Comments
 (0)