-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Backwards compatibility for bytecode comparison #10679
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
Backwards compatibility for bytecode comparison #10679
Conversation
6333cd8 to
a46f225
Compare
d0b3402 to
429c711
Compare
5f41135 to
27bdb4a
Compare
a46f225 to
0ff9a2b
Compare
27bdb4a to
b5951da
Compare
0ff9a2b to
6501925
Compare
b5951da to
eb081ad
Compare
6501925 to
998ee0c
Compare
eb081ad to
5e70dd1
Compare
249416c to
8769936
Compare
7f879cd to
8d34c08
Compare
8769936 to
83cd9dc
Compare
8d34c08 to
dd95291
Compare
a20f654 to
7d23c0d
Compare
dd95291 to
3b03bc7
Compare
08a20f4 to
087be9b
Compare
087be9b to
abdea8c
Compare
abdea8c to
6d3d6bf
Compare
|
#10676 has just been merged so I'm marking this a ready for review. |
hrkrshnn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good. I'll do one more review later.
| CONTRACT_SEPARATOR_PATTERN = re.compile(r'^ *======= +(?:(?P<file_name>.+) *:)? *(?P<contract_name>[^:]+) +======= *$', re.MULTILINE) | ||
| BYTECODE_REGEX = re.compile(r'^ *Binary: *\n(?P<bytecode>.*[0-9a-f$_]+.*)$', re.MULTILINE) | ||
| METADATA_REGEX = re.compile(r'^ *Metadata: *\n *(?P<metadata>\{.*\}) *$', re.MULTILINE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do these regex have to change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old regex was enough to handle the current output but in older versions there are some variations:
- File name is not present in the
=======header on 0.4.8 and earlier. - There are some minor differences in whitespace between versions. Not as big at the change in the regex would imply but I just made it handle extra whitespace in all reasonable places.
- On older versions bytecode or metadata sections in the output are sometimes empty. The original regex just assumes that the next line after the
Bytecode:contains the bytecode and it grabs the metadata header if that happens to be empty so I had to make it more strict.
There are test cases on sample output from 0.4.8 and 0.4.0 to make sure they're parsed correctly and also a synthetic case that checks what happens when the sections are empty or if there is extra whitespace.
…agma stripping and only disabling the SMT checker
…compiler versions
…bug in solc 0.6.0/0.6.1
… that do not support it - Before 0.4.3 the option was unavailable but ignored. - Between 0.4.3 and 0.4.6 an attempt to use that option causes an error.
…tion instead of failing - Our v0.4.11 release raises an exception on some LLL snippets containing returnlll (extracted from its end-to-end tests). - The report comparison will fail anyway because emscripten prints an abort code to stdout in that case but at least we'll be able to continue if we're comparing multiple versions.
6d3d6bf to
7bebcb7
Compare
Depends on #10676. Don't merge until that PR is merged!It's ondevelopnow.This is a set of workarounds for #10183, to make
prepare_report.pyandprepare_report.jswork with older versions of the compiler:--metadataoption was not supported. Up to 0.4.4 it was ignored but on 0.4.5 and 0.4.6 it cause an error so I added a step to detect that and prevent the script from using it.