diff options
Diffstat (limited to 'scripts/bytecodecompare/prepare_report.py')
-rwxr-xr-x | scripts/bytecodecompare/prepare_report.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/scripts/bytecodecompare/prepare_report.py b/scripts/bytecodecompare/prepare_report.py index 68793927..5a770981 100755 --- a/scripts/bytecodecompare/prepare_report.py +++ b/scripts/bytecodecompare/prepare_report.py @@ -8,13 +8,17 @@ import json solc = sys.argv[1] report = open("report.txt", "w") -for f in sorted(glob.glob("*.sol")): - proc = subprocess.Popen([solc, '--combined-json', 'bin,metadata', f], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (out, err) = proc.communicate() - try: - result = json.loads(out.strip()) - for contractName in sorted(result['contracts'].keys()): - report.write(contractName + ' ' + result['contracts'][contractName]['bin'] + '\n') - report.write(contractName + ' ' + result['contracts'][contractName]['metadata'] + '\n') - except: - report.write(f + ": ERROR\n") +for optimize in [False, True]: + for f in sorted(glob.glob("*.sol")): + args = [solc, '--combined-json', 'bin,metadata', f] + if optimize: + args += ['--optimize'] + proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (out, err) = proc.communicate() + try: + result = json.loads(out.strip()) + for contractName in sorted(result['contracts'].keys()): + report.write(contractName + ' ' + result['contracts'][contractName]['bin'] + '\n') + report.write(contractName + ' ' + result['contracts'][contractName]['metadata'] + '\n') + except: + report.write(f + ": ERROR\n") |