Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: check artifact consistency #10271

Merged
merged 2 commits into from
Nov 28, 2024
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
19 changes: 1 addition & 18 deletions yarn-project/circuits.js/src/contract/artifact_hash.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { type ContractArtifact } from '@aztec/foundation/abi';
import { loadContractArtifact } from '@aztec/types/abi';
import type { NoirCompiledContract } from '@aztec/types/noir';

import { readFileSync } from 'fs';

import { getPathToFixture, getTestContractArtifact } from '../tests/fixtures.js';
import { getTestContractArtifact } from '../tests/fixtures.js';
import { computeArtifactHash } from './artifact_hash.js';

const TEST_CONTRACT_ARTIFACT_HASH = `"0x19142676527045a118066698e292cc35db16ab4d7bd16610d35d2e1c607eb8b2"`;

describe('ArtifactHash', () => {
it('calculates the artifact hash', () => {
const emptyArtifact: ContractArtifact = {
Expand All @@ -31,19 +25,8 @@ describe('ArtifactHash', () => {
const testArtifact = getTestContractArtifact();

const calculatedArtifactHash = computeArtifactHash(testArtifact).toString();
expect(calculatedArtifactHash).toMatchInlineSnapshot(TEST_CONTRACT_ARTIFACT_HASH);
for (let i = 0; i < 1000; i++) {
expect(computeArtifactHash(testArtifact).toString()).toBe(calculatedArtifactHash);
}
});

it('calculates the test contract artifact hash', () => {
const path = getPathToFixture('Test.test.json');
const content = JSON.parse(readFileSync(path).toString()) as NoirCompiledContract;
content.outputs.structs.functions.reverse();

const testArtifact = loadContractArtifact(content);

expect(computeArtifactHash(testArtifact).toString()).toMatchInlineSnapshot(TEST_CONTRACT_ARTIFACT_HASH);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ describe('L1Publisher integration', () => {
prevHeader = fork.getInitialHeader();
await fork.close();

baseFee = new GasFees(0, await rollup.read.getManaBaseFee([true]));
const ts = (await publicClient.getBlock()).timestamp;
baseFee = new GasFees(0, await rollup.read.getManaBaseFeeAt([ts, true]));

// We jump to the next epoch such that the committee can be setup.
const timeToJump = await rollup.read.EPOCH_DURATION();
Expand Down
Loading