-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Truffle and Hardhat with same compiler options compile different bytecode #3649
Comments
Hey, thanks for reporting this! Can you create a gist with a diff that shows where the bytecodes differ? It might help us see at a glance why this is happening (if you happen to still have both sets of bytecodes handy) |
Here the files with the two different bytecodes |
Here another example for a library: |
@Aleione I went to try and reproduce using the steps above but it seems there is no |
@eggplantzzz yes, it was merged in dev branch. This is the link of dev branch with smart contracts: https://gitlab.com/jarvis-network/apps/exchange/mono-repo/-/tree/dev/libs/contracts/contracts |
@Aleione just a quick question: do you know whether you are comparing the same type of bytecode? In the Truffle artifact you will find at least 2 bytecode-related fields: |
Hm, it can't be that -- all of these start with the delegatecall guard; that's only used in deployed bytecode for libraries. So these can't be constructor bytecode. |
@Aleione I'm trying to reproduce this problem, but I can't seem to clone the repo; I'm getting a permission denied error. How can I clone your repo? |
@Aleione OK, I just downloaded it as a zip file instead. Problem is, neither |
Oh hm, wonder if #5441 could be responsible here...? |
@Aleione are you still available to help @haltman-at with his question from above? We'd love to figure out what the cause is.
|
Closing for issue maintenance. @Aleione When you have the repro steps and if you're still running into this problem please feel free to re-open! Thanks. |
Issue
In the same repository i have set config file for truffle and hardhat. Compiler options (version, evm version, optimizer and runs) are the same. If i compare bytecode between truffle build folder and hardhat artifacts folder, for the same solidity contract, they are different. In this way we can not verify some contract with hardhat/etherscan since it can not detect the code deployed using truffle migration (since hardhat does not support migration). Other problem can be for developers that will use CREATE2 opcode in their solidity code.
Steps to Reproduce
You can reproduce it in this way:
clone code at this link: https://gitlab.com/jarvis-network/apps/exchange/mono-repo
move in branch: feature/uma-integration-part-2
yarn install
cd libs/contracts
yarn truffle compile
yarn hardhat compile
Expected Behavior
Same bytecode in artifacts folder (Truffle and Hardhat) for all contracts
Actual Results
There are differences in bytecode in some contracts (Ex. TICHelper, TICFactory, PerpetualLiquidatblePoolParty, PerpetualPoolPartyLib, PoolFactory, PoolLib)
Environment
truffle version
): 5.1.49node --version
): 14.9.0yarn --version
): 1.22.4The text was updated successfully, but these errors were encountered: