@@ -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,44 @@ 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
+ if ( selectedContract . contract . object . evm . deployedBytecode . object . length > 24576 ) {
447
+ 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. <br>
448
+ More info: <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-170.md" target="_blank">eip-170</a>
449
+ </div>` ,
450
+ {
451
+ label : 'Force Send' ,
452
+ fn : ( ) => {
453
+ forceSend ( )
454
+ } } , {
455
+ label : 'Cancel' ,
456
+ fn : ( ) => {
457
+ self . _deps . logCallback ( `creation of ${ selectedContract . name } canceled by user.` )
458
+ }
459
+ } )
460
+ } else {
461
+ forceSend ( )
462
+ }
442
463
}
443
464
444
465
// ACCESS DEPLOYED INSTANCE
0 commit comments