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

assertion failed [block != nullptr]: BasicBlock requested for unrecognized address (BuilderBase.h:550 block_for_offset) #13523

Closed
Qambar opened this issue Sep 14, 2022 · 7 comments
Projects

Comments

@Qambar
Copy link

Qambar commented Sep 14, 2022

Description

The compiler is crashing with the following error message:

$ yarn test
yarn run v1.22.10
$ npx hardhat compile; truffle test --network local
Solidity 0.8.17 is not fully supported yet. You can still use Hardhat, but some features, like stack traces, might not work correctly.

Learn more at https://hardhat.org/hardhat-runner/docs/reference/solidity-support

Nothing to compile
Using network 'local'.


Compiling your contracts...
===========================
assertion failed [block != nullptr]: BasicBlock requested for unrecognized address
(BuilderBase.h:550 block_for_offset)
/bin/sh: line 1: 12129 Trace/BPT trap: 5       truffle test --network local
error Command failed with exit code 133.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I contacted truffle support, and they advised that it was a compiler bug and it should be reported here.

Environment

  • Compiler version:
    Truffle v5.4.11 (core: 5.4.11)
    Solidity - 0.8.17 (solc-js)
    Node v18.7.0
    Web3.js v1.5.2

  • Target EVM version (as per compiler settings): 0.8.17

  • Framework/IDE (e.g. Truffle or Remix): 5.4.11

  • EVM execution environment / backend / blockchain client: ganache v7.4.1 (@ganache/cli: 0.5.1, @ganache/core: 0.5.1)

  • Operating system: Mac OS

Steps to Reproduce

This error is intermittent, I will record a video to demonstrate it and share it in the comments. Also, documenting the steps below

  1. Run truffle test
$ yarn test
yarn run v1.22.10
$ npx hardhat compile; truffle test --network local
  1. It will compile contracts
Nothing to compile
Using network 'local'.


Compiling your contracts...
===========================
assertion failed [block != nullptr]: BasicBlock requested for unrecognized address
(BuilderBase.h:550 block_for_offset)
/bin/sh: line 1: 12129 Trace/BPT trap: 5       truffle test --network local
error Command failed with exit code 133.
  1. Run the truffle test again and it might work
$ yarn test
yarn run v1.22.10
$ npx hardhat compile; truffle test --network local
Solidity 0.8.17 is not fully supported yet. You can still use Hardhat, but some features, like stack traces, might not work correctly.

Learn more at https://hardhat.org/hardhat-runner/docs/reference/solidity-support

Nothing to compile
Using network 'local'.


Compiling your contracts...
===========================
> Compiling ./contracts/Migrations.sol
> Compiling ./contracts/TheAgencyPassContract.sol
> Artifacts written to /var/folders/f_/ll33dc315ldc738pbth9339m0000gp/T/test--12086-Y5KWaRC2tIAx
> Compiled successfully using:
   - solc: 0.8.17+commit.8df45f5f.Emscripten.clang
Your contract is deployed to 0xb2139Df9e18a07AeEA394FE9B70ACDD89e6A0474


  Testing contract
    ✔ can run tests
    ✔ contract has royalty equal to 10%
    ✔ should have the max supply of 450
    ✔ Should be able to mint reserved (74ms)
    ✔ Should start at token id 1 (92ms)
    ✔ Should be able to mint reserved 11 items (63ms)
    ✔ Should not be able to mint whitelist if sale is not active  (86ms)
    ✔ Should be able to mint whitelist (109ms)
    ✔ Should be able to mint OG whitelist
    ✔ Should be able to mint OG whitelist (124ms)
    ✔ Should be not able to mint twice OG whitelist (76ms)
    ✔ Should send royalty back to the contract


  12 passing (5s)

✨  Done in 16.35s.
@cameel
Copy link
Member

cameel commented Sep 14, 2022

Is that error really coming from the compiler? We do have a struct called BasicBlock but no BuilderBase.h (it's part of the control flow graph instead).

If it's a compiler problem it should be reproducible just by running solc (or solc-js) on it without Truffle or Hardhat. Can you show us the input contracts? Or preferably some minimal piece of code needed to trigger this?

@cameel cameel added this to Triage in Solidity via automation Sep 14, 2022
@ekpyron ekpyron added the waiting for more input Issues waiting for more input by the reporter label Sep 14, 2022
@pavbro
Copy link

pavbro commented Sep 15, 2022

Same for me:

assertion failed [block != nullptr]: BasicBlock requested for unrecognized address
(BuilderBase.h:550 block_for_offset)

And also on MacOs. Same code on Ubuntu works.

@crucialfelix
Copy link

This error happens running Deno scripts on macos with M1. It's nothing to do with solidity per se.

@cameel
Copy link
Member

cameel commented Oct 19, 2022

Thanks for confirming @crucialfelix.

In that case I'm going to close this.

@cameel cameel closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2022
Solidity automation moved this from Triage to Done Oct 19, 2022
@cameel cameel removed the waiting for more input Issues waiting for more input by the reporter label Oct 19, 2022
@notVitaliy
Copy link

notVitaliy commented May 11, 2023

Solved

The issue

For those who find this and are still stuck with these intermittent errors. The issue (that I had) was that node was installed with x86 arch on an M2 Mac. The underlying issue is with Rosetta, which is used to translate between the x86 instructions to Apple silicon.

I encountered this particular problem where the integrated terminal in VSCode kept using Rosetta as the default option.

You can check the arch in your terminal.

$ node -e 'console.log(process.arch)'
// That will probably output x86

$ arch
// This will probably output i386

Steps to solve

If you're using brew, delete node entirely and install nvm

  • open up terminal (I use iTerm)
  • Run arch and make sure it's arm64
  • Switch to a different version of node (install it if you have to)
    • nvm install [OTHER VERSION OF NODE]
    • nvm use [OTHER VERSION OF NODE]
  • remove the previously used version of node
    • nvm uninstall [VERSION OF NODE YOU WANT]
    • nvm install [VERSION OF NODE YOU WANT]
    • nvm use [VERSION OF NODE YOU WANT]
    • nvm alias default [VERSION OF NODE YOU WANT]
  • open a new terminal window and check to make sure node -v returns the correct node version
  • check the output of node -e 'console.log(process.arch)'
    • it should now be arm64
  • don't forget to npm i -g truffle and any other global packages you use
  • ????
  • PROFIT

Steps to solve in VSCode

Add this into your settings.json

  "terminal.integrated.profiles.osx": {
    "bash": {
      "path": "arch",
      "args": ["-arm64", "bash", "-l"],
      "overrideName": true
    }
  },
  "terminal.integrated.defaultProfile.osx": "bash"

Thanks for listening to my TED Talk

@crucialfelix
Copy link

You can also run brew commands this way:

arch -arm64 brew upgrade

@pashuka
Copy link

pashuka commented May 7, 2024

If you have cpu m1/m2 y can use nodenv to install node with version you need. So, i made patch inside nodenv builder or inside bash script /usr/local/bin/node-build in the platform detector method:

#  arch="$(uname -m)"
  arch="arm64"

it work like a charm. compilation speed increased in 70% or more.

To install some special vesrion:

nodenv install 18.16.0
nodenv local 18.16.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Solidity
  
Done
Development

No branches or pull requests

7 participants