mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-27 22:16:15 +00:00
fix: warn when contract bytecode too large for EVM
This commit is contained in:
parent
afe2512eff
commit
387d33a076
@ -3,6 +3,9 @@ let async = require('async');
|
||||
let utils = require('../../utils/utils.js');
|
||||
import { ZERO_ADDRESS } from '../../utils/addressUtils';
|
||||
|
||||
// Check out definition 97 of the yellow paper: https://ethereum.github.io/yellowpaper/paper.pdf
|
||||
const MAX_CONTRACT_BYTECODE_LENGTH = 24576;
|
||||
|
||||
class ContractDeployer {
|
||||
constructor(options) {
|
||||
this.logger = options.logger;
|
||||
@ -92,10 +95,18 @@ class ContractDeployer {
|
||||
}
|
||||
|
||||
async.waterfall([
|
||||
function requestBlockchainConnector(callback) {
|
||||
function checkContractBytesize(next) {
|
||||
if(contract.code.length > MAX_CONTRACT_BYTECODE_LENGTH) {
|
||||
return next(new Error(`Bytecode for ${contract.className} contract is too large. Not deploying.`));
|
||||
}
|
||||
|
||||
next();
|
||||
},
|
||||
|
||||
function requestBlockchainConnector(next) {
|
||||
self.events.request("blockchain:object", (blockchain) => {
|
||||
self.blockchain = blockchain;
|
||||
callback();
|
||||
next();
|
||||
});
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user