@@ -15,18 +15,31 @@ describe('Precompiles: MODEXP', () => {
1515 const addressStr = '0000000000000000000000000000000000000005'
1616 const MODEXP = getActivePrecompiles ( common ) . get ( addressStr ) !
1717
18- let n = 0
19- for ( const [ input , expect ] of fuzzerTests ) {
20- n ++
21- it ( `MODEXP edge cases (issue 3168) - case ${ n } ` , async ( ) => {
22- const result = await MODEXP ( {
23- data : hexToBytes ( input ) ,
24- gasLimit : BigInt ( 0xffff ) ,
25- common,
26- _EVM : evm ,
18+ it ( 'should run testdata' , async ( ) => {
19+ let n = 0
20+ for ( const [ input , expect ] of fuzzerTests ) {
21+ n ++
22+ it ( `MODEXP edge cases (issue 3168) - case ${ n } ` , async ( ) => {
23+ const result = await MODEXP ( {
24+ data : hexToBytes ( input ) ,
25+ gasLimit : BigInt ( 0xffff ) ,
26+ common,
27+ _EVM : evm ,
28+ } )
29+ const oput = bytesToHex ( result . returnValue )
30+ assert . equal ( oput , expect )
2731 } )
28- const oput = bytesToHex ( result . returnValue )
29- assert . equal ( oput , expect )
32+ }
33+ } )
34+
35+ it ( 'should correctly right-pad data if input length is too short' , async ( ) => {
36+ const gas = BigInt ( 0xffff )
37+ const result = await MODEXP ( {
38+ data : hexToBytes ( '0x41' ) ,
39+ gasLimit : gas ,
40+ common,
41+ _EVM : evm ,
3042 } )
31- }
43+ assert . ok ( result . executionGasUsed === gas )
44+ } )
3245} )
0 commit comments