@@ -596,61 +596,3 @@ tape('Loading Legacy Versions', function (t) {
596596 } ) ;
597597 } ) ;
598598} ) ;
599-
600- tape ( 'Linking' , function ( t ) {
601- t . test ( 'link properly' , function ( st ) {
602- /*
603- 'lib.sol': 'library L { function f() public returns (uint) { return 7; } }',
604- 'cont.sol': 'import "lib.sol"; contract x { function g() public { L.f(); } }'
605- */
606- var bytecode = '608060405234801561001057600080fd5b5061011f806100206000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063e2179b8e146044575b600080fd5b348015604f57600080fd5b5060566058565b005b73__lib.sol:L_____________________________6326121ff06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801560b757600080fd5b505af415801560ca573d6000803e3d6000fd5b505050506040513d602081101560df57600080fd5b8101908080519060200190929190505050505600a165627a7a72305820ea2f6353179c181d7162544d637b7fe2d9e8da9803a0e2d9eafc2188d1d59ee30029' ;
607- bytecode = linker . linkBytecode ( bytecode , { 'lib.sol:L' : '0x123456' } ) ;
608- st . ok ( bytecode . indexOf ( '_' ) < 0 ) ;
609- st . end ( ) ;
610- } ) ;
611-
612- t . test ( 'link properly with two-level configuration (from standard JSON)' , function ( st ) {
613- /*
614- 'lib.sol': 'library L { function f() public returns (uint) { return 7; } }',
615- 'cont.sol': 'import "lib.sol"; contract x { function g() public { L.f(); } }'
616- */
617- var bytecode = '608060405234801561001057600080fd5b5061011f806100206000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063e2179b8e146044575b600080fd5b348015604f57600080fd5b5060566058565b005b73__lib.sol:L_____________________________6326121ff06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801560b757600080fd5b505af415801560ca573d6000803e3d6000fd5b505050506040513d602081101560df57600080fd5b8101908080519060200190929190505050505600a165627a7a72305820ea2f6353179c181d7162544d637b7fe2d9e8da9803a0e2d9eafc2188d1d59ee30029' ;
618- bytecode = linker . linkBytecode ( bytecode , { 'lib.sol' : { 'L' : '0x123456' } } ) ;
619- st . ok ( bytecode . indexOf ( '_' ) < 0 ) ;
620- st . end ( ) ;
621- } ) ;
622-
623- t . test ( 'linker to fail with missing library' , function ( st ) {
624- /*
625- 'lib.sol': 'library L { function f() public returns (uint) { return 7; } }',
626- 'cont.sol': 'import "lib.sol"; contract x { function g() public { L.f(); } }'
627- */
628- var bytecode = '608060405234801561001057600080fd5b5061011f806100206000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063e2179b8e146044575b600080fd5b348015604f57600080fd5b5060566058565b005b73__lib.sol:L_____________________________6326121ff06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801560b757600080fd5b505af415801560ca573d6000803e3d6000fd5b505050506040513d602081101560df57600080fd5b8101908080519060200190929190505050505600a165627a7a72305820ea2f6353179c181d7162544d637b7fe2d9e8da9803a0e2d9eafc2188d1d59ee30029' ;
629- bytecode = linker . linkBytecode ( bytecode , { } ) ;
630- st . ok ( bytecode . indexOf ( '_' ) >= 0 ) ;
631- st . end ( ) ;
632- } ) ;
633-
634- t . test ( 'linker to fail with invalid address' , function ( st ) {
635- /*
636- 'lib.sol': 'library L { function f() public returns (uint) { return 7; } }',
637- 'cont.sol': 'import "lib.sol"; contract x { function g() public { L.f(); } }'
638- */
639- var bytecode = '608060405234801561001057600080fd5b5061011f806100206000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063e2179b8e146044575b600080fd5b348015604f57600080fd5b5060566058565b005b73__lib.sol:L_____________________________6326121ff06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801560b757600080fd5b505af415801560ca573d6000803e3d6000fd5b505050506040513d602081101560df57600080fd5b8101908080519060200190929190505050505600a165627a7a72305820ea2f6353179c181d7162544d637b7fe2d9e8da9803a0e2d9eafc2188d1d59ee30029' ;
640- st . throws ( function ( ) {
641- linker . linkBytecode ( bytecode , { 'lib.sol:L' : '' } ) ;
642- } ) ;
643- st . end ( ) ;
644- } ) ;
645-
646- t . test ( 'linker properly with truncated library name' , function ( st ) {
647- /*
648- 'lib.sol': 'library L1234567890123456789012345678901234567890 { function f() public returns (uint) { return 7; } }',
649- 'cont.sol': 'import "lib.sol"; contract x { function g() public { L1234567890123456789012345678901234567890.f(); } }'
650- */
651- var bytecode = '608060405234801561001057600080fd5b5061011f806100206000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063e2179b8e146044575b600080fd5b348015604f57600080fd5b5060566058565b005b73__lib.sol:L123456789012345678901234567__6326121ff06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801560b757600080fd5b505af415801560ca573d6000803e3d6000fd5b505050506040513d602081101560df57600080fd5b8101908080519060200190929190505050505600a165627a7a723058209f88ff686bd8ceb0fc08853dc1332d5ff81dbcf5af3a1e9aa366828091761f8c0029' ;
652- bytecode = linker . linkBytecode ( bytecode , { 'lib.sol:L1234567890123456789012345678901234567890' : '0x123456' } ) ;
653- st . ok ( bytecode . indexOf ( '_' ) < 0 ) ;
654- st . end ( ) ;
655- } ) ;
656- } ) ;
0 commit comments