-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Remove unused isInternal flag in contract classes
- Loading branch information
1 parent
4733d25
commit 4aca2f5
Showing
13 changed files
with
28 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 0 additions & 44 deletions
44
yarn-project/circuits.js/src/contract/__snapshots__/contract_class.test.ts.snap
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 20 additions & 5 deletions
25
yarn-project/circuits.js/src/contract/contract_class.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,32 @@ | ||
import { FunctionSelector, FunctionType } from '@aztec/foundation/abi'; | ||
import { Fr } from '@aztec/foundation/fields'; | ||
import { toFriendlyJSON } from '@aztec/foundation/serialize'; | ||
import { setupCustomSnapshotSerializers } from '@aztec/foundation/testing'; | ||
|
||
import { getSampleContractArtifact } from '../tests/fixtures.js'; | ||
import { getContractClassFromArtifact } from './contract_class.js'; | ||
|
||
describe('ContractClass', () => { | ||
setupCustomSnapshotSerializers(expect); | ||
it('creates a contract class from a contract compilation artifact', () => { | ||
const artifact = getSampleContractArtifact(); | ||
const contractClass = getContractClassFromArtifact({ | ||
...getSampleContractArtifact(), | ||
...artifact, | ||
artifactHash: Fr.fromString('0x1234'), | ||
}); | ||
expect(toFriendlyJSON(contractClass)).toMatchSnapshot(); | ||
|
||
// Assert bytecode has a reasonable length | ||
expect(contractClass.packedBytecode.length).toBeGreaterThan(100); | ||
contractClass.publicFunctions.forEach(publicFunction => { | ||
expect(publicFunction.bytecode.length).toBeGreaterThan(100); | ||
}); | ||
|
||
// Check function selectors match | ||
const publicFunctionSelectors = artifact.functions | ||
.filter(fn => fn.functionType === FunctionType.OPEN) | ||
.map(fn => FunctionSelector.fromNameAndParameters(fn)); | ||
const privateFunctionSelectors = artifact.functions | ||
.filter(fn => fn.functionType === FunctionType.SECRET) | ||
.map(fn => FunctionSelector.fromNameAndParameters(fn)); | ||
|
||
expect(new Set(contractClass.publicFunctions.map(fn => fn.selector))).toEqual(new Set(publicFunctionSelectors)); | ||
expect(new Set(contractClass.privateFunctions.map(fn => fn.selector))).toEqual(new Set(privateFunctionSelectors)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...uits.js/src/contract/events/__snapshots__/private_function_broadcasted_event.test.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters