Skip to content

Commit

Permalink
feat: enable UltraHonk verifier
Browse files Browse the repository at this point in the history
Fix #7373
  • Loading branch information
alexghr committed Aug 12, 2024
1 parent 0cb7dcf commit 4a51862
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 56 deletions.
2 changes: 1 addition & 1 deletion yarn-project/bb-prover/src/bb/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ export async function generateContractForVerificationKey(
try {
const args = ['-k', vkFilePath, '-o', contractPath, '-v'];
const timer = new Timer();
const result = await executeBB(pathToBB, 'contract', args, log);
const result = await executeBB(pathToBB, 'contract_ultra_honk', args, log);
const duration = timer.ms();
if (result.status == BB_RESULT.SUCCESS) {
return { status: BB_RESULT.SUCCESS, durationMs: duration, contractPath };
Expand Down
109 changes: 54 additions & 55 deletions yarn-project/end-to-end/src/e2e_prover/e2e_prover_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ import {
type PXE,
type TxHash,
computeSecretHash,
createDebugLogger, // TODO(#7373): Deploy honk solidity verifier
// deployL1Contract,
createDebugLogger,
deployL1Contract,
} from '@aztec/aztec.js';
import { BBCircuitVerifier } from '@aztec/bb-prover';
// import { RollupAbi } from '@aztec/l1-artifacts';
import { RollupAbi } from '@aztec/l1-artifacts';
import { TokenContract } from '@aztec/noir-contracts.js';
import { type PXEService } from '@aztec/pxe';

// TODO(#7373): Deploy honk solidity verifier
// // @ts-expect-error solc-js doesn't publish its types https://github.com/ethereum/solc-js/issues/689
// import solc from 'solc';
// import { getContract } from 'viem';
// @ts-expect-error solc-js doesn't publish its types https://github.com/ethereum/solc-js/issues/689
import solc from 'solc';
import { getContract } from 'viem';

import { waitRegisteredAccountSynced } from '../benchmarks/utils.js';
import { getACVMConfig } from '../fixtures/get_acvm_config.js';
import { getBBConfig } from '../fixtures/get_bb_config.js';
Expand Down Expand Up @@ -287,58 +288,56 @@ export class FullProverTest {
);
}

deployVerifier() {
async deployVerifier() {
if (!this.circuitProofVerifier) {
throw new Error('No verifier');
}

// TODO(#7373): Deploy honk solidity verifier
return Promise.resolve();
// const { walletClient, publicClient, l1ContractAddresses } = this.context.deployL1ContractsValues;

// const contract = await this.circuitProofVerifier.generateSolidityContract(
// 'RootRollupArtifact',
// 'UltraVerifier.sol',
// );

// const input = {
// language: 'Solidity',
// sources: {
// 'UltraVerifier.sol': {
// content: contract,
// },
// },
// settings: {
// // we require the optimizer
// optimizer: {
// enabled: true,
// runs: 200,
// },
// evmVersion: 'paris',
// outputSelection: {
// '*': {
// '*': ['evm.bytecode.object', 'abi'],
// },
// },
// },
// };

// const output = JSON.parse(solc.compile(JSON.stringify(input)));

// const abi = output.contracts['UltraVerifier.sol']['UltraVerifier'].abi;
// const bytecode: string = output.contracts['UltraVerifier.sol']['UltraVerifier'].evm.bytecode.object;

// const verifierAddress = await deployL1Contract(walletClient, publicClient, abi, `0x${bytecode}`);

// this.logger.info(`Deployed Real verifier at ${verifierAddress}`);

// const rollup = getContract({
// abi: RollupAbi,
// address: l1ContractAddresses.rollupAddress.toString(),
// client: walletClient,
// });

// await rollup.write.setVerifier([verifierAddress.toString()]);
// this.logger.info('Rollup only accepts valid proofs now');
const { walletClient, publicClient, l1ContractAddresses } = this.context.deployL1ContractsValues;

const contract = await this.circuitProofVerifier.generateSolidityContract(
'RootRollupArtifact',
'UltraHonkVerifier.sol',
);

const input = {
language: 'Solidity',
sources: {
'UltraHonkVerifier.sol': {
content: contract,
},
},
settings: {
// we require the optimizer
optimizer: {
enabled: true,
runs: 200,
},
evmVersion: 'paris',
outputSelection: {
'*': {
'*': ['evm.bytecode.object', 'abi'],
},
},
},
};

const output = JSON.parse(solc.compile(JSON.stringify(input)));

const abi = output.contracts['UltraVerifier.sol']['UltraVerifier'].abi;
const bytecode: string = output.contracts['UltraVerifier.sol']['UltraVerifier'].evm.bytecode.object;

const verifierAddress = await deployL1Contract(walletClient, publicClient, abi, `0x${bytecode}`);

this.logger.info(`Deployed Real verifier at ${verifierAddress}`);

const rollup = getContract({
abi: RollupAbi,
address: l1ContractAddresses.rollupAddress.toString(),
client: walletClient,
});

await rollup.write.setVerifier([verifierAddress.toString()]);
this.logger.info('Rollup only accepts valid proofs now');
}
}

0 comments on commit 4a51862

Please sign in to comment.