From fe7cc2097b522f8fa21861a999cbd66f50d01fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 22 Dec 2020 02:09:12 +0100 Subject: [PATCH] prepare_report: Report missing metadata as well --- scripts/bytecodecompare/prepare_report.js | 7 ++++++- scripts/bytecodecompare/prepare_report.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/bytecodecompare/prepare_report.js b/scripts/bytecodecompare/prepare_report.js index 4ab98849f..99f3a4b4b 100755 --- a/scripts/bytecodecompare/prepare_report.js +++ b/scripts/bytecodecompare/prepare_report.js @@ -38,11 +38,16 @@ for (const optimize of [false, true]) const contractResults = result['contracts'][contractFile][contractName] let bytecode = 'NO BYTECODE' + let metadata = 'NO METADATA' + if ('evm' in contractResults && 'bytecode' in contractResults['evm'] && 'object' in contractResults['evm']['bytecode']) bytecode = contractResults.evm.bytecode.object + if ('metadata' in contractResults) + metadata = contractResults.metadata + console.log(filename + ':' + contractName + ' ' + bytecode) - console.log(filename + ':' + contractName + ' ' + contractResults['metadata']) + console.log(filename + ':' + contractName + ' ' + metadata) } } } diff --git a/scripts/bytecodecompare/prepare_report.py b/scripts/bytecodecompare/prepare_report.py index 792d4d59c..19d5b374e 100755 --- a/scripts/bytecodecompare/prepare_report.py +++ b/scripts/bytecodecompare/prepare_report.py @@ -40,7 +40,7 @@ for optimize in [False, True]: for filename in sorted(result['contracts'].keys()): for contractName in sorted(result['contracts'][filename].keys()): bytecode = result['contracts'][filename][contractName].get('evm', {}).get('bytecode', {}).get('object', 'NO BYTECODE') - metadata = result['contracts'][filename][contractName]['metadata'] + metadata = result['contracts'][filename][contractName].get('metadata', 'NO METADATA') REPORT_FILE.write(filename + ':' + contractName + ' ' + bytecode + '\n') REPORT_FILE.write(filename + ':' + contractName + ' ' + metadata + '\n')