@@ -249,6 +249,18 @@ public Deposit getDeposit() {
249249 public ProgramResult getResult () {
250250 return result ;
251251 }
252+
253+ public boolean isRootCallConstant () {
254+ return isRootCallConstant ;
255+ }
256+
257+ public void setRootCallConstant (boolean rootCallConstant ) {
258+ isRootCallConstant = rootCallConstant ;
259+ }
260+
261+ private boolean isRootCallConstant ;
262+
263+
252264 }
253265
254266 public static class Identity extends PrecompiledContract {
@@ -689,6 +701,9 @@ public long getEnergyForData(byte[] data) {
689701 @ Override
690702 public Pair <Boolean , byte []> execute (byte [] data ) {
691703
704+ if (isRootCallConstant ()){
705+ return Pair .of (true , new DataWord (0 ).getData ());
706+ }
692707 if (data == null || data .length != 2 * DataWord .DATAWORD_UNIT_SIZE ) {
693708 return Pair .of (false , new DataWord (0 ).getData ());
694709 }
@@ -872,6 +887,10 @@ public long getEnergyForData(byte[] data) {
872887 @ Override
873888 public Pair <Boolean , byte []> execute (byte [] data ) {
874889
890+ if (isRootCallConstant ()){
891+ return Pair .of (true , new DataWord (0 ).getData ());
892+ }
893+
875894 if (data == null ) {
876895 data = EMPTY_BYTE_ARRAY ;
877896 }
@@ -925,6 +944,10 @@ public long getEnergyForData(byte[] data) {
925944 @ Override
926945 public Pair <Boolean , byte []> execute (byte [] data ) {
927946
947+ if (isRootCallConstant ()){
948+ return Pair .of (true , new DataWord (0 ).getData ());
949+ }
950+
928951 if (data == null || data .length != 2 * DataWord .DATAWORD_UNIT_SIZE ) {
929952 return Pair .of (false , new DataWord (0 ).getData ());
930953 }
@@ -985,6 +1008,10 @@ public long getEnergyForData(byte[] data) {
9851008 @ Override
9861009 public Pair <Boolean , byte []> execute (byte [] data ) {
9871010
1011+ if (isRootCallConstant ()){
1012+ return Pair .of (true , new DataWord (0 ).getData ());
1013+ }
1014+
9881015 if (data == null || data .length == 0 || (data .length % (2 * DataWord .DATAWORD_UNIT_SIZE ) != 0 )) {
9891016 return Pair .of (false , new DataWord (0 ).getData ());
9901017 }
@@ -1051,6 +1078,10 @@ public long getEnergyForData(byte[] data) {
10511078 @ Override
10521079 public Pair <Boolean , byte []> execute (byte [] data ) {
10531080
1081+ if (isRootCallConstant ()){
1082+ return Pair .of (true , new DataWord (0 ).getData ());
1083+ }
1084+
10541085 if (data == null || data .length != DataWord .DATAWORD_UNIT_SIZE ) {
10551086 return Pair .of (false , new DataWord (0 ).getData ());
10561087 }
@@ -1161,6 +1192,10 @@ public long getEnergyForData(byte[] data) {
11611192 @ Override
11621193 public Pair <Boolean , byte []> execute (byte [] data ) {
11631194
1195+ if (isRootCallConstant ()){
1196+ return Pair .of (true , new DataWord (0 ).getData ());
1197+ }
1198+
11641199 if (data == null || (data .length <= DataWord .DATAWORD_UNIT_SIZE * 2 || data .length > DataWord .DATAWORD_UNIT_SIZE * 3 )) {
11651200 return Pair .of (false , new DataWord (0 ).getData ());
11661201 }
0 commit comments