diff options
author | chriseth <chris@ethereum.org> | 2018-11-06 22:14:44 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-11-13 21:57:31 +0800 |
commit | 6ed3765941c4418881a6842f58ea1123a9c54738 (patch) | |
tree | 4589408e550b39af968ab267bc82e38f72a9b0bd /scripts/bytecodecompare | |
parent | 28d98d61ef5484a3c7e8edc75f99d02b6a8ff2ed (diff) | |
download | dexon-solidity-6ed3765941c4418881a6842f58ea1123a9c54738.tar.gz dexon-solidity-6ed3765941c4418881a6842f58ea1123a9c54738.tar.zst dexon-solidity-6ed3765941c4418881a6842f58ea1123a9c54738.zip |
Fix bytecode tests for solc-js
Diffstat (limited to 'scripts/bytecodecompare')
-rwxr-xr-x | scripts/bytecodecompare/storebytecode.sh | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/scripts/bytecodecompare/storebytecode.sh b/scripts/bytecodecompare/storebytecode.sh index 89a669bd..ccf6e60e 100755 --- a/scripts/bytecodecompare/storebytecode.sh +++ b/scripts/bytecodecompare/storebytecode.sh @@ -41,14 +41,15 @@ TMPDIR=$(mktemp -d) if [[ "$SOLC_EMSCRIPTEN" = "On" ]] then # npm install solc - git clone --depth 1 https://github.com/ethereum/solc-js.git solc - cp "$REPO_ROOT/build/libsolc/soljson.js" . + git clone --depth 1 https://github.com/ethereum/solc-js.git solc-js + ( cd solc-js; npm install ) + cp "$REPO_ROOT/build/libsolc/soljson.js" solc-js/ cat > solc <<EOF #!/usr/bin/env node var process = require('process') var fs = require('fs') -var compiler = require('solc/wrapper.js')(require('./soljson.js')) +var compiler = require('./solc-js/wrapper.js')(require('./solc-js/soljson.js')) for (var optimize of [false, true]) { @@ -58,7 +59,15 @@ for (var optimize of [false, true]) { var inputs = {} inputs[filename] = fs.readFileSync(filename).toString() - var result = compiler.compile({sources: inputs}, optimize) + var input = { + language: 'Solidity', + sources: inputs, + settings: { + optimizer: { enabled: optimize }, + outputSelection: { '*': { '*': ['evm.bytecode.object', 'metadata'] } } + } + } + var result = JSON.parse(compiler.compile(JSON.stringify(input))) if (!('contracts' in result) || Object.keys(result['contracts']).length === 0) { console.log(filename + ': ERROR') @@ -67,7 +76,7 @@ for (var optimize of [false, true]) { for (var contractName in result['contracts']) { - console.log(contractName + ' ' + result['contracts'][contractName].bytecode) + console.log(contractName + ' ' + result['contracts'][contractName].evm.bytecode.object) console.log(contractName + ' ' + result['contracts'][contractName].metadata) } } |