Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
sklppy88 committed Nov 13, 2024
1 parent 83f31ed commit 2e3256d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
9 changes: 4 additions & 5 deletions yarn-project/circuits.js/src/contract/artifact_hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,10 @@ export function computeFunctionArtifactHash(
| (Pick<FunctionArtifact, 'bytecode'> & { functionMetadataHash: Fr; selector: FunctionSelector }),
) {
const selector = 'selector' in fn ? fn.selector : FunctionSelector.fromNameAndParameters(fn);
// TODO(#5860): make bytecode part of artifact hash preimage again
// const bytecodeHash = sha256Fr(fn.bytecode).toBuffer();
// const metadataHash = 'functionMetadataHash' in fn ? fn.functionMetadataHash : computeFunctionMetadataHash(fn);
// return sha256Fr(Buffer.concat([numToUInt8(VERSION), selector.toBuffer(), metadataHash.toBuffer(), bytecodeHash]));
return sha256Fr(Buffer.concat([numToUInt8(VERSION), selector.toBuffer()]));

const bytecodeHash = sha256Fr(fn.bytecode).toBuffer();
const metadataHash = 'functionMetadataHash' in fn ? fn.functionMetadataHash : computeFunctionMetadataHash(fn);
return sha256Fr(Buffer.concat([numToUInt8(VERSION), selector.toBuffer(), metadataHash.toBuffer(), bytecodeHash]));
}

export function computeFunctionMetadataHash(fn: FunctionArtifact) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ describe('private_function_membership_proof', () => {
expect(isValidPrivateFunctionMembershipProof(fn, contractClass)).toBeTruthy();
});

// TODO(#5860): Re-enable this test once noir non-determinism is addressed
test.skip.each([
test.each([
'artifactTreeSiblingPath',
'artifactMetadataHash',
'functionMetadataHash',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ describe('unconstrained_function_membership_proof', () => {
expect(isValidUnconstrainedFunctionMembershipProof(fn, contractClass)).toBeTruthy();
});

// TODO(#5860): Re-enable this test once noir non-determinism is addressed
test.skip.each(['artifactTreeSiblingPath', 'artifactMetadataHash', 'functionMetadataHash'] as const)(
test.each(['artifactTreeSiblingPath', 'artifactMetadataHash', 'functionMetadataHash'] as const)(
'fails proof if %s is mangled',
field => {
const proof = createUnconstrainedFunctionMembershipProof(selector, artifact);
Expand Down

0 comments on commit 2e3256d

Please sign in to comment.