@@ -28,26 +28,26 @@ class Injector {
28
28
29
29
_getHash ( id ) {
30
30
this . hashCounter ++ ;
31
- return web3Utils . keccak256 ( `${ id } :${ this . hashCounter } ` ) ;
31
+ return web3Utils . keccak256 ( `${ id } :${ this . hashCounter } ` ) . slice ( 0 , 18 ) ;
32
32
}
33
33
34
34
// Method returns void
35
35
_getDefaultMethodIdentifier ( id ) {
36
- return `c_${ web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) } `
36
+ return `c_${ web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) } `
37
37
}
38
38
39
39
// Method returns boolean: true
40
40
_getTrueMethodIdentifier ( id ) {
41
- return `c_true${ web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) } `
41
+ return `c_true${ web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) } `
42
42
}
43
43
44
44
// Method returns boolean: false
45
45
_getFalseMethodIdentifier ( id ) {
46
- return `c_false${ web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) } `
46
+ return `c_false${ web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) } `
47
47
}
48
48
49
49
_getModifierIdentifier ( id ) {
50
- return `c_mod${ web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) } `
50
+ return `c_mod${ web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) } `
51
51
}
52
52
53
53
_getInjectionComponents ( contract , injectionPoint , id , type ) {
@@ -70,9 +70,9 @@ class Injector {
70
70
* @return {String }
71
71
*/
72
72
_getDefaultMethodDefinition ( id ) {
73
- const hash = web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) ;
73
+ const hash = web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) ;
74
74
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` ;
76
76
}
77
77
78
78
/**
@@ -82,9 +82,9 @@ class Injector {
82
82
* @return {String }
83
83
*/
84
84
_getFileScopedHashMethodDefinition ( id , contract ) {
85
- const hash = web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) ;
85
+ const hash = web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) ;
86
86
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` ;
88
88
}
89
89
90
90
/**
@@ -94,9 +94,9 @@ class Injector {
94
94
* @return {String } ex: bytes32[1] memory _sc_82e0891
95
95
*/
96
96
_getTrueMethodDefinition ( id ) {
97
- const hash = web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) ;
97
+ const hash = web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) ;
98
98
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` ;
100
100
}
101
101
102
102
/**
@@ -106,9 +106,9 @@ class Injector {
106
106
* @return {String } ex: bytes32[1] memory _sc_82e0891
107
107
*/
108
108
_getFalseMethodDefinition ( id ) {
109
- const hash = web3Utils . keccak256 ( id ) . slice ( 0 , 10 ) ;
109
+ const hash = web3Utils . keccak256 ( id ) . slice ( 2 , 10 ) ;
110
110
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` ;
112
112
}
113
113
114
114
_getModifierDefinitions ( contractId , instrumentation ) {
0 commit comments