Skip to content

Commit

Permalink
test ordering as it follows in circuit
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Jan 26, 2024
1 parent 4577016 commit c71b158
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions yarn-project/noir-protocol-circuits/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { executeInit, executeInner, executeOrdering } from './index.js';

describe('Private kernel', () => {
let logger: DebugLogger;

beforeAll(() => {
logger = createDebugLogger('noir-private-kernel');
});
Expand All @@ -50,36 +51,36 @@ describe('Private kernel', () => {
expect(kernelOutputs).toMatchSnapshot();
});

// Taken from e2e_nested_contract => performs nested calls => first ordering
// Taken from e2e_nested_contract => performs nested calls => last inner
// To regenerate fixture data run the following on the yarn-project/e2e folder
// AZTEC_GENERATE_TEST_DATA=1 yarn test e2e_nested_contract -t 'performs nested calls'
it('Executes private kernel ordering after a deployment', async () => {
it('Executes private kernel inner for a nested call', async () => {
logger('Initialized Noir instance with private kernel init circuit');

const filepath = resolve(
dirname(fileURLToPath(import.meta.url)),
'./fixtures/nested-call-private-kernel-ordering.hex',
'./fixtures/nested-call-private-kernel-inner.hex',
);
const serialized = Buffer.from(readFileSync(filepath).toString(), 'hex');
const kernelInputs = PrivateKernelInputsOrdering.fromBuffer(serialized);
const kernelInputs = PrivateKernelInputsInner.fromBuffer(serialized);

const kernelOutputs = await executeOrdering(kernelInputs);
const kernelOutputs = await executeInner(kernelInputs);

expect(kernelOutputs).toMatchSnapshot();
});

// Taken from e2e_nested_contract => performs nested calls => last inner
// Taken from e2e_nested_contract => performs nested calls => first ordering
// To regenerate fixture data run the following on the yarn-project/e2e folder
// AZTEC_GENERATE_TEST_DATA=1 yarn test e2e_nested_contract -t 'performs nested calls'
it('Executes private kernel inner for a nested call', async () => {
logger('Initialized Noir instance with private kernel init circuit');

it('Executes private kernel ordering after a deployment', async () => {
const filepath = resolve(
dirname(fileURLToPath(import.meta.url)),
'./fixtures/nested-call-private-kernel-inner.hex',
'./fixtures/nested-call-private-kernel-ordering.hex',
);
const serialized = Buffer.from(readFileSync(filepath).toString(), 'hex');
const kernelInputs = PrivateKernelInputsInner.fromBuffer(serialized);
const kernelInputs = PrivateKernelInputsOrdering.fromBuffer(serialized);

const kernelOutputs = await executeInner(kernelInputs);
const kernelOutputs = await executeOrdering(kernelInputs);

expect(kernelOutputs).toMatchSnapshot();
});
Expand Down

0 comments on commit c71b158

Please sign in to comment.