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

feat: devbox #5772

Merged
merged 69 commits into from
May 1, 2024
Merged

feat: devbox #5772

merged 69 commits into from
May 1, 2024

Conversation

charlielye
Copy link
Contributor

@charlielye charlielye commented Apr 16, 2024

This introduces a base build image in ./build-images. The idea is that this image contains a complete environment to bootstrap aztec-packages. It's available for both x86 and arm, and thus can be used to have a stable and consistent development environment on all operating systems that have docker installed.

The Dockerfile is a multi-stage image with 3 interesting targets:

  • build: The base build image - this can be used by CI to build any part of the project. It contains just the tools needed to successfully bootstrap.
  • devbox: Extends build and includes all sorts of useful developer tools. This container can be run independently via a ./build-images/run.sh script. Vscode can launch it via it's "Dev Containers" plugin, or github/vscode can launch it within codespaces, the configuration is at .devcontainer/dev/devcontainer.json.
  • sysbox: Is similar to devbox but is designed to be run using nestybox's sysbox runtime, like internal aztec developers use on mainframe.

An important thing to note, is that this approach removes all toolchain installations from bootstrap scripts, as it's expected for the right things to be available in your PATH (or in the case of wasi-sdk, at /opt/wasi-sdk). The bootstrap.sh script now checks all toolchains are available and the right version at start. You can also run this command:

% ./bootstrap.sh check
Toolchains look good! 🎉

If there's an issue, a hint is provided on how to resolve, but the engineer is encouraged to just use the dev container.

What's currently checked for:

  • Utils: jq, parallel, awk, git, curl.
  • cmake min 3.24.
  • clang-16.
  • Rust 1.74.
  • Wasi SDK 22 at /opt/wasi-sdk.
  • forge and anvil at commit de33b6a.
  • node min 18.19.
  • yarn and solhint.

Aztec internal engineers who use sysbox on mainframe, should run a sudo halt at their convenience, wait for the box to restart, and they should have a setup that passes the above check. If somethings wrong, you may have some custom configuration in your home dot files that needs removing. Otherwise contact me.

Your hostkey to your sysbox may have changed! Get your IP from ~/.ssh/config and do an e.g.

ssh-keygen -R 173.26.1.1

Other notable changes:

  • wasi-sdk is now version 22.0. This means we have a single sdk for both threaded and unthreaded wasms (they still need to be built independently however. TODO: Investigate if we can build once and link twice). It's expected to be installed at /opt/wasi-sdk.
  • Ensured we're using version 16 of both clangd and clang-format. We should always be explicit about the version we're using. We should probably upgrade to clang/d/format 18 soon as that's what's distributed in ubuntu noble, and is also what the wasi-sdk uses.
  • Update Earthly builds to use noble.
  • Some cpp files formatting change with the shift from 15 to 16.
  • Removed the parallel_for moody implementation. Had to update various bits of threading code to be properly ignored when building non threaded wasm. Maybe we can just always build the threaded wasm, and just link it twice with shared memory enable/disabled? Not sure.
  • When running the dev container on a mac, with aztec-packages mounted from the host filesystem, there is a known bug around incremental rust builds, and fractional file modification timestamps. A script runs after building noir-repo to normalise these timestamps, if it's detected that the host is a mac.
  • Purge a load of unneeded stuff when building aztec prod image, to reduce container size. We do similar for end-to-end tests because they need to be serialized from Earthly to Docker and that's currently slow.
  • Simplified some end-to-end Earthly config.
  • Removed all test specific timeouts in favour of just launching jest with a 5m test timeout.

@charlielye charlielye marked this pull request as ready for review April 27, 2024 10:37
@charlielye charlielye requested a review from ludamad April 29, 2024 11:07
@@ -1,4 +1,4 @@
#!/bin/sh
./src/wasi-sdk-20.0/bin/llvm-strip ./build-wasm/bin/barretenberg.wasm
/opt/wasi-sdk/bin/llvm-strip ./build-wasm/bin/barretenberg.wasm
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not rely on llvm strip being in path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not in PATH as wasi-sdk bins don't have unique prefixes.
Cross compilers usually might be named like wasi-wasm-clang++ or someting. Maybe that could be fixed in the wasi build? Then we could add wasi to PATH.

VERSION 0.8

build:
FROM DOCKERFILE --target build .
Copy link
Collaborator

Choose a reason for hiding this comment

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

I still think we'll avoid a lot of practical headache publishing this image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I intend to publish (in fact have already published the wasi-sdk part). But right now the only issue should be cold start?

