|
44 | 44 | import org.tron.common.crypto.zksnark.BN128G2; |
45 | 45 | import org.tron.common.crypto.zksnark.Fp; |
46 | 46 | import org.tron.common.crypto.zksnark.PairingCheck; |
| 47 | +import org.tron.common.runtime.vm.program.Program; |
| 48 | +import org.tron.common.runtime.vm.program.Program.PrecompiledContractException; |
47 | 49 | import org.tron.common.runtime.vm.program.ProgramResult; |
48 | 50 | import org.tron.common.storage.Deposit; |
49 | 51 | import org.tron.common.utils.BIUtil; |
@@ -714,13 +716,15 @@ public Pair<Boolean, byte[]> execute(byte[] data) { |
714 | 716 | } catch (ContractExeException e) { |
715 | 717 | logger.debug("ContractExeException when calling voteWitness in vm"); |
716 | 718 | logger.debug("ContractExeException: {}", e.getMessage()); |
717 | | - return null; |
| 719 | + this.getResult().setException(new Program.Exception().contractExecuteException(e)); |
| 720 | + return Pair.of(false, new DataWord(0).getData()); |
718 | 721 | } catch (ContractValidateException e) { |
719 | 722 | logger.debug("ContractValidateException when calling voteWitness in vm"); |
720 | 723 | logger.debug("ContractValidateException: {}", e.getMessage()); |
721 | | - return null; |
| 724 | + this.getResult().setException(new Program.Exception().contractValidateException(e)); |
| 725 | + return Pair.of(false, new DataWord(0).getData()); |
722 | 726 | } |
723 | | - return Pair.of(true, new DataWord(count).getData()); |
| 727 | + return Pair.of(true, new DataWord(1).getData()); |
724 | 728 | } |
725 | 729 | } |
726 | 730 |
|
@@ -886,11 +890,13 @@ public Pair<Boolean, byte[]> execute(byte[] data) { |
886 | 890 | } catch (ContractExeException e) { |
887 | 891 | logger.debug("ContractExeException when calling withdrawBalanceNative in vm"); |
888 | 892 | logger.debug("ContractExeException: {}", e.getMessage()); |
889 | | - return null; |
| 893 | + this.getResult().setException(new Program.Exception().contractExecuteException(e)); |
| 894 | + return Pair.of(false, new DataWord(0).getData()); |
890 | 895 | } catch (ContractValidateException e) { |
891 | 896 | logger.debug("ContractValidateException when calling withdrawBalanceNative in vm"); |
892 | 897 | logger.debug("ContractValidateException: {}", e.getMessage()); |
893 | | - return null; |
| 898 | + this.getResult().setException(new Program.Exception().contractValidateException(e)); |
| 899 | + return Pair.of(false, new DataWord(0).getData()); |
894 | 900 | } |
895 | 901 | return Pair.of(true, new DataWord(1).getData()); |
896 | 902 | } |
@@ -944,7 +950,8 @@ public Pair<Boolean, byte[]> execute(byte[] data) { |
944 | 950 | } catch (ContractExeException e) { |
945 | 951 | logger.debug("ContractExeException when calling proposalApproveNative in vm"); |
946 | 952 | logger.debug("ContractExeException: {}", e.getMessage()); |
947 | | - return null; |
| 953 | + this.getResult().setException(new Program.Exception().contractExecuteException(e)); |
| 954 | + return Pair.of(false, new DataWord(0).getData()); |
948 | 955 | } catch (ContractValidateException e) { |
949 | 956 | logger.debug("ContractValidateException when calling proposalApproveNative in vm"); |
950 | 957 | logger.debug("ContractValidateException: {}", e.getMessage()); |
@@ -1009,11 +1016,13 @@ public Pair<Boolean, byte[]> execute(byte[] data) { |
1009 | 1016 | } catch (ContractExeException e) { |
1010 | 1017 | logger.debug("ContractExeException when calling proposalCreateNative in vm"); |
1011 | 1018 | logger.debug("ContractExeException: {}", e.getMessage()); |
1012 | | - return null; |
| 1019 | + this.getResult().setException(new Program.Exception().contractExecuteException(e)); |
| 1020 | + return Pair.of(false, new DataWord(0).getData()); |
1013 | 1021 | } catch (ContractValidateException e) { |
1014 | 1022 | logger.debug("ContractValidateException when calling proposalCreateNative in vm"); |
1015 | 1023 | logger.debug("ContractValidateException: {}", e.getMessage()); |
1016 | | - return null; |
| 1024 | + this.getResult().setException(new Program.Exception().contractValidateException(e)); |
| 1025 | + return Pair.of(false, new DataWord(0).getData()); |
1017 | 1026 | } |
1018 | 1027 | return Pair.of(true, new DataWord(id).getData()); |
1019 | 1028 | } |
@@ -1058,11 +1067,13 @@ public Pair<Boolean, byte[]> execute(byte[] data) { |
1058 | 1067 | } catch (ContractExeException e) { |
1059 | 1068 | logger.debug("ContractExeException when calling proposalDeleteContract in vm"); |
1060 | 1069 | logger.debug("ContractExeException: {}", e.getMessage()); |
1061 | | - return null; |
| 1070 | + this.getResult().setException(new Program.Exception().contractExecuteException(e)); |
| 1071 | + return Pair.of(false, new DataWord(0).getData()); |
1062 | 1072 | } catch (ContractValidateException e) { |
1063 | 1073 | logger.debug("ContractValidateException when calling proposalDeleteContract in vm"); |
1064 | 1074 | logger.debug("ContractValidateException: {}", e.getMessage()); |
1065 | | - return null; |
| 1075 | + this.getResult().setException(new Program.Exception().contractValidateException(e)); |
| 1076 | + return Pair.of(false, new DataWord(0).getData()); |
1066 | 1077 | } |
1067 | 1078 | return Pair.of(true, new DataWord(1).getData()); |
1068 | 1079 | } |
@@ -1181,11 +1192,13 @@ public Pair<Boolean, byte[]> execute(byte[] data) { |
1181 | 1192 | } catch (ContractExeException e) { |
1182 | 1193 | logger.debug("ContractExeException when calling transferAssetContract in vm"); |
1183 | 1194 | logger.debug("ContractExeException: {}", e.getMessage()); |
1184 | | - return null; |
| 1195 | + this.getResult().setException(new Program.Exception().contractExecuteException(e)); |
| 1196 | + return Pair.of(false, new DataWord(0).getData()); |
1185 | 1197 | } catch (ContractValidateException e) { |
1186 | 1198 | logger.debug("ContractValidateException when calling transferAssetContract in vm"); |
1187 | 1199 | logger.debug("ContractValidateException: {}", e.getMessage()); |
1188 | | - return null; |
| 1200 | + this.getResult().setException(new Program.Exception().contractValidateException(e)); |
| 1201 | + return Pair.of(false, new DataWord(0).getData()); |
1189 | 1202 | } |
1190 | 1203 | return Pair.of(true, new DataWord(1).getData()); |
1191 | 1204 | } |
|
0 commit comments