Skip to content

Commit

Permalink
chore: @aztec/stdlib pt.2 -> remove @aztec/types (#12133)
Browse files Browse the repository at this point in the history
With granular exports and circular dependencies removed it's not longer
necessary!

Remaining types were moved to `circuits.js` (soon to be stdlib), but the
hasher will probably get pruned since it's only used by the old merkle
tree implementation

---------

Co-authored-by: thunkar <gregjquiros@gmail.com>
  • Loading branch information
Thunkar and thunkar authored Feb 20, 2025
1 parent 36ebe30 commit 3257a97
Show file tree
Hide file tree
Showing 80 changed files with 45 additions and 303 deletions.
3 changes: 1 addition & 2 deletions boxes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
"@aztec/pxe": "link:../yarn-project/pxe",
"@aztec/simulator": "link:../yarn-project/simulator",
"@aztec/ethereum": "link:../yarn-project/ethereum",
"@aztec/protocol-contracts": "link:../yarn-project/protocol-contracts",
"@aztec/types": "link:../yarn-project/types"
"@aztec/protocol-contracts": "link:../yarn-project/protocol-contracts"
},
"dependencies": {
"@iarna/toml": "^2.2.5",
Expand Down
1 change: 0 additions & 1 deletion yarn-project/accounts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"@aztec/entrypoints": "workspace:^",
"@aztec/ethereum": "workspace:^",
"@aztec/foundation": "workspace:^",
"@aztec/types": "workspace:^",
"tslib": "^2.4.0"
},
"devDependencies": {
Expand Down
3 changes: 0 additions & 3 deletions yarn-project/accounts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
},
{
"path": "../foundation"
},
{
"path": "../types"
}
],
"include": ["src", "artifacts/*.d.json.ts"]
Expand Down
1 change: 0 additions & 1 deletion yarn-project/archiver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"@aztec/noir-protocol-circuits-types": "workspace:^",
"@aztec/protocol-contracts": "workspace:^",
"@aztec/telemetry-client": "workspace:^",
"@aztec/types": "workspace:^",
"debug": "^4.3.4",
"lodash.groupby": "^4.6.0",
"lodash.omit": "^4.5.0",
Expand Down
3 changes: 0 additions & 3 deletions yarn-project/archiver/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
},
{
"path": "../telemetry-client"
},
{
"path": "../types"
}
],
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion yarn-project/aztec-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"@aztec/sequencer-client": "workspace:^",
"@aztec/simulator": "workspace:^",
"@aztec/telemetry-client": "workspace:^",
"@aztec/types": "workspace:^",
"@aztec/validator-client": "workspace:^",
"@aztec/world-state": "workspace:^",
"koa": "^2.14.2",
Expand Down
3 changes: 0 additions & 3 deletions yarn-project/aztec-node/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@
{
"path": "../telemetry-client"
},
{
"path": "../types"
},
{
"path": "../validator-client"
},
Expand Down
1 change: 0 additions & 1 deletion yarn-project/aztec.js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
"@aztec/foundation": "workspace:^",
"@aztec/l1-artifacts": "workspace:^",
"@aztec/protocol-contracts": "workspace:^",
"@aztec/types": "workspace:^",
"axios": "^1.7.2",
"tslib": "^2.4.0",
"viem": "2.22.8"
Expand Down
3 changes: 0 additions & 3 deletions yarn-project/aztec.js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
},
{
"path": "../protocol-contracts"
},
{
"path": "../types"
}
],
"include": ["src", "src/**/*.json"]
Expand Down
1 change: 0 additions & 1 deletion yarn-project/aztec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"@aztec/pxe": "workspace:^",
"@aztec/telemetry-client": "workspace:^",
"@aztec/txe": "workspace:^",
"@aztec/types": "workspace:^",
"@aztec/world-state": "workspace:^",
"@types/chalk": "^2.2.0",
"abitype": "^0.8.11",
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/src/cli/cmds/start_pxe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
getContractClassFromArtifact,
} from '@aztec/aztec.js';
import { type AztecNode, PXESchema, createAztecNodeClient } from '@aztec/circuit-types/interfaces/client';
import { L2BasicContractsMap, Network } from '@aztec/circuits.js/network';
import { getContractArtifact } from '@aztec/cli/cli-utils';
import { type NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
import { type LogFn } from '@aztec/foundation/log';
Expand All @@ -18,7 +19,6 @@ import {
createPXEService,
} from '@aztec/pxe';
import { makeTracedFetch } from '@aztec/telemetry-client';
import { L2BasicContractsMap, Network } from '@aztec/types/network';

import { extractRelevantOptions } from '../util.js';
import { getVersions } from '../versioning.js';
Expand Down
3 changes: 0 additions & 3 deletions yarn-project/aztec/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@
{
"path": "../txe"
},
{
"path": "../types"
},
{
"path": "../world-state"
}
Expand Down
1 change: 0 additions & 1 deletion yarn-project/bb-prover/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
"@aztec/kv-store": "workspace:^",
"@aztec/noir-contracts.js": "workspace:^",
"@aztec/protocol-contracts": "workspace:^",
"@aztec/types": "workspace:^",
"@jest/globals": "^29.5.0",
"@types/jest": "^29.5.0",
"@types/memdown": "^3.0.0",
Expand Down
3 changes: 0 additions & 3 deletions yarn-project/bb-prover/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
},
{
"path": "../protocol-contracts"
},
{
"path": "../types"
}
],
"include": ["src"]
Expand Down
5 changes: 2 additions & 3 deletions yarn-project/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function compile_all {
# hack, after running prettier foundation may fail to resolve hash.js dependency.
# it is only currently foundation, presumably because hash.js looks like a js file.
rm -rf foundation/node_modules
compile_project ::: constants foundation circuits.js types builder ethereum l1-artifacts
compile_project ::: constants foundation circuits.js builder ethereum l1-artifacts

# Call all projects that have a generation stage.
parallel --joblog joblog.txt --line-buffered --tag 'cd {} && yarn generate' ::: \
Expand All @@ -61,8 +61,7 @@ function compile_all {
noir-contracts.js \
noir-protocol-circuits-types \
protocol-contracts \
pxe \
types
pxe
cat joblog.txt

get_projects | compile_project
Expand Down
1 change: 0 additions & 1 deletion yarn-project/bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"@aztec/noir-protocol-circuits-types": "workspace:^",
"@aztec/protocol-contracts": "workspace:^",
"@aztec/telemetry-client": "workspace:^",
"@aztec/types": "workspace:^",
"source-map-support": "^0.5.21",
"tslib": "^2.4.0",
"zod": "^3.23.8"
Expand Down
3 changes: 0 additions & 3 deletions yarn-project/bot/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@
},
{
"path": "../telemetry-client"
},
{
"path": "../types"
}
],
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion yarn-project/circuit-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"@aztec/constants": "workspace:^",
"@aztec/ethereum": "workspace:^",
"@aztec/foundation": "workspace:^",
"@aztec/types": "workspace:^",
"browserify-cipher": "^1.0.1",
"lodash.clonedeep": "^4.5.0",
"lodash.isequal": "^4.5.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { type Hasher } from '@aztec/circuits.js/interfaces';
import { makeTuple } from '@aztec/foundation/array';
import { Fr } from '@aztec/foundation/fields';
import { schemas } from '@aztec/foundation/schemas';
Expand All @@ -8,7 +9,6 @@ import {
serializeArrayOfBufferableToVector,
} from '@aztec/foundation/serialize';
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
import { type Hasher } from '@aztec/types/interfaces';

