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: @aztec/stdlib pt1 -> cleanup circuits js #12039

Merged
merged 40 commits into from
Feb 19, 2025
Merged

Conversation

Thunkar
Copy link
Contributor

@Thunkar Thunkar commented Feb 17, 2025

This initial PR focuses on:

  • Moving generic stuff from circuits.js to foundation: merkle tree calculator is general enough to be on foundation, same with crypto functions.
  • Extracting references to blobs from circuits.js so they're not accidentally imported into browser bundles again. Still work to do here, this will only be completely realized once the "catchall" export is removed.
  • Extracting constants to its own package to deal with circular references -> blob-lib and circuits.js need them, this opens the door to cleaner and more advanced anti "I forgot to update constants" measures.
  • Prepare foundation and circuits.js so aztec-specific code is moved from the former to the latter (will be done in a new PR, specifically targetting aztec-address, abi already moved).
  • Preparing circuits.js for a reorg, specifically targeting the removal of the "catchall" export and moving to granular approach. This will end with the renaming of circuits.js to stdlib.
  • Preparing for the removal of a lot of reexports. They will be kept to a minimum, with the exception of outwards-facing APIs such as aztec.js

@Thunkar Thunkar added the e2e-all CI: Enables this CI job. label Feb 17, 2025
@Thunkar Thunkar self-assigned this Feb 17, 2025
@Thunkar Thunkar requested review from ludamad and removed request for fcarreiro and dbanks12 February 17, 2025 11:28
@ludamad
Copy link
Collaborator

ludamad commented Feb 17, 2025

Hmm looks good at a glance but is there a reason to separate out constants in a package vs just some stdlib package?

@Thunkar
Copy link
Contributor Author

Thunkar commented Feb 17, 2025

Hmm looks good at a glance but is there a reason to separate out constants in a package vs just some stdlib package?

Mainly that's going to be used by 2 "top level" package which are going to be stdlib and blob-lib. Good thing is that if it changes through the refactor, it's a lot easier now to replace @aztec/constants with @aztec/stdlib/constants

@Thunkar Thunkar removed the e2e-all CI: Enables this CI job. label Feb 19, 2025
@Maddiaa0
Copy link
Member

p2p lgtm

Copy link
Contributor

@alexghr alexghr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prover-client looks good to me. Great work Grego!

@spalladino
Copy link
Collaborator

spalladino commented Feb 19, 2025

