diff --git a/yarn-project/acir-simulator/package.json b/yarn-project/acir-simulator/package.json index dab0530657fe..070ee6ba9521 100644 --- a/yarn-project/acir-simulator/package.json +++ b/yarn-project/acir-simulator/package.json @@ -36,7 +36,8 @@ "@noir-lang/acvm_js": "0.26.1", "levelup": "^5.1.1", "memdown": "^6.1.1", - "tslib": "^2.4.0" + "tslib": "^2.4.0", + "viem": "^1.2.5" }, "devDependencies": { "@aztec/merkle-tree": "workspace:^", diff --git a/yarn-project/acir-simulator/src/client/private_execution.test.ts b/yarn-project/acir-simulator/src/client/private_execution.test.ts index 5190c0ad9c1a..39268939906e 100644 --- a/yarn-project/acir-simulator/src/client/private_execution.test.ts +++ b/yarn-project/acir-simulator/src/client/private_execution.test.ts @@ -48,6 +48,7 @@ import { jest } from '@jest/globals'; import { MockProxy, mock } from 'jest-mock-extended'; import { default as levelup } from 'levelup'; import { type MemDown, default as memdown } from 'memdown'; +import { getFunctionSelector } from 'viem'; import { buildL1ToL2Message, getFunctionArtifact } from '../test/utils.js'; import { computeSlotForMapping } from '../utils.js'; @@ -654,9 +655,8 @@ describe('Private Execution test suite', () => { const secretForL1ToL2MessageConsumption = new Fr(1n); const secretHashForRedeemingNotes = new Fr(2n); const canceller = EthAddress.random(); - // Function selector: 0x25d46b0f keccak256('mint_private(uint256,bytes32,address)') const preimage = await buildL1ToL2Message( - '25d46b0f', + getFunctionSelector('mint_private(uint256,bytes32,address)').substring(2), [new Fr(bridgedAmount), secretHashForRedeemingNotes, canceller.toField()], contractAddress, secretForL1ToL2MessageConsumption, diff --git a/yarn-project/acir-simulator/src/public/index.test.ts b/yarn-project/acir-simulator/src/public/index.test.ts index f6480fe6f5d7..539b10c20f1d 100644 --- a/yarn-project/acir-simulator/src/public/index.test.ts +++ b/yarn-project/acir-simulator/src/public/index.test.ts @@ -23,6 +23,7 @@ import { import { MockProxy, mock } from 'jest-mock-extended'; import { type MemDown, default as memdown } from 'memdown'; +import { getFunctionSelector } from 'viem'; import { buildL1ToL2Message } from '../test/utils.js'; import { computeSlotForMapping } from '../utils.js'; @@ -358,9 +359,8 @@ describe('ACIR public execution simulator', () => { const secret = new Fr(1n); const recipient = AztecAddress.random(); - // Function selector: 0x63c9440d keccak256('mint_public(uint256,bytes32,address)') const preimage = await buildL1ToL2Message( - '63c9440d', + getFunctionSelector('mint_public(uint256,bytes32,address)').substring(2), [new Fr(bridgedAmount), recipient.toField(), canceller.toField()], contractAddress, secret, diff --git a/yarn-project/yarn.lock b/yarn-project/yarn.lock index 605dcd7c10a0..0415549e0855 100644 --- a/yarn-project/yarn.lock +++ b/yarn-project/yarn.lock @@ -82,6 +82,7 @@ __metadata: ts-node: ^10.9.1 tslib: ^2.4.0 typescript: ^5.0.4 + viem: ^1.2.5 languageName: unknown linkType: soft