0xProject / 0x-monorepo

0x protocol monorepo - includes our smart contracts and many developer tools
Other
1.41k stars 466 forks source link

sol-coverage: Unable to find matching bytecode for contract address #2088

Closed PaulRBerg closed 5 years ago

PaulRBerg commented 5 years ago

Expected Behavior

Bytecode should be matched.

Current Behavior

Bytecode is not matched and a bunch of errors are thrown.

Unable to find matching bytecode for contract creation 0x6080604052348015...6c634300050a0032, please check your artifacts. Ignoring...
Unable to find matching bytecode for contract address 0x3ef8de997c38fc21cce9b1825bcc306eef465aa9, please check your artifacts. Ignoring...
Unable to find matching bytecode for contract address 0x3ef8de997c38fc21cce9b1825bcc306eef465aa9, please check your artifacts. Ignoring...
Unable to find matching bytecode for contract address 0x3ef8de997c38fc21cce9b1825bcc306eef465aa9, please check your artifacts. Ignoring...

Possible Solution

I surmise that there's something wrong with the bridge to truffle.

Steps to Reproduce (for bugs)

1. Clone `git@github.com:sablierhq/sablier.git`
2. Switch to the `wip/payroll` branch
3. Run `yarn install` and `yarn watch`
4. Go to `packages/payroll`
5. Run converage via `yarn coverage`

Context

I'm trying to cover my contracts with sol-coverage in a truffle project which I configured using the dev-tools-truffle-example repo.

The weird thing is that despite the errors, the coverage gets generated correctly (or at least I hope so).

Your Environment

Package Version
@0x/sol-coverage 3.0.9
@0x/sol-profiler 3.1.11
@0x/sol-trace 2.0.17
@0x/subproviders 5.0.1
truffle 5.0.32
Network
ganache
PaulRBerg commented 5 years ago

My truffle config was slightly out of date, due to https://github.com/0xProject/dev-tools-truffle-example/pull/14

But even after applying the patch, I get the same behaviour.

PaulRBerg commented 5 years ago

Okay, so I went deep down the rabbit hole. It seems that the specific issue is that the value returned by this._web3Wrapper.getContractCodeAsync(subcallAddress) does NOT match the bytecode of the artifacts found in the 0x-artifacts folder.

I suspect that there is something wrong with TruffleArtifactAdapter, as the logs printed during coverage indicate that some truffle artifacts get built in a temporary folder on my Mac (in /var).

PaulRBerg commented 5 years ago

It turns out this is an issue with "sol-compiler". Closing this in favour of #2094.