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

barretenberg top-level await fails doesn't match its target #4322

Closed
signorecello opened this issue Jan 31, 2024 · 11 comments
Closed

barretenberg top-level await fails doesn't match its target #4322

signorecello opened this issue Jan 31, 2024 · 11 comments
Assignees
Labels
C-bb.js Component: bb.js - wrapping bberg in js

Comments

@signorecello
Copy link
Contributor

signorecello commented Jan 31, 2024

barretenberg top-level await makes NoirJS break in 0.23.0

Gonna expand a bit, this is what I think is happening:

How to reproduce

  1. git clone https://github.com/noir-lang/noir-starter.git
  2. cd noir-starter
  3. git switch zpedro/0.23.0
  4. cd vite-hardhat
  5. yarn
  6. cp .env.example .env
  7. npx hardhat node
    In a different terminal, in noir-starter/vite-hardhat:
  8. yarn install
  9. NETWORK=localhost yarn dev

Error log in terminal

% NETWORK=localhost yarn dev

Nothing to compile
Nothing to compile
(node:20211) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("ts-node/esm/transpile-only", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)
(node:20217) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("ts-node/esm/transpile-only", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)
Deployed at {
  chainId: 31337,
  verifier: '0x5fbdb2315678afecb367f032d93f642f64180aa3'
}

  VITE v5.0.6  ready in 246 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
✘ [ERROR] Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides)

    node_modules/@aztec/bb.js/dest/browser/index.js:2:16426468:
      2 │ ...e.hasOwnProperty.call(A,I);var D=E(183),i=(D=await D).Zh,w=D.AL,h=D.i2,o=D.Fr,G=D.ld;export{i a...
        ╵                                                 ~~~~~

/.../noir-lang/noir-starter/vite-hardhat/node_modules/esbuild/lib/main.js:1650
  let error = new Error(text);
              ^

Error: Build failed with 1 error:
node_modules/@aztec/bb.js/dest/browser/index.js:2:16426468: ERROR: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides)
    at failureErrorWithLog (.../noir-lang/noir-starter/vite-hardhat/node_modules/esbuild/lib/main.js:1650:15)
    at /.../noir-lang/noir-starter/vite-hardhat/node_modules/esbuild/lib/main.js:1058:25
    at /.../noir-lang/noir-starter/vite-hardhat/node_modules/esbuild/lib/main.js:1526:9
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}

Node.js v20.11.
@github-project-automation github-project-automation bot moved this to Todo in A3 Jan 31, 2024
@Savio-Sou Savio-Sou added this to Noir Jan 31, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Jan 31, 2024
@signorecello
Copy link
Contributor Author

here's a branch in noir-starter that can be useful to reproduce the error

@Savio-Sou Savio-Sou self-assigned this Feb 2, 2024
@Savio-Sou
Copy link
Member

@signorecello how do you go about reproducing the error?

I did:

  1. git clone https://github.com/noir-lang/noir-starter.git
  2. cd noir-starter
  3. git switch zpedro/0.23.0
  4. cd vite-hardhat
  5. yarn
  6. Copy-past .env.example into .env
  7. npx hardhat node
  8. NETWORK=localhost yarn build

which got me:
image

Is that the same error you're reporting?

@Savio-Sou
Copy link
Member

Having updated to the latest noir-starter commit with caches cleared, NETWORK=localhost yarn build now build successfully.

Running yarn preview and accessing http://localhost:4173/ gives:
image

Is that the error expected?

@Savio-Sou
Copy link
Member

Savio-Sou commented Feb 6, 2024

Ok running yarn dev (instead of yarn preview) gets the error:
image

Updated Issue body with reproduction steps and error log.

@Savio-Sou Savio-Sou removed their assignment Feb 6, 2024
@Savio-Sou Savio-Sou added the C-bb.js Component: bb.js - wrapping bberg in js label Feb 6, 2024
@signorecello
Copy link
Contributor Author

Yarn preview should work though 🥲 I’ll have a look

@ludamad ludamad self-assigned this Feb 7, 2024
@ludamad
Copy link
Collaborator

ludamad commented Feb 7, 2024

Recreated with (slightly edited) instructions, looking into this

@ludamad
Copy link
Collaborator

ludamad commented Feb 7, 2024

Can you look at AztecProtocol/noir-starter#71 @signorecello ?

@Savio-Sou
Copy link
Member

@signorecello did AztecProtocol/noir-starter#71 fix the issue? (And if yes, does that mean Noir 0.23.0 is not broken?)

@signorecello
Copy link
Contributor Author

Correct 👍

@github-project-automation github-project-automation bot moved this from Todo to Done in A3 Feb 8, 2024
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Feb 8, 2024
@0x18a6
Copy link

0x18a6 commented Mar 29, 2024

I'm getting the exact same error using Noir 0.25.0

@Savio-Sou
Copy link
Member

Hi @0x18a6, could you create a new Issue detailing how your error could be reproduced? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bb.js Component: bb.js - wrapping bberg in js
Projects
Archived in project
Development

No branches or pull requests

4 participants