Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { setupCustomSnapshotSerializers } from '@aztec/foundation/testing';

import omit from 'lodash.omit';
import { computeContractAddressFromInstance, getContractClassFromArtifact } from '@aztec/circuits.js';

import { ClassRegistererAddress, getCanonicalClassRegisterer } from './index.js';

describe('ClassRegisterer', () => {
setupCustomSnapshotSerializers(expect);
it('returns canonical protocol contract', () => {
const contract = getCanonicalClassRegisterer();
expect(omit(contract, 'artifact')).toMatchSnapshot();
expect(computeContractAddressFromInstance(contract.instance)).toEqual(contract.address);
expect(getContractClassFromArtifact(contract.artifact).id).toEqual(contract.contractClass.id);
expect(contract.address.toString()).toEqual(ClassRegistererAddress.toString());
});
});

This file was deleted.

19 changes: 3 additions & 16 deletions yarn-project/protocol-contracts/src/gas-token/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
import { EthAddress } from '@aztec/circuits.js';
import { setupCustomSnapshotSerializers } from '@aztec/foundation/testing';

import omit from 'lodash.omit';
import { EthAddress, computeContractAddressFromInstance, getContractClassFromArtifact } from '@aztec/circuits.js';

import { getCanonicalGasToken } from './index.js';

describe('GasToken', () => {
setupCustomSnapshotSerializers(expect);
it('returns canonical protocol contract', () => {
// if you're updating the snapshots here then you'll also have to update CANONICAL_GAS_TOKEN_ADDRESS in
// - noir-projects/noir-contracts/contracts/fpc_contract/src/main.nr
// - noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr
const contract = getCanonicalGasToken(EthAddress.ZERO);
expect(omit(contract, ['artifact', 'contractClass'])).toMatchSnapshot();

// bytecode is very large
expect(omit(contract.contractClass, ['packedBytecode', 'publicFunctions'])).toMatchSnapshot();

// this contract has public bytecode
expect(contract.contractClass.publicFunctions.map(x => omit(x, 'bytecode'))).toMatchSnapshot();
expect(contract.contractClass.packedBytecode.length).toBeGreaterThan(0);
expect(computeContractAddressFromInstance(contract.instance)).toEqual(contract.address);
expect(getContractClassFromArtifact(contract.artifact).id).toEqual(contract.contractClass.id);
});
});

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { computeContractAddressFromInstance, getContractClassFromArtifact } from '@aztec/circuits.js';
import { setupCustomSnapshotSerializers } from '@aztec/foundation/testing';

import omit from 'lodash.omit';

import { InstanceDeployerAddress, getCanonicalInstanceDeployer } from './index.js';

describe('InstanceDeployer', () => {
setupCustomSnapshotSerializers(expect);
it('returns canonical protocol contract', () => {
// TODO(@spalladino): Consider sorting functions by selector when constructing the contract
// class, or even better, when calling loadContractArtifact from the Noir output.
const contract = getCanonicalInstanceDeployer();
expect(omit(contract, 'artifact')).toMatchSnapshot();
expect(computeContractAddressFromInstance(contract.instance)).toEqual(contract.address);
expect(getContractClassFromArtifact(contract.artifact).id).toEqual(contract.contractClass.id);
expect(contract.address.toString()).toEqual(InstanceDeployerAddress.toString());
});
});