fix: contract length check now checks the correct thing

This commit is contained in:
Andre Medeiros 2019-02-22 16:48:41 -05:00 committed by Iuri Matias
parent 10f6b6bcdb
commit a295a5bff5
1 changed files with 3 additions and 1 deletions

View File

@ -96,7 +96,9 @@ class ContractDeployer {
async.waterfall([
function checkContractBytesize(next) {
if(contract.code.length > MAX_CONTRACT_BYTECODE_LENGTH) {
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) {
return next(new Error(`Bytecode for ${contract.className} contract is too large. Not deploying.`));
}