From a2e2b50e4f328dbbfb8ff52a9e54118a1491f9bd Mon Sep 17 00:00:00 2001 From: Peter Somogyvari Date: Mon, 22 May 2023 01:08:16 +0000 Subject: [PATCH] docs(weaver/samples): pin solc to v0.8.8 and turn off IR for Besu asset exchange 1. Without having it pinned to v0.8.8, some breaking changes that solc has snuck in [1][2] around v0.8.15 (for IR) are breaking the contract deployment in a way that opcodes end up in the migration contract's constructor that Besu does not recognize ("opcode INVALID" in the besu logs if you set the log level to "ALL") in the Besu logs and then sends back an "internal error" message via the JSON-RPC response, which is a bug IMO it should state that the user input was invalid (user input being the contract) 2. Disabled IR in the truffle (solc) config which is a step backwards because it's a new feature of the solidity compiler that has certain benefits to it compared to the legacy compilation mode, but enabling it breaks the build so it just had to be done. In the future if someone has time to do a deep dive on why exactly it's failing, then it should be re-enabled because having the legacy compilation mode being our default is technical debt that should be paid off rather sooner than later because we never know how it will come back to cause different issues later on. When IR is enabled, the following error occurs (even on the pinned v0.8.8 solc): > Compiling ./contracts/transferInterface.sol > YulException: Variable var_amount_3290 is 9 slot(s) too deep inside the stack. [1]: https://docs.soliditylang.org/en/v0.8.15/ir-breaking-changes.html#semantic-only-changes [2]: https://github.com/ethereum/solidity/issues/13311#issuecomment-1199274310 Fixes #2423 Signed-off-by: Peter Somogyvari --- weaver/tests/network-setups/besu/scripts/setupEthSigner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weaver/tests/network-setups/besu/scripts/setupEthSigner.sh b/weaver/tests/network-setups/besu/scripts/setupEthSigner.sh index fce4eedb68..9e6d58f4a2 100644 --- a/weaver/tests/network-setups/besu/scripts/setupEthSigner.sh +++ b/weaver/tests/network-setups/besu/scripts/setupEthSigner.sh @@ -19,7 +19,7 @@ touch keys/keyFile_${Node} # Without this, the npm install will fail because of conflicting dependency versions # that cannot be resolved properly unless "forced" (tested on Ubuntu 22.04) # FIXME: Eliminate the need to do an npm install out-of-bounds like this entirely. -# npm install --force web3 +npm install --force web3 node createKeyFile.js > keys/keyFile_${Node} rm createKeyFile.js cp ../artifacts/account.toml keys/