Pasting output of git diff --summary here to make it easy to inspect moved files:

 create mode 100644 yarn-project/blob-lib/src/testing.ts
 create mode 100644 yarn-project/circuits.js/src/schemas/index.ts
 create mode 100644 yarn-project/circuits.js/src/structs/avm/index.ts
 create mode 100644 yarn-project/circuits.js/src/structs/kernel/index.ts
 create mode 100644 yarn-project/circuit-types/src/interfaces/client.ts
 create mode 100644 yarn-project/constants/.eslintrc.cjs
 create mode 100644 yarn-project/constants/package.json
 create mode 100644 yarn-project/constants/tsconfig.json
 delete mode 100644 .yarn/install-state.gz
 delete mode 100644 yarn-project/blob-lib/src/mocks.ts
 delete mode 100644 yarn-project/circuits.js/src/barretenberg/crypto/index.ts
 delete mode 100644 yarn-project/circuits.js/src/barretenberg/index.ts
 delete mode 100644 yarn-project/circuits.js/src/barretenberg/README.txt
 delete mode 100644 yarn-project/circuits.js/src/merkle/index.ts
 delete mode 100644 yarn-project/circuits.js/src/structs/blobs/index.ts
 delete mode 100644 yarn-project/circuit-types/src/p2p/mocks.ts
 delete mode 100644 yarn-project/types/src/abi/index.ts
 delete mode 100644 yarn-project/types/src/test/fixtures.ts
 rename yarn-project/{circuits.js => constants}/precommit.sh (100%)
 rename yarn-project/{circuits.js => constants}/src/constants.gen.ts (100%)
 rename yarn-project/{circuits.js => constants}/src/constants.ts (100%)
 rename yarn-project/{circuits.js => constants}/src/scripts/constants.in.ts (100%)
 rename yarn-project/{circuits.js/src/barretenberg => foundation/src}/crypto/aes128/index.test.ts (100%)
 rename yarn-project/{circuits.js/src/barretenberg => foundation/src}/crypto/aes128/index.ts (100%)
 rename yarn-project/{circuits.js/src/barretenberg => foundation/src}/crypto/ecdsa/index.test.ts (100%)
 rename yarn-project/{circuits.js/src/barretenberg => foundation/src}/crypto/ecdsa/index.ts (97%)
 rename yarn-project/{circuits.js/src/barretenberg => foundation/src}/crypto/ecdsa/signature.test.ts (100%)
 rename yarn-project/{circuits.js/src/barretenberg => foundation/src}/crypto/ecdsa/signature.ts (100%)
 rename yarn-project/{circuits.js/src/barretenberg => foundation/src}/crypto/grumpkin/index.test.ts (91%)
 rename yarn-project/{circuits.js/src/barretenberg => foundation/src}/crypto/grumpkin/index.ts (100%)
 rename yarn-project/{circuits.js/src/barretenberg => foundation/src}/crypto/schnorr/index.test.ts (100%)
 rename yarn-project/{circuits.js/src/barretenberg => foundation/src}/crypto/schnorr/index.ts (89%)
 rename yarn-project/{circuits.js/src/barretenberg => foundation/src}/crypto/schnorr/signature.ts (100%)
 rename yarn-project/{circuits.js/src/barretenberg => foundation/src}/crypto/secp256k1/index.test.ts (100%)
 rename yarn-project/{circuits.js/src/barretenberg => foundation/src}/crypto/secp256k1/index.ts (100%)
 rename yarn-project/{circuits.js/src/barretenberg => foundation/src/crypto}/serialize.ts (100%)
 rename yarn-project/{circuits.js/src/barretenberg => foundation/src}/crypto/signature/index.ts (100%)
 rename yarn-project/{circuits.js/src/merkle => foundation/src/trees}/indexed_merkle_tree_calculator.test.ts (66%)
 rename yarn-project/{circuits.js/src/merkle => foundation/src/trees}/indexed_merkle_tree_calculator.ts (100%)
 rename yarn-project/{circuits.js/src/merkle => foundation/src/trees}/indexed_merkle_tree.ts (95%)
 rename yarn-project/{circuits.js/src/merkle => foundation/src/trees}/merkle_tree_calculator.test.ts (100%)
 rename yarn-project/{circuits.js/src/merkle => foundation/src/trees}/merkle_tree_calculator.ts (100%)
 rename yarn-project/{circuits.js/src/merkle => foundation/src/trees}/merkle_tree.ts (100%)
 rename yarn-project/{circuits.js/src/merkle => foundation/src/trees}/sibling_path.test.ts (100%)
 rename yarn-project/{circuits.js/src/merkle => foundation/src/trees}/sibling_path.ts (100%)
 rename yarn-project/{circuits.js/src/structs/blobs => blob-lib/src}/blob_public_inputs.test.ts (95%)
 rename yarn-project/{circuits.js/src/structs/blobs => blob-lib/src}/blob_public_inputs.ts (94%)
 rename yarn-project/{circuits.js/src/structs/blobs => blob-lib/src}/sponge_blob.test.ts (93%)
 rename yarn-project/{circuits.js/src/structs/blobs => blob-lib/src}/sponge_blob.ts (100%)
 rename yarn-project/{circuits.js/src/structs => foundation/src/trees}/membership_witness.ts (92%)
 rename yarn-project/circuits.js/src/{structs => types}/shared.ts (100%)
 rename yarn-project/circuit-types/src/interfaces/{index.ts => server.ts} (82%)
 rename yarn-project/circuit-types/src/{ => test}/mocks.ts (78%)
 rename yarn-project/{foundation => circuits.js}/src/abi/abi.test.ts (100%)
 rename yarn-project/{foundation => circuits.js}/src/abi/abi.ts (98%)
 rename yarn-project/{foundation => circuits.js}/src/abi/buffer.test.ts (100%)
 rename yarn-project/{foundation => circuits.js}/src/abi/buffer.ts (97%)
 rename yarn-project/{foundation => circuits.js}/src/abi/decoder.test.ts (99%)
 rename yarn-project/{foundation => circuits.js}/src/abi/decoder.ts (98%)
 rename yarn-project/{foundation => circuits.js}/src/abi/encoder.test.ts (95%)
 rename yarn-project/{foundation => circuits.js}/src/abi/encoder.ts (99%)
 rename yarn-project/{foundation => circuits.js}/src/abi/event_selector.ts (88%)
 rename yarn-project/{foundation => circuits.js}/src/abi/function_selector.test.ts (93%)
 rename yarn-project/{foundation => circuits.js}/src/abi/function_selector.ts (90%)
 rename yarn-project/{foundation => circuits.js}/src/abi/index.ts (87%)
 rename yarn-project/{foundation => circuits.js}/src/abi/note_selector.ts (85%)
 rename yarn-project/{foundation => circuits.js}/src/abi/selector.ts (89%)
 rename yarn-project/{foundation => circuits.js}/src/abi/__snapshots__/function_selector.test.ts.snap (100%)
 rename yarn-project/{foundation => circuits.js}/src/abi/u128.test.ts (100%)
 rename yarn-project/{foundation => circuits.js}/src/abi/u128.ts (97%)
 rename yarn-project/{foundation => circuits.js}/src/abi/utils.test.ts (100%)
 rename yarn-project/{foundation => circuits.js}/src/abi/utils.ts (100%)
 rename yarn-project/{types => circuits.js}/src/abi/contract_artifact.test.ts (75%)
 rename yarn-project/{types => circuits.js}/src/abi/contract_artifact.ts (99%)
 rename yarn-project/{types => circuits.js}/src/abi/mocked_keys.ts (100%)
 rename yarn-project/{types => circuits.js}/src/noir/index.ts (99%)

