File tree Expand file tree Collapse file tree
framework/src/test/java/org/tron/common/runtime/vm Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package org .tron .common .runtime .vm ;
2+
3+ import lombok .extern .slf4j .Slf4j ;
4+ import org .junit .Assert ;
5+ import org .junit .Test ;
6+ import org .tron .common .utils .ByteUtil ;
7+ import org .tron .core .vm .PrecompiledContracts ;
8+ import org .tron .core .vm .config .ConfigLoader ;
9+ import org .tron .core .vm .config .VMConfig ;
10+ import org .tron .core .vm .program .Program ;
11+
12+ @ Slf4j
13+ public class AllowTvmOsakaTest extends VMTestBase {
14+
15+ @ Test
16+ public void testEIP7823 () {
17+ ConfigLoader .disable = true ;
18+ VMConfig .initAllowTvmOsaka (1 );
19+
20+ byte [] baseLen = new byte [32 ];
21+ byte [] expLen = new byte [32 ];
22+ byte [] modLen = new byte [32 ];
23+
24+ PrecompiledContracts .PrecompiledContract modExp = new PrecompiledContracts .ModExp ();
25+
26+ // Valid lens
27+ try {
28+ modExp .execute (ByteUtil .merge (baseLen , expLen , modLen ));
29+ } catch (Exception e ) {
30+ Assert .fail ();
31+ }
32+
33+ // Invalid lens
34+ try {
35+ baseLen [0 ] = 0x01 ;
36+ modExp .execute (ByteUtil .merge (baseLen , expLen , modLen ));
37+ } catch (Exception e ) {
38+ Assert .assertTrue (e instanceof Program .PrecompiledContractException );
39+ return ;
40+ } finally {
41+ VMConfig .initAllowTvmOsaka (0 );
42+ ConfigLoader .disable = false ;
43+ }
44+
45+ Assert .fail ();
46+ }
47+ }
You can’t perform that action at this time.
0 commit comments