@charlielye charlielye mentioned this pull request Apr 30, 2024
@charlielye charlielye merged commit 72321f9 into master May 1, 2024
64 of 65 checks passed
@charlielye charlielye deleted the cl/devbox branch May 1, 2024 09:28
TomAFrench added a commit that referenced this pull request May 1, 2024
* master:
  feat: devbox (#5772)
  docs: Yellow paper updates for the parity circuits (#6048)
  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: Pippenger benchmarks compatible with wasmtime (#6095)
  chore: bump bench-tx-size timeout (#6109)
  chore: ebs attach robustness (#6108)
  chore(ci): Run benchmarks on Earthly (#6089)
rahul-kothari pushed a commit that referenced this pull request May 2, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-package: 0.37.0</summary>

##
[0.37.0](aztec-package-v0.36.0...aztec-package-v0.37.0)
(2024-05-02)


### Miscellaneous

* **aztec-package:** Synchronize aztec-packages versions
</details>

<details><summary>barretenberg.js: 0.37.0</summary>

##
[0.37.0](barretenberg.js-v0.36.0...barretenberg.js-v0.37.0)
(2024-05-02)


### Features

* Devbox
([#5772](#5772))
([72321f9](72321f9))
</details>

<details><summary>aztec-packages: 0.37.0</summary>

##
[0.37.0](aztec-packages-v0.36.0...aztec-packages-v0.37.0)
(2024-05-02)


### ⚠ BREAKING CHANGES

* use `distinct` return value witnesses by default
(noir-lang/noir#4951)
* Bit shift is restricted to u8 right operand
(noir-lang/noir#4907)

### Features

* Abort ongoing proving jobs
([#6049](#6049))
([0aa352d](0aa352d))
* Add aztecprotocol/aztec-builder
([#6116](#6116))
([30899d0](30899d0))
* Add de-sugaring for `impl Trait` in function parameters
(noir-lang/noir#4919)
([f060fa6](f060fa6))
* Aztec nr lib constraining nullifier key is fresh
([#5939](#5939))
([f95de6b](f95de6b))
* Bit shift is restricted to u8 right operand
(noir-lang/noir#4907)
([f060fa6](f060fa6))
* Count Bb lines weighted by complexity
([#6090](#6090))
([705177f](705177f))
* Devbox
([#5772](#5772))
([72321f9](72321f9))
* Enforce gas limits from private kernels
([#6105](#6105))
([4395855](4395855))
* **experimental:** `comptime` globals
(noir-lang/noir#4918)
([f060fa6](f060fa6))
* Handle `no_predicates` attribute
(noir-lang/noir#4942)
([4dc5efb](4dc5efb))
* Migrate boxes to GA and Earthly
([#6076](#6076))
([4a49f9d](4a49f9d))
* Pippenger benchmarks compatible with wasmtime
([#6095](#6095))
([5297b5b](5297b5b))
* Private da gas metering
([#6103](#6103))
([1a8f372](1a8f372))
* Prover metrics
([#6050](#6050))
([5b133f2](5b133f2))
* Use `distinct` return value witnesses by default
(noir-lang/noir#4951)
([4dc5efb](4dc5efb))


### Bug Fixes

* Ban self-referential structs
(noir-lang/noir#4883)
([f060fa6](f060fa6))
* **ci:** Build-key hotfix
([#6123](#6123))
([5791004](5791004))
* **ci:** Ssh'ing into instances
([#6136](#6136))
([af3192d](af3192d))
* Discard ref counts during unrolling
(noir-lang/noir#4923)
([f060fa6](f060fa6))
* **docs:** Add codegen to `aztec-builder` command
([#6098](#6098))
([4839ed9](4839ed9))
* Ensure where clauses propagated to trait default definitions
(noir-lang/noir#4894)
([4dc5efb](4dc5efb))
* Require for all foldable functions to use distinct return
(noir-lang/noir#4949)
([4dc5efb](4dc5efb))


### Miscellaneous

* Add regression test for
[#3051](#3051)
(noir-lang/noir#4815)
([f060fa6](f060fa6))
* Add test for recursing a foldable function
(noir-lang/noir#4948)
([4dc5efb](4dc5efb))
* Adding devcontainer with create aztec app
([#5960](#5960))
([ae5cb21](ae5cb21))
* Build docs in earthly
([#6038](#6038))
([784d542](784d542))
* Bump bench-tx-size timeout
([#6109](#6109))
([aa3eefa](aa3eefa))
* **ci:** Fix spot runner build key
([#6119](#6119))
([f332bc9](f332bc9))
* **ci:** Hotfix
([#6124](#6124))
([f60dfcd](f60dfcd))
* **ci:** Run benchmarks on Earthly
([#6089](#6089))
([c985c73](c985c73))
* **ci:** Turn off ARM build for now
([#6135](#6135))
([853913f](853913f))
* Disable bench-summary for now
([67485f1](67485f1))
* Disable doc builds
([#6107](#6107))
([7933f0f](7933f0f))
* **docs:** Adding matomo tracking
(noir-lang/noir#4898)
([4dc5efb](4dc5efb))
* Ebs attach robustness
([#6108](#6108))
([c702688](c702688))
* Fix typo in `ResolverError::AbiAttributeOutsideContract`
(noir-lang/noir#4933)
([4dc5efb](4dc5efb))
* Migrate the prover client test to earthly
([#6118](#6118))
([a59a6c0](a59a6c0))
* Redo typo PR by stayweek
([#6080](#6080))
([0869452](0869452))
* Redo typo PR by vitalmotif
([#6081](#6081))
([1a89d1a](1a89d1a))
* Refactor nested contract test for speed
([#6117](#6117))
([b346a2f](b346a2f))
* Remove unnecessary `pub(super)` in interpreter
(noir-lang/noir#4939)
([4dc5efb](4dc5efb))
* Replace relative paths to noir-protocol-circuits
([47592a2](47592a2))
* Replace relative paths to noir-protocol-circuits
([f0d95f5](f0d95f5))
* Update error conversion traits to act on references
(noir-lang/noir#4936)
([f060fa6](f060fa6))


### Documentation

* Tweaks for release
([#6129](#6129))
([77b45b9](77b45b9))
* Update @aztec/builder readme
([#6115](#6115))
([248761e](248761e))
* Yellow paper updates for the parity circuits
([#6048](#6048))
([cfe1b05](cfe1b05))
</details>

<details><summary>barretenberg: 0.37.0</summary>

##
[0.37.0](barretenberg-v0.36.0...barretenberg-v0.37.0)
(2024-05-02)


### ⚠ BREAKING CHANGES

* use `distinct` return value witnesses by default
(noir-lang/noir#4951)

### Features

* Count Bb lines weighted by complexity
([#6090](#6090))
([705177f](705177f))
* Devbox
([#5772](#5772))
([72321f9](72321f9))
* Handle `no_predicates` attribute
(noir-lang/noir#4942)
([4dc5efb](4dc5efb))
* Pippenger benchmarks compatible with wasmtime
([#6095](#6095))
([5297b5b](5297b5b))
* Use `distinct` return value witnesses by default
(noir-lang/noir#4951)
([4dc5efb](4dc5efb))


### Bug Fixes

* Ensure where clauses propagated to trait default definitions
(noir-lang/noir#4894)
([4dc5efb](4dc5efb))
* Require for all foldable functions to use distinct return
(noir-lang/noir#4949)
([4dc5efb](4dc5efb))


### Miscellaneous

* Add test for recursing a foldable function
(noir-lang/noir#4948)
([4dc5efb](4dc5efb))
* **docs:** Adding matomo tracking
(noir-lang/noir#4898)
([4dc5efb](4dc5efb))
* Fix typo in `ResolverError::AbiAttributeOutsideContract`
(noir-lang/noir#4933)
([4dc5efb](4dc5efb))
* Redo typo PR by stayweek
([#6080](#6080))
([0869452](0869452))
* Remove unnecessary `pub(super)` in interpreter
(noir-lang/noir#4939)
([4dc5efb](4dc5efb))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
AztecBot added a commit to AztecProtocol/barretenberg that referenced this pull request May 3, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-package: 0.37.0</summary>

##
[0.37.0](AztecProtocol/aztec-packages@aztec-package-v0.36.0...aztec-package-v0.37.0)
(2024-05-02)


### Miscellaneous

* **aztec-package:** Synchronize aztec-packages versions
</details>

<details><summary>barretenberg.js: 0.37.0</summary>

##
[0.37.0](AztecProtocol/aztec-packages@barretenberg.js-v0.36.0...barretenberg.js-v0.37.0)
(2024-05-02)


### Features

* Devbox
([#5772](AztecProtocol/aztec-packages#5772))
([72321f9](AztecProtocol/aztec-packages@72321f9))
</details>

<details><summary>aztec-packages: 0.37.0</summary>

##
[0.37.0](AztecProtocol/aztec-packages@aztec-packages-v0.36.0...aztec-packages-v0.37.0)
(2024-05-02)


### ⚠ BREAKING CHANGES

* use `distinct` return value witnesses by default
(noir-lang/noir#4951)
* Bit shift is restricted to u8 right operand
(noir-lang/noir#4907)

### Features

* Abort ongoing proving jobs
([#6049](AztecProtocol/aztec-packages#6049))
([0aa352d](AztecProtocol/aztec-packages@0aa352d))
* Add aztecprotocol/aztec-builder
([#6116](AztecProtocol/aztec-packages#6116))
([30899d0](AztecProtocol/aztec-packages@30899d0))
* Add de-sugaring for `impl Trait` in function parameters
(noir-lang/noir#4919)
([f060fa6](AztecProtocol/aztec-packages@f060fa6))
* Aztec nr lib constraining nullifier key is fresh
([#5939](AztecProtocol/aztec-packages#5939))
([f95de6b](AztecProtocol/aztec-packages@f95de6b))
* Bit shift is restricted to u8 right operand
(noir-lang/noir#4907)
([f060fa6](AztecProtocol/aztec-packages@f060fa6))
* Count Bb lines weighted by complexity
([#6090](AztecProtocol/aztec-packages#6090))
([705177f](AztecProtocol/aztec-packages@705177f))
* Devbox
([#5772](AztecProtocol/aztec-packages#5772))
([72321f9](AztecProtocol/aztec-packages@72321f9))
* Enforce gas limits from private kernels
([#6105](AztecProtocol/aztec-packages#6105))
([4395855](AztecProtocol/aztec-packages@4395855))
* **experimental:** `comptime` globals
(noir-lang/noir#4918)
([f060fa6](AztecProtocol/aztec-packages@f060fa6))
* Handle `no_predicates` attribute
(noir-lang/noir#4942)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))
* Migrate boxes to GA and Earthly
([#6076](AztecProtocol/aztec-packages#6076))
([4a49f9d](AztecProtocol/aztec-packages@4a49f9d))
* Pippenger benchmarks compatible with wasmtime
([#6095](AztecProtocol/aztec-packages#6095))
([5297b5b](AztecProtocol/aztec-packages@5297b5b))
* Private da gas metering
([#6103](AztecProtocol/aztec-packages#6103))
([1a8f372](AztecProtocol/aztec-packages@1a8f372))
* Prover metrics
([#6050](AztecProtocol/aztec-packages#6050))
([5b133f2](AztecProtocol/aztec-packages@5b133f2))
* Use `distinct` return value witnesses by default
(noir-lang/noir#4951)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))


### Bug Fixes

* Ban self-referential structs
(noir-lang/noir#4883)
([f060fa6](AztecProtocol/aztec-packages@f060fa6))
* **ci:** Build-key hotfix
([#6123](AztecProtocol/aztec-packages#6123))
([5791004](AztecProtocol/aztec-packages@5791004))
* **ci:** Ssh'ing into instances
([#6136](AztecProtocol/aztec-packages#6136))
([af3192d](AztecProtocol/aztec-packages@af3192d))
* Discard ref counts during unrolling
(noir-lang/noir#4923)
([f060fa6](AztecProtocol/aztec-packages@f060fa6))
* **docs:** Add codegen to `aztec-builder` command
([#6098](AztecProtocol/aztec-packages#6098))
([4839ed9](AztecProtocol/aztec-packages@4839ed9))
* Ensure where clauses propagated to trait default definitions
(noir-lang/noir#4894)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))
* Require for all foldable functions to use distinct return
(noir-lang/noir#4949)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))


### Miscellaneous

* Add regression test for
[#3051](AztecProtocol/aztec-packages#3051)
(noir-lang/noir#4815)
([f060fa6](AztecProtocol/aztec-packages@f060fa6))
* Add test for recursing a foldable function
(noir-lang/noir#4948)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))
* Adding devcontainer with create aztec app
([#5960](AztecProtocol/aztec-packages#5960))
([ae5cb21](AztecProtocol/aztec-packages@ae5cb21))
* Build docs in earthly
([#6038](AztecProtocol/aztec-packages#6038))
([784d542](AztecProtocol/aztec-packages@784d542))
* Bump bench-tx-size timeout
([#6109](AztecProtocol/aztec-packages#6109))
([aa3eefa](AztecProtocol/aztec-packages@aa3eefa))
* **ci:** Fix spot runner build key
([#6119](AztecProtocol/aztec-packages#6119))
([f332bc9](AztecProtocol/aztec-packages@f332bc9))
* **ci:** Hotfix
([#6124](AztecProtocol/aztec-packages#6124))
([f60dfcd](AztecProtocol/aztec-packages@f60dfcd))
* **ci:** Run benchmarks on Earthly
([#6089](AztecProtocol/aztec-packages#6089))
([c985c73](AztecProtocol/aztec-packages@c985c73))
* **ci:** Turn off ARM build for now
([#6135](AztecProtocol/aztec-packages#6135))
([853913f](AztecProtocol/aztec-packages@853913f))
* Disable bench-summary for now
([67485f1](AztecProtocol/aztec-packages@67485f1))
* Disable doc builds
([#6107](AztecProtocol/aztec-packages#6107))
([7933f0f](AztecProtocol/aztec-packages@7933f0f))
* **docs:** Adding matomo tracking
(noir-lang/noir#4898)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))
* Ebs attach robustness
([#6108](AztecProtocol/aztec-packages#6108))
([c702688](AztecProtocol/aztec-packages@c702688))
* Fix typo in `ResolverError::AbiAttributeOutsideContract`
(noir-lang/noir#4933)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))
* Migrate the prover client test to earthly
([#6118](AztecProtocol/aztec-packages#6118))
([a59a6c0](AztecProtocol/aztec-packages@a59a6c0))
* Redo typo PR by stayweek
([#6080](AztecProtocol/aztec-packages#6080))
([0869452](AztecProtocol/aztec-packages@0869452))
* Redo typo PR by vitalmotif
([#6081](AztecProtocol/aztec-packages#6081))
([1a89d1a](AztecProtocol/aztec-packages@1a89d1a))
* Refactor nested contract test for speed
([#6117](AztecProtocol/aztec-packages#6117))
([b346a2f](AztecProtocol/aztec-packages@b346a2f))
* Remove unnecessary `pub(super)` in interpreter
(noir-lang/noir#4939)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))
* Replace relative paths to noir-protocol-circuits
([47592a2](AztecProtocol/aztec-packages@47592a2))
* Replace relative paths to noir-protocol-circuits
([f0d95f5](AztecProtocol/aztec-packages@f0d95f5))
* Update error conversion traits to act on references
(noir-lang/noir#4936)
([f060fa6](AztecProtocol/aztec-packages@f060fa6))


### Documentation

* Tweaks for release
([#6129](AztecProtocol/aztec-packages#6129))
([77b45b9](AztecProtocol/aztec-packages@77b45b9))
* Update @aztec/builder readme
([#6115](AztecProtocol/aztec-packages#6115))
([248761e](AztecProtocol/aztec-packages@248761e))
* Yellow paper updates for the parity circuits
([#6048](AztecProtocol/aztec-packages#6048))
([cfe1b05](AztecProtocol/aztec-packages@cfe1b05))
</details>

<details><summary>barretenberg: 0.37.0</summary>

##
[0.37.0](AztecProtocol/aztec-packages@barretenberg-v0.36.0...barretenberg-v0.37.0)
(2024-05-02)


### ⚠ BREAKING CHANGES

* use `distinct` return value witnesses by default
(noir-lang/noir#4951)

### Features

* Count Bb lines weighted by complexity
([#6090](AztecProtocol/aztec-packages#6090))
([705177f](AztecProtocol/aztec-packages@705177f))
* Devbox
([#5772](AztecProtocol/aztec-packages#5772))
([72321f9](AztecProtocol/aztec-packages@72321f9))
* Handle `no_predicates` attribute
(noir-lang/noir#4942)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))
* Pippenger benchmarks compatible with wasmtime
([#6095](AztecProtocol/aztec-packages#6095))
([5297b5b](AztecProtocol/aztec-packages@5297b5b))
* Use `distinct` return value witnesses by default
(noir-lang/noir#4951)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))


### Bug Fixes

* Ensure where clauses propagated to trait default definitions
(noir-lang/noir#4894)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))
* Require for all foldable functions to use distinct return
(noir-lang/noir#4949)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))


### Miscellaneous

* Add test for recursing a foldable function
(noir-lang/noir#4948)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))
* **docs:** Adding matomo tracking
(noir-lang/noir#4898)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))
* Fix typo in `ResolverError::AbiAttributeOutsideContract`
(noir-lang/noir#4933)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))
* Redo typo PR by stayweek
([#6080](AztecProtocol/aztec-packages#6080))
([0869452](AztecProtocol/aztec-packages@0869452))
* Remove unnecessary `pub(super)` in interpreter
(noir-lang/noir#4939)
([4dc5efb](AztecProtocol/aztec-packages@4dc5efb))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

None yet

3 participants