@Thunkar Thunkar merged commit 1e4ad1c into master Feb 19, 2025
12 checks passed
@Thunkar Thunkar deleted the gj/cleanup_circuits_js branch February 19, 2025 18:42
TomAFrench added a commit that referenced this pull request Feb 19, 2025
* master: (264 commits)
  chore(p2p): log if rate limit was peer or global (#12116)
  chore: @aztec/stdlib pt1 -> cleanup circuits js (#12039)
  chore(tests): shorten block times in e2e p2p tests (#12073)
  fix: darwin properly erroring (#12113)
  chore: add missing import (#12111)
  fix: yarn remake-constants (#12109)
  chore: fix error in oracle definition (#12090)
  fix: Don't consider skipping (#10598)
  fix: Use gas billed in block header building (#12101)
  fix(avm): disable wrong sha skippable (#12099)
  chore: Provide defaults for bb and acvm in release image (#12105)
  fix(avm): break TS dependency cycle (#12103)
  feat: IVC gates command in WASM (#11792)
  fix: SharedMutable compilation warnings (#12098)
  git subrepo push --branch=master noir-projects/aztec-nr
  git_subrepo.sh: Fix parent in .gitrepo file. [skip ci]
  chore: replace relative paths to noir-protocol-circuits
  git subrepo push --branch=master barretenberg
  feat: Sync from noir (#12064)
  chore: Fix unbound CI variable on release image bootstrap (#12095)
  ...
TomAFrench added a commit that referenced this pull request Feb 19, 2025
* master: (264 commits)
  chore(p2p): log if rate limit was peer or global (#12116)
  chore: @aztec/stdlib pt1 -> cleanup circuits js (#12039)
  chore(tests): shorten block times in e2e p2p tests (#12073)
  fix: darwin properly erroring (#12113)
  chore: add missing import (#12111)
  fix: yarn remake-constants (#12109)
  chore: fix error in oracle definition (#12090)
  fix: Don't consider skipping (#10598)
  fix: Use gas billed in block header building (#12101)
  fix(avm): disable wrong sha skippable (#12099)
  chore: Provide defaults for bb and acvm in release image (#12105)
  fix(avm): break TS dependency cycle (#12103)
  feat: IVC gates command in WASM (#11792)
  fix: SharedMutable compilation warnings (#12098)
  git subrepo push --branch=master noir-projects/aztec-nr
  git_subrepo.sh: Fix parent in .gitrepo file. [skip ci]
  chore: replace relative paths to noir-protocol-circuits
  git subrepo push --branch=master barretenberg
  feat: Sync from noir (#12064)
  chore: Fix unbound CI variable on release image bootstrap (#12095)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants