Skip to content

Commit

Permalink
chore: more bad selectors in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Aug 1, 2023
1 parent 1d717a2 commit 6fe0935
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions yarn-project/acir-simulator/src/public/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import {
PrivateHistoricTreeRoots,
} from '@aztec/circuits.js';
import { pedersenPlookupCommitInputs } from '@aztec/circuits.js/barretenberg';
import { FunctionAbi, encodeArguments } from '@aztec/foundation/abi';
import { FunctionAbi, encodeArguments, generateFunctionSelector } from '@aztec/foundation/abi';
import { AztecAddress } from '@aztec/foundation/aztec-address';
import { keccak } from '@aztec/foundation/crypto';
import { EthAddress } from '@aztec/foundation/eth-address';
import { Fr } from '@aztec/foundation/fields';
import { toBigInt } from '@aztec/foundation/serialize';
Expand Down Expand Up @@ -63,7 +62,7 @@ describe('ACIR public execution simulator', () => {
it('should run the mint function', async () => {
const contractAddress = AztecAddress.random();
const mintAbi = PublicTokenContractAbi.functions.find(f => f.name === 'mint')!;
const functionData = new FunctionData(Buffer.alloc(4), false, false, false);
const functionData = FunctionData.fromAbi(mintAbi);
const args = encodeArguments(mintAbi, [140, recipient]);

const callContext = CallContext.from({
Expand Down Expand Up @@ -190,11 +189,14 @@ describe('ACIR public execution simulator', () => {
it('calls the public entry point in the parent', async () => {
const parentContractAddress = AztecAddress.random();
const parentEntryPointFn = ParentContractAbi.functions.find(f => f.name === 'pubEntryPoint')!;
const parentEntryPointFnSelector = keccak(Buffer.from(parentEntryPointFn.name)).subarray(0, 4);
const parentEntryPointFnSelector = generateFunctionSelector(
parentEntryPointFn.name,
parentEntryPointFn.parameters,
);

const childContractAddress = AztecAddress.random();
const childValueFn = ChildContractAbi.functions.find(f => f.name === 'pubValue')!;
const childValueFnSelector = keccak(Buffer.from(childValueFn.name)).subarray(0, 4);
const childValueFnSelector = generateFunctionSelector(childValueFn.name, childValueFn.parameters);

const initialValue = 3n;

Expand Down

0 comments on commit 6fe0935

Please sign in to comment.