Skip to content

Commit

Permalink
fix(@embark/deployment): don't break when using abiDefinitions
Browse files Browse the repository at this point in the history
In #1119 we've introduced a feature where
users can provide an already compiled ABI for Smart Contracts so they can be used
without the need to compiling them again.

This also means that, internally, those Smart Contract object won't have any
bytecode attached to it.

Later on, in 387d33a,  we've introduced a warning
which is rendered when a Smart Contract's bytecode is too large. The check expects
a Smart Contract object to have bytecode associated to it, which will break the code
in cases where a Smart Contract has already an ABI and therefore didn't need compilation.

This commit ensures we only check a Smart Contract's bytecode when bytecode exists for
the Smart Contract in question.
  • Loading branch information
0x-r4bbit committed Jun 19, 2019
1 parent e288483 commit 9e5c9c7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/embark-deployment/src/contract_deployer.js
Expand Up @@ -96,6 +96,10 @@ class ContractDeployer {

async.waterfall([
function checkContractBytesize(next) {
if (!contract.code) {
return next();
}

const code = (contract.code.indexOf('0x') === 0) ? contract.code.substr(2) : contract.code;
const contractCodeLength = Buffer.from(code, 'hex').toString().length;
if(contractCodeLength > MAX_CONTRACT_BYTECODE_LENGTH) {
Expand Down

0 comments on commit 9e5c9c7

Please sign in to comment.