Skip to content

Commit 9440c1c

Browse files
authored
chore: dont import things that themselves import jest in imported functions (#10260)
1 parent 4ee8344 commit 9440c1c

File tree

1 file changed

+25
-3
lines changed
  • yarn-project/simulator/src/public/fixtures

1 file changed

+25
-3
lines changed

yarn-project/simulator/src/public/fixtures/index.ts

+25-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
type ContractClassPublic,
66
type ContractInstanceWithAddress,
77
DEFAULT_GAS_LIMIT,
8-
type FunctionSelector,
8+
FunctionSelector,
99
Gas,
1010
GasFees,
1111
GasSettings,
@@ -23,15 +23,16 @@ import {
2323
computePublicBytecodeCommitment,
2424
} from '@aztec/circuits.js';
2525
import { makeContractClassPublic, makeContractInstanceFromClassId } from '@aztec/circuits.js/testing';
26-
import { type ContractArtifact } from '@aztec/foundation/abi';
26+
import { type ContractArtifact, type FunctionArtifact } from '@aztec/foundation/abi';
2727
import { AztecAddress } from '@aztec/foundation/aztec-address';
2828
import { Fr, Point } from '@aztec/foundation/fields';
2929
import { openTmpStore } from '@aztec/kv-store/utils';
30+
import { AvmTestContractArtifact } from '@aztec/noir-contracts.js';
3031
import { PublicTxSimulator, WorldStateDB } from '@aztec/simulator';
3132
import { NoopTelemetryClient } from '@aztec/telemetry-client/noop';
3233
import { MerkleTrees } from '@aztec/world-state';
3334

34-
import { getAvmTestContractBytecode, getAvmTestContractFunctionSelector } from '../../avm/fixtures/index.js';
35+
import { strict as assert } from 'assert';
3536

3637
/**
3738
* If assertionErrString is set, we expect a (non exceptional halting) revert due to a failing assertion and
@@ -210,3 +211,24 @@ class MockedAvmTestContractDataSource {
210211
return Promise.resolve();
211212
}
212213
}
214+
215+
function getAvmTestContractFunctionSelector(functionName: string): FunctionSelector {
216+
const artifact = AvmTestContractArtifact.functions.find(f => f.name === functionName)!;
217+
assert(!!artifact, `Function ${functionName} not found in AvmTestContractArtifact`);
218+
const params = artifact.parameters;
219+
return FunctionSelector.fromNameAndParameters(artifact.name, params);
220+
}
221+
222+
function getAvmTestContractArtifact(functionName: string): FunctionArtifact {
223+
const artifact = AvmTestContractArtifact.functions.find(f => f.name === functionName)!;
224+
assert(
225+
!!artifact?.bytecode,
226+
`No bytecode found for function ${functionName}. Try re-running bootstrap.sh on the repository root.`,
227+
);
228+
return artifact;
229+
}
230+
231+
function getAvmTestContractBytecode(functionName: string): Buffer {
232+
const artifact = getAvmTestContractArtifact(functionName);
233+
return artifact.bytecode;
234+
}

0 commit comments

Comments
 (0)