/**
* Contains functionality to compute and serialize/deserialize a sibling path.
Expand Down
3 changes: 0 additions & 3 deletions yarn-project/circuit-types/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
},
{
"path": "../foundation"
},
{
"path": "../types"
}
],
"include": ["src"]
Expand Down
1 change: 1 addition & 0 deletions yarn-project/circuits.js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"./testing": "./dest/tests/index.js",
"./testing/fixtures": "./dest/tests/fixtures.js",
"./interfaces": "./dest/interfaces/index.js",
"./network": "./dest/network/index.js",
"./utils": "./dest/utils/index.js",
"./types": "./dest/types/index.js",
"./contract": "./dest/contract/index.js",
Expand Down
20 changes: 20 additions & 0 deletions yarn-project/circuits.js/src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,23 @@ export interface Ordered {
export interface Positioned {
position: Fr;
}

/**
* Defines hasher interface used by Merkle trees.
*/
export interface Hasher {
/**
* Hash two arrays.
* @param lhs - The first array.
* @param rhs - The second array.
* @returns The new 32-byte hash.
*/
hash(lhs: Uint8Array, rhs: Uint8Array): Buffer;

/**
* Hashes an array of buffers.
* @param inputs - The array of buffers to hash.
* @returns The resulting 32-byte hash.
*/
hashInputs(inputs: Buffer[]): Buffer;
}
File renamed without changes.
1 change: 0 additions & 1 deletion yarn-project/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
"@aztec/constants": "workspace:^",
"@aztec/foundation": "workspace:^",
"@aztec/l1-artifacts": "workspace:^",
"@aztec/types": "workspace:^",
"@aztec/world-state": "workspace:^",
"@iarna/toml": "^2.2.5",
"@libp2p/peer-id-factory": "^3.0.4",
Expand Down
3 changes: 0 additions & 3 deletions yarn-project/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
{
"path": "../l1-artifacts"
},
{
"path": "../types"
},
{
"path": "../world-state"
},
Expand Down
1 change: 0 additions & 1 deletion yarn-project/end-to-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"@aztec/sequencer-client": "workspace:^",
"@aztec/simulator": "workspace:^",
"@aztec/telemetry-client": "workspace:^",
"@aztec/types": "workspace:^",
"@aztec/validator-client": "workspace:^",
"@aztec/world-state": "workspace:^",
"@iarna/toml": "^2.2.5",
Expand Down
3 changes: 0 additions & 3 deletions yarn-project/end-to-end/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@
{
"path": "../telemetry-client"
},
{
"path": "../types"
},
{
"path": "../validator-client"
},
Expand Down
1 change: 0 additions & 1 deletion yarn-project/ivc-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"@aztec/circuits.js": "workspace:^",
"@aztec/constants": "workspace:^",
"@aztec/foundation": "workspace:^",
"@aztec/types": "workspace:^",
"@noir-lang/noir_codegen": "portal:../../noir/packages/noir_codegen",
"@noir-lang/noir_js": "file:../../noir/packages/noir_js",
"@noir-lang/noirc_abi": "portal:../../noir/packages/noirc_abi",
Expand Down
3 changes: 0 additions & 3 deletions yarn-project/ivc-integration/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
{
"path": "../foundation"
},
{
"path": "../types"
},
{
"path": "../bb-prover"
},
Expand Down
1 change: 0 additions & 1 deletion yarn-project/merkle-tree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"@aztec/circuit-types": "workspace:^",
"@aztec/foundation": "workspace:^",
"@aztec/kv-store": "workspace:^",
"@aztec/types": "workspace:^",
"sha256": "^0.2.0",
"tslib": "^2.4.0"
},
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/merkle-tree/src/hasher_with_stats.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Hasher } from '@aztec/types/interfaces';
import { type Hasher } from '@aztec/circuits.js/interfaces';

