Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor e2e to not use @aztec/types #3175

Merged
merged 4 commits into from
Nov 2, 2023
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
30 changes: 28 additions & 2 deletions yarn-project/aztec.js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,39 @@ export * from './wallet/index.js';

// TODO https://github.com/AztecProtocol/aztec-packages/issues/2632 --> FunctionSelector might not need to be exposed
// here once the issue is resolved.
export { AztecAddress, EthAddress, Point, Fr, FunctionSelector, GrumpkinScalar } from '@aztec/circuits.js';
export {
AztecAddress,
CircuitsWasm,
EthAddress,
Point,
Fr,
FunctionSelector,
GlobalVariables,
GrumpkinScalar,
getContractDeploymentInfo,
} from '@aztec/circuits.js';
export { Grumpkin, Schnorr } from '@aztec/circuits.js/barretenberg';

export {
AuthWitness,
AztecNode,
ContractData,
DeployedContract,
ExtendedContractData,
ExtendedNote,
FunctionCall,
INITIAL_L2_BLOCK_NUM,
GrumpkinPrivateKey,
L2Actor,
L2Block,
L2BlockL2Logs,
LogFilter,
LogType,
MerkleTreeId,
NodeInfo,
Note,
PackedArguments,
PartialAddress,
PublicKey,
PXE,
SyncStatus,
Expand All @@ -33,13 +53,19 @@ export {
UnencryptedL2Log,
emptyFunctionCall,
createAztecNodeClient,
merkleTreeIds,
mockTx,
} from '@aztec/types';

export { ContractArtifact } from '@aztec/foundation/abi';
export { createDebugLogger, DebugLogger } from '@aztec/foundation/log';
export { DebugLogger, createDebugLogger, onLog } from '@aztec/foundation/log';
export { fileURLToPath } from '@aztec/foundation/url';
export { sleep } from '@aztec/foundation/sleep';
export { elapsed } from '@aztec/foundation/timer';
export { retry, retryUntil } from '@aztec/foundation/retry';
export * from '@aztec/foundation/crypto';
export { to2Fields, toBigInt } from '@aztec/foundation/serialize';
export { toBigIntBE } from '@aztec/foundation/bigint-buffer';

export {
deployL1Contract,
Expand Down
36 changes: 35 additions & 1 deletion yarn-project/end-to-end/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
module.exports = require('@aztec/foundation/eslint');
const baseConfig = require('@aztec/foundation/eslint');

const e2eConfig = {
overrides: [
{
files: ['*.ts'],
rules: {
'no-restricted-imports': [
'off',
{
name: '@aztec/types/stats',
},
],
},
},
{
files: ['*.ts'],
rules: {
'no-restricted-imports': [
'error',
{
name: '@aztec/types',
message:
'Please do not import from @aztec/types directly. Instead, export the required type from @aztec/aztec.js.',
},
],
},
},
],
};

module.exports = {
...baseConfig,
overrides: [...baseConfig.overrides, ...e2eConfig.overrides],
};
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
import { Fr, GrumpkinScalar } from '@aztec/circuits.js';
import { sleep } from '@aztec/foundation/sleep';
import { elapsed } from '@aztec/foundation/timer';
import { Fr, GrumpkinScalar, INITIAL_L2_BLOCK_NUM, elapsed, sleep } from '@aztec/aztec.js';
import { BenchmarkingContract } from '@aztec/noir-contracts/types';
import { SequencerClient } from '@aztec/sequencer-client';
import { INITIAL_L2_BLOCK_NUM } from '@aztec/types';
import {
BENCHMARK_HISTORY_BLOCK_SIZE,
BENCHMARK_HISTORY_CHAIN_LENGTHS,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AztecNodeService } from '@aztec/aztec-node';
import { Fr, GrumpkinScalar } from '@aztec/circuits.js';
import { Fr, GrumpkinScalar } from '@aztec/aztec.js';
import { BenchmarkingContract } from '@aztec/noir-contracts/types';
import { SequencerClient } from '@aztec/sequencer-client';
import { BENCHMARK_BLOCK_SIZES } from '@aztec/types/stats';
Expand Down
16 changes: 11 additions & 5 deletions yarn-project/end-to-end/src/benchmarks/utils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
import { BatchCall, SentTx } from '@aztec/aztec.js';
import { GrumpkinScalar } from '@aztec/circuits.js';
import { retryUntil } from '@aztec/foundation/retry';
import { sleep } from '@aztec/foundation/sleep';
import {
AztecNode,
BatchCall,
GrumpkinScalar,
INITIAL_L2_BLOCK_NUM,
PXE,
PartialAddress,
SentTx,
retryUntil,
sleep,
} from '@aztec/aztec.js';
import { BenchmarkingContract } from '@aztec/noir-contracts/types';
import { PXEService, createPXEService } from '@aztec/pxe';
import { AztecNode, INITIAL_L2_BLOCK_NUM, PXE, PartialAddress } from '@aztec/types';

import { mkdirpSync } from 'fs-extra';
import { globSync } from 'glob';
Expand Down
3 changes: 1 addition & 2 deletions yarn-project/end-to-end/src/cli_docs_sandbox.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { AztecAddress, createDebugLogger, sleep } from '@aztec/aztec.js';
import { AztecAddress, TxHash, createDebugLogger, sleep } from '@aztec/aztec.js';
import { getProgram } from '@aztec/cli';
import { TxHash } from '@aztec/types';

import stringArgv from 'string-argv';

Expand Down
22 changes: 16 additions & 6 deletions yarn-project/end-to-end/src/e2e_2_pxes.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import { AztecAddress, Note, Wallet, computeMessageSecretHash } from '@aztec/aztec.js';
import { DebugLogger } from '@aztec/foundation/log';
import { retryUntil } from '@aztec/foundation/retry';
import {
AztecAddress,
AztecNode,
CompleteAddress,
DebugLogger,
EthAddress,
ExtendedNote,
Fr,
Note,
PXE,
TxStatus,
Wallet,
computeMessageSecretHash,
retryUntil,
} from '@aztec/aztec.js';
import { ChildContract, TokenContract } from '@aztec/noir-contracts/types';
import { EthAddress, Fr, PXEService } from '@aztec/pxe';
import { AztecNode, CompleteAddress, ExtendedNote, PXE, TxStatus } from '@aztec/types';

import { jest } from '@jest/globals';

Expand Down Expand Up @@ -46,7 +56,7 @@ describe('e2e_2_pxes', () => {

afterEach(async () => {
await teardownA();
if (pxeB instanceof PXEService) await pxeB.stop();
if ((pxeB as any).stop) await (pxeB as any).stop();
});

const awaitUserSynchronized = async (wallet: Wallet, owner: AztecAddress) => {
Expand Down
4 changes: 3 additions & 1 deletion yarn-project/end-to-end/src/e2e_account_contracts.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import {
AccountContract,
AccountManager,
CompleteAddress,
EcdsaAccountContract,
Fr,
GrumpkinPrivateKey,
GrumpkinScalar,
PXE,
SchnorrAccountContract,
SingleKeyAccountContract,
Wallet,
} from '@aztec/aztec.js';
import { CompleteAddress, GrumpkinPrivateKey, GrumpkinScalar } from '@aztec/circuits.js';
import { ChildContract } from '@aztec/noir-contracts/types';

import { randomBytes } from 'crypto';
Expand Down
7 changes: 4 additions & 3 deletions yarn-project/end-to-end/src/e2e_block_building.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import {
BatchCall,
CircuitsWasm,
ContractDeployer,
ContractFunctionInteraction,
DebugLogger,
Fr,
PXE,
TxStatus,
Wallet,
isContractDeployed,
} from '@aztec/aztec.js';
import { CircuitsWasm } from '@aztec/circuits.js';
import { pedersenHashInputs } from '@aztec/circuits.js/barretenberg';
import { DebugLogger } from '@aztec/foundation/log';
import { TestContractArtifact } from '@aztec/noir-contracts/artifacts';
import { TestContract, TokenContract } from '@aztec/noir-contracts/types';
import { PXE, TxStatus } from '@aztec/types';

import times from 'lodash.times';

Expand Down
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/src/e2e_card_game.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
AccountWallet,
AztecAddress,
DebugLogger,
PXE,
Wallet,
deployInitialSandboxAccounts,
getSandboxAccountsWallets,
} from '@aztec/aztec.js';
import { DebugLogger } from '@aztec/foundation/log';
import { CardGameContract } from '@aztec/noir-contracts/types';
import { PXE } from '@aztec/types';

import { setup } from './fixtures/utils.js';

Expand Down
4 changes: 1 addition & 3 deletions yarn-project/end-to-end/src/e2e_cheat_codes.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { CheatCodes, Wallet } from '@aztec/aztec.js';
import { CheatCodes, EthAddress, TxStatus, Wallet } from '@aztec/aztec.js';
import { RollupAbi } from '@aztec/l1-artifacts';
import { TestContract } from '@aztec/noir-contracts/types';
import { EthAddress } from '@aztec/pxe';
import { TxStatus } from '@aztec/types';

import { Account, Chain, HttpTransport, PublicClient, WalletClient, getAddress, getContract, parseEther } from 'viem';

Expand Down
18 changes: 14 additions & 4 deletions yarn-project/end-to-end/src/e2e_deploy_contract.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import { AztecAddress, Contract, ContractDeployer, EthAddress, Fr, Wallet, isContractDeployed } from '@aztec/aztec.js';
import { CompleteAddress, getContractDeploymentInfo } from '@aztec/circuits.js';
import { DebugLogger } from '@aztec/foundation/log';
import {
AztecAddress,
CompleteAddress,
Contract,
ContractDeployer,
DebugLogger,
EthAddress,
Fr,
PXE,
TxStatus,
Wallet,
getContractDeploymentInfo,
isContractDeployed,
} from '@aztec/aztec.js';
import { TestContractArtifact, TokenContractArtifact } from '@aztec/noir-contracts/artifacts';
import { SequencerClient } from '@aztec/sequencer-client';
import { PXE, TxStatus } from '@aztec/types';

import { setup } from './fixtures/utils.js';

Expand Down
13 changes: 10 additions & 3 deletions yarn-project/end-to-end/src/e2e_escrow_contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ import {
AccountWallet,
AztecAddress,
BatchCall,
CompleteAddress,
DebugLogger,
ExtendedNote,
Fr,
GrumpkinPrivateKey,
GrumpkinScalar,
Note,
PXE,
PublicKey,
TxStatus,
computeMessageSecretHash,
generatePublicKey,
getContractDeploymentInfo,
} from '@aztec/aztec.js';
import { CompleteAddress, Fr, GrumpkinPrivateKey, GrumpkinScalar, getContractDeploymentInfo } from '@aztec/circuits.js';
import { DebugLogger } from '@aztec/foundation/log';
import { EscrowContractArtifact } from '@aztec/noir-contracts/artifacts';
import { EscrowContract, TokenContract } from '@aztec/noir-contracts/types';
import { ExtendedNote, PXE, PublicKey, TxStatus } from '@aztec/types';

import { setup } from './fixtures/utils.js';

Expand Down
8 changes: 5 additions & 3 deletions yarn-project/end-to-end/src/e2e_lending_contract.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import {
AccountWallet,
CheatCodes,
CompleteAddress,
DebugLogger,
ExtendedNote,
Fr,
Note,
SentTx,
TxStatus,
computeAuthWitMessageHash,
computeMessageSecretHash,
} from '@aztec/aztec.js';
import { CompleteAddress } from '@aztec/circuits.js';
import { DebugLogger } from '@aztec/foundation/log';
import { LendingContract, PriceFeedContract, TokenContract } from '@aztec/noir-contracts/types';
import { ExtendedNote, Note, TxStatus } from '@aztec/types';

import { jest } from '@jest/globals';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import {
AztecAddress,
AztecNode,
CompleteAddress,
DebugLogger,
ExtendedNote,
Fr,
GrumpkinScalar,
Note,
PXE,
TxStatus,
Wallet,
computeMessageSecretHash,
generatePublicKey,
getSandboxAccountsWallets,
getSchnorrAccount,
} from '@aztec/aztec.js';
import { Fr, GrumpkinScalar } from '@aztec/foundation/fields';
import { DebugLogger } from '@aztec/foundation/log';
import { TokenContract } from '@aztec/noir-contracts/types';
import { AztecNode, CompleteAddress, ExtendedNote, PXE, TxStatus } from '@aztec/types';

import { expectsNumOfEncryptedLogsInTheLastBlockToBe, setup } from './fixtures/utils.js';

Expand Down
5 changes: 1 addition & 4 deletions yarn-project/end-to-end/src/e2e_nested_contract.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { AztecAddress, BatchCall, Fr, Wallet } from '@aztec/aztec.js';
import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
import { DebugLogger } from '@aztec/foundation/log';
import { AztecAddress, BatchCall, DebugLogger, Fr, PXE, Wallet, toBigIntBE } from '@aztec/aztec.js';
import { ChildContract, ImportTestContract, ParentContract, TestContract } from '@aztec/noir-contracts/types';
import { PXE } from '@aztec/types';

import { setup } from './fixtures/utils.js';

Expand Down
18 changes: 13 additions & 5 deletions yarn-project/end-to-end/src/e2e_non_contract_account.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import { SignerlessWallet, Wallet } from '@aztec/aztec.js';
import { CircuitsWasm, Fr } from '@aztec/circuits.js';
import {
AztecNode,
CircuitsWasm,
DebugLogger,
ExtendedNote,
Fr,
Note,
PXE,
SignerlessWallet,
TxStatus,
Wallet,
toBigInt,
} from '@aztec/aztec.js';
import { siloNullifier } from '@aztec/circuits.js/abis';
import { DebugLogger } from '@aztec/foundation/log';
import { toBigInt } from '@aztec/foundation/serialize';
import { TestContract } from '@aztec/noir-contracts/types';
import { AztecNode, ExtendedNote, Note, PXE, TxStatus } from '@aztec/types';

import { setup } from './fixtures/utils.js';

Expand Down
6 changes: 1 addition & 5 deletions yarn-project/end-to-end/src/e2e_ordering.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// Test suite for testing proper ordering of side effects
import { Wallet } from '@aztec/aztec.js';
import { FunctionSelector } from '@aztec/circuits.js';
import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
import { Fr } from '@aztec/foundation/fields';
import { Fr, FunctionSelector, PXE, TxStatus, Wallet, toBigIntBE } from '@aztec/aztec.js';
import { ChildContract, ParentContract } from '@aztec/noir-contracts/types';
import { PXE, TxStatus } from '@aztec/types';

import { jest } from '@jest/globals';

Expand Down
Loading