@@ -28,26 +28,26 @@ class Injector {
2828
2929 _getHash ( id ) {
3030 this . hashCounter ++ ;
31- return web3Utils . keccak256 ( `${ id } :${ this . hashCounter } ` ) ;
31+ return web3Utils . keccak256 ( `${ id } :${ this . hashCounter } ` ) . slice ( 0 , 18 ) ;
3232 }
3333
3434 // Method returns void
3535 _getDefaultMethodIdentifier ( id ) {
36- return `c_${ web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) } `
36+ return `c_${ web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) } `
3737 }
3838
3939 // Method returns boolean: true
4040 _getTrueMethodIdentifier ( id ) {
41- return `c_true${ web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) } `
41+ return `c_true${ web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) } `
4242 }
4343
4444 // Method returns boolean: false
4545 _getFalseMethodIdentifier ( id ) {
46- return `c_false${ web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) } `
46+ return `c_false${ web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) } `
4747 }
4848
4949 _getModifierIdentifier ( id ) {
50- return `c_mod${ web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) } `
50+ return `c_mod${ web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) } `
5151 }
5252
5353 _getInjectionComponents ( contract , injectionPoint , id , type ) {
@@ -70,9 +70,9 @@ class Injector {
7070 * @return {String }
7171 */
7272 _getDefaultMethodDefinition ( id ) {
73- const hash = web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) ;
73+ const hash = web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) ;
7474 const method = this . _getMethodIdentifier ( id ) ;
75- return `\nfunction ${ method } (bytes32 c__${ hash } ) internal pure {}\n` ;
75+ return `\nfunction ${ method } (bytes8 c__${ hash } ) internal pure {}\n` ;
7676 }
7777
7878 /**
@@ -82,9 +82,9 @@ class Injector {
8282 * @return {String }
8383 */
8484 _getFileScopedHashMethodDefinition ( id , contract ) {
85- const hash = web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) ;
85+ const hash = web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) ;
8686 const method = this . _getDefaultMethodIdentifier ( id ) ;
87- return `\nfunction ${ method } (bytes32 c__${ hash } ) public pure {}\n` ;
87+ return `\nfunction ${ method } (bytes8 c__${ hash } ) public pure {}\n` ;
8888 }
8989
9090 /**
@@ -94,9 +94,9 @@ class Injector {
9494 * @return {String } ex: bytes32[1] memory _sc_82e0891
9595 */
9696 _getTrueMethodDefinition ( id ) {
97- const hash = web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) ;
97+ const hash = web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) ;
9898 const method = this . _getTrueMethodIdentifier ( id ) ;
99- return `function ${ method } (bytes32 c__${ hash } ) public pure returns (bool){ return true; }\n` ;
99+ return `function ${ method } (bytes8 c__${ hash } ) public pure returns (bool){ return true; }\n` ;
100100 }
101101
102102 /**
@@ -106,9 +106,9 @@ class Injector {
106106 * @return {String } ex: bytes32[1] memory _sc_82e0891
107107 */
108108 _getFalseMethodDefinition ( id ) {
109- const hash = web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) ;
109+ const hash = web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) ;
110110 const method = this . _getFalseMethodIdentifier ( id ) ;
111- return `function ${ method } (bytes32 c__${ hash } ) public pure returns (bool){ return false; }\n` ;
111+ return `function ${ method } (bytes8 c__${ hash } ) public pure returns (bool){ return false; }\n` ;
112112 }
113113
114114 _getModifierDefinitions ( contractId , instrumentation ) {
0 commit comments