-
Notifications
You must be signed in to change notification settings - Fork 326
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
hevm: invalid character at offset #802
Comments
can you upload and send over a link to your repo? hard to debug without any info |
Er sorry, I just tracked it down the minimal reproduction: https://github.com/shazow/dapptools-bug-repro
Looks like the test runner doesn't like these lines ( function cmp(string calldata a, string calldata b) pure public returns (bool) {
return keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b));
} |
Thanks for the quick fix! |
I confirmed the fix did work for the minimal reproduction, but unfortunately the error still exists in my larger contract repo. The full thing is here: https://github.com/NonFungibleSequences/memenumbers-contract
|
You have library linking disabled in your Commenting out that line fixes the issue for me. |
Aha good find! Thank you. This was all part of this template repo: https://github.com/gakonst/dapptools-template/blob/master/.dapprc |
The library linking procedure is a little crude, and sometimes ends up deploying libraries that aren't needed (if e.g. all library methods are marked as btw, you can save gas and avoid the need for the linking step by marking |
@d-xo Thanks for the tips! This is all just rough brainstorming/sketch ideas, probably going to avoid doing cmp the way it is now anyway and instead compare the first byte which in my case is sufficient. Will definitely use internal for the reasons you mentioned, thanks again! |
Could we make this error message less opaque to help out future users? “Invalid character at offset” is about as generic as it gets lolol |
Yeah for sure. We would need to scan for unresolved linker references in the bytecode and error out with a nice message if we try to deploy code with holes. |
Sounds complex heh. Wdyt about just overriding the error with a hint like Even though this may be unhelpful sometimes still better than nothing? |
@transmissions11 it was fairly simple to detect the linker holes with a regex, implemented in #816. |
Hiya, I'm just giving dapptools a try, I wrote a basic contract and some tests. I have my nix shell pinned at the
hevm/0.48.1
tag.I'm getting a difficult-to-understand/debug error, is this something I'm doing wrong?
I'm guessing this is some problem with my code [edit: though the offset doesn't seem to change if I add more code to the contract/tests], so I guess this is a request to produce a more actionable error if possible. :)
Would also appreciate any tips for how to debug this productively.
Versions:
Full output:
The text was updated successfully, but these errors were encountered: