@@ -18,6 +18,7 @@ var Recorder = require('../../recorder')
18
18
var addTooltip = require ( '../ui/tooltip' )
19
19
var css = require ( './styles/run-tab-styles' )
20
20
var MultiParamManager = require ( '../../multiParamManager' )
21
+ var modalDialog = require ( '../ui/modaldialog' )
21
22
22
23
function runTab ( opts , localRegistry ) {
23
24
/* -------------------------
@@ -421,24 +422,43 @@ function contractDropdown (events, self) {
421
422
return
422
423
}
423
424
424
- var constructor = txHelper . getConstructorInterface ( selectedContract . contract . object . abi )
425
- self . _deps . filePanel . compilerMetadata ( ) . metadataOf ( selectedContract . name , ( error , contractMetadata ) => {
426
- if ( error ) return self . _deps . logCallback ( `creation of ${ selectedContract . name } errored: ` + error )
427
- if ( contractMetadata . autoDeployLib ) {
428
- txFormat . buildData ( selectedContract . name , selectedContract . contract . object , self . _deps . compiler . getContracts ( ) , true , constructor , args , ( error , data ) => {
429
- createInstanceCallback ( error , selectedContract , data )
430
- } , ( msg ) => {
431
- self . _deps . logCallback ( msg )
432
- } , ( data , runTxCallback ) => {
433
- // called for libraries deployment
434
- self . _deps . udapp . runTx ( data , runTxCallback )
435
- } )
436
- } else {
437
- txFormat . encodeConstructorCallAndLinkLibraries ( selectedContract . contract . object , args , constructor , contractMetadata . linkReferences , selectedContract . contract . object . evm . bytecode . linkReferences , ( error , data ) => {
438
- createInstanceCallback ( error , selectedContract , data )
439
- } )
440
- }
441
- } )
425
+ var forceSend = ( ) => {
426
+ var constructor = txHelper . getConstructorInterface ( selectedContract . contract . object . abi )
427
+ self . _deps . filePanel . compilerMetadata ( ) . metadataOf ( selectedContract . name , ( error , contractMetadata ) => {
428
+ if ( error ) return self . _deps . logCallback ( `creation of ${ selectedContract . name } errored: ` + error )
429
+ if ( contractMetadata . autoDeployLib ) {
430
+ txFormat . buildData ( selectedContract . name , selectedContract . contract . object , self . _deps . compiler . getContracts ( ) , true , constructor , args , ( error , data ) => {
431
+ createInstanceCallback ( error , selectedContract , data )
432
+ } , ( msg ) => {
433
+ self . _deps . logCallback ( msg )
434
+ } , ( data , runTxCallback ) => {
435
+ // called for libraries deployment
436
+ self . _deps . udapp . runTx ( data , runTxCallback )
437
+ } )
438
+ } else {
439
+ txFormat . encodeConstructorCallAndLinkLibraries ( selectedContract . contract . object , args , constructor , contractMetadata . linkReferences , selectedContract . contract . object . evm . bytecode . linkReferences , ( error , data ) => {
440
+ createInstanceCallback ( error , selectedContract , data )
441
+ } )
442
+ }
443
+ } )
444
+ }
445
+
446
+ // check contract code size limit. Refs: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-170.md
447
+ if ( selectedContract . contract . object . evm . deployedBytecode . object . length > 24576 ) {
448
+ modalDialog ( 'Contract code size over limit' , yo `<div>Contract creation initialization returns data with length of more than 24576 bytes. The deployment will likely fails.</div>` ,
449
+ {
450
+ label : 'Force Send' ,
451
+ fn : ( ) => {
452
+ forceSend ( )
453
+ } } , {
454
+ label : 'Cancel' ,
455
+ fn : ( ) => {
456
+ self . _deps . logCallback ( `creation of ${ selectedContract . name } canceled by user.` )
457
+ }
458
+ } )
459
+ } else {
460
+ forceSend ( )
461
+ }
442
462
}
443
463
444
464
// ACCESS DEPLOYED INSTANCE
0 commit comments