import { createHistogram, performance } from 'perf_hooks';

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/merkle-tree/src/load_tree.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Hasher } from '@aztec/circuits.js/interfaces';
import { type Bufferable, type FromBuffer } from '@aztec/foundation/serialize';
import { type AztecKVStore } from '@aztec/kv-store';
import { type Hasher } from '@aztec/types/interfaces';

import { type TreeBase, getTreeMeta } from './tree_base.js';

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/merkle-tree/src/new_tree.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Hasher } from '@aztec/circuits.js/interfaces';
import { type Bufferable, type FromBuffer } from '@aztec/foundation/serialize';
import { type AztecKVStore } from '@aztec/kv-store';
import { type Hasher } from '@aztec/types/interfaces';

import { type TreeBase } from './tree_base.js';

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/merkle-tree/src/pedersen.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Hasher } from '@aztec/circuits.js/interfaces';
import { pedersenHash } from '@aztec/foundation/crypto/sync';
import { Fr } from '@aztec/foundation/fields';
import { type Hasher } from '@aztec/types/interfaces';

/**
* A helper class encapsulating Pedersen hash functionality.
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/merkle-tree/src/poseidon.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Hasher } from '@aztec/circuits.js/interfaces';
import { poseidon2Hash } from '@aztec/foundation/crypto/sync';
import { Fr } from '@aztec/foundation/fields';
import { type Hasher } from '@aztec/types/interfaces';

/**
* A helper class encapsulating poseidon2 hash functionality.
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/merkle-tree/src/sha_256.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Hasher } from '@aztec/circuits.js/interfaces';
import { sha256 } from '@aztec/foundation/crypto';
import { truncateAndPad } from '@aztec/foundation/serialize';
import { type Hasher } from '@aztec/types/interfaces';

/**
* A helper class encapsulating SHA256 hash functionality.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SiblingPath } from '@aztec/circuit-types';
import { type Hasher } from '@aztec/circuits.js/interfaces';
import { type Bufferable, type FromBuffer, serializeToBuffer } from '@aztec/foundation/serialize';
import { type AztecKVStore, type AztecMap } from '@aztec/kv-store';
import { type Hasher } from '@aztec/types/interfaces';

import { type AppendOnlyTree } from '../interfaces/append_only_tree.js';
import { type TreeBase } from '../tree_base.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Fr } from '@aztec/circuits.js';
import { type Hasher } from '@aztec/circuits.js/interfaces';
import { NullifierLeaf, NullifierLeafPreimage } from '@aztec/circuits.js/trees';
import { type AztecKVStore } from '@aztec/kv-store';
import { openTmpStore } from '@aztec/kv-store/lmdb';
import { type Hasher } from '@aztec/types/interfaces';

import { Pedersen, newTree } from '../index.js';
import { StandardIndexedTreeWithAppend } from '../standard_indexed_tree/test/standard_indexed_tree_with_append.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { SiblingPath } from '@aztec/circuit-types';
import { type Hasher } from '@aztec/circuits.js/interfaces';
import { randomBigInt } from '@aztec/foundation/crypto';
import { Fr } from '@aztec/foundation/fields';
import { createLogger } from '@aztec/foundation/log';
import { type AztecKVStore } from '@aztec/kv-store';
import { openTmpStore } from '@aztec/kv-store/lmdb';
import { type Hasher } from '@aztec/types/interfaces';

import { INITIAL_LEAF, newTree } from '../index.js';
import { type UpdateOnlyTree } from '../interfaces/update_only_tree.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { SiblingPath } from '@aztec/circuit-types';
import { type BatchInsertionResult, type LeafUpdateWitnessData } from '@aztec/circuit-types/interfaces/server';
import { type TreeInsertionStats } from '@aztec/circuit-types/stats';
import { type Hasher } from '@aztec/circuits.js/interfaces';
import { toBufferBE } from '@aztec/foundation/bigint-buffer';
import { type FromBuffer } from '@aztec/foundation/serialize';
import { Timer } from '@aztec/foundation/timer';
import { type IndexedTreeLeaf, type IndexedTreeLeafPreimage } from '@aztec/foundation/trees';
import { type AztecKVStore, type AztecMap } from '@aztec/kv-store';
import { type Hasher } from '@aztec/types/interfaces';

import { type IndexedTree, type PreimageFactory } from '../interfaces/indexed_tree.js';
import { IndexedTreeSnapshotBuilder } from '../snapshots/indexed_tree_snapshot.js';
Expand Down
Loading

0 comments on commit 3257a97

Please sign in to comment.