Skip to content

Commit f77a077

Browse files
authored
Merge pull request tronprotocol#2 from tronprotocol/develop
update
2 parents 749caac + 871edd4 commit f77a077

File tree

202 files changed

+2866
-2444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+2866
-2444
lines changed

actuator/src/main/java/org/tron/core/actuator/AccountPermissionUpdateActuator.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import lombok.extern.slf4j.Slf4j;
1010
import org.apache.commons.lang3.StringUtils;
1111
import org.tron.common.utils.Commons;
12+
import org.tron.common.utils.DecodeUtil;
1213
import org.tron.core.capsule.AccountCapsule;
1314
import org.tron.core.capsule.TransactionResultCapsule;
1415
import org.tron.core.exception.BalanceInsufficientException;
@@ -33,8 +34,8 @@ public AccountPermissionUpdateActuator() {
3334

3435
@Override
3536
public boolean execute(Object object) throws ContractExeException {
36-
TransactionResultCapsule result = (TransactionResultCapsule)object;
37-
if (Objects.isNull(result)){
37+
TransactionResultCapsule result = (TransactionResultCapsule) object;
38+
if (Objects.isNull(result)) {
3839
throw new RuntimeException("TransactionResultCapsule is null");
3940
}
4041

@@ -103,7 +104,7 @@ private boolean checkPermission(Permission permission) throws ContractValidateEx
103104
"address should be distinct in permission " + permission.getType());
104105
}
105106
for (Key key : permission.getKeysList()) {
106-
if (!Commons.addressValid(key.getAddress().toByteArray())) {
107+
if (!DecodeUtil.addressValid(key.getAddress().toByteArray())) {
107108
throw new ContractValidateException("key is not a validate address");
108109
}
109110
if (key.getWeight() <= 0) {
@@ -176,7 +177,7 @@ public boolean validate() throws ContractValidateException {
176177
throw new ContractValidateException(e.getMessage());
177178
}
178179
byte[] ownerAddress = accountPermissionUpdateContract.getOwnerAddress().toByteArray();
179-
if (!Commons.addressValid(ownerAddress)) {
180+
if (!DecodeUtil.addressValid(ownerAddress)) {
180181
throw new ContractValidateException("invalidate ownerAddress");
181182
}
182183
AccountCapsule accountCapsule = accountStore.get(ownerAddress);

actuator/src/main/java/org/tron/core/actuator/AssetIssueActuator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.Objects;
2424
import lombok.extern.slf4j.Slf4j;
2525
import org.tron.common.utils.Commons;
26+
import org.tron.common.utils.DecodeUtil;
2627
import org.tron.core.capsule.AccountCapsule;
2728
import org.tron.core.capsule.AssetIssueCapsule;
2829
import org.tron.core.capsule.TransactionResultCapsule;
@@ -49,8 +50,8 @@ public AssetIssueActuator() {
4950

5051
@Override
5152
public boolean execute(Object result) throws ContractExeException {
52-
TransactionResultCapsule ret = (TransactionResultCapsule)result;
53-
if (Objects.isNull(ret)){
53+
TransactionResultCapsule ret = (TransactionResultCapsule) result;
54+
if (Objects.isNull(ret)) {
5455
throw new RuntimeException("TransactionResultCapsule is null");
5556
}
5657

@@ -169,7 +170,7 @@ public boolean validate() throws ContractValidateException {
169170
}
170171

171172
byte[] ownerAddress = assetIssueContract.getOwnerAddress().toByteArray();
172-
if (!Commons.addressValid(ownerAddress)) {
173+
if (!DecodeUtil.addressValid(ownerAddress)) {
173174
throw new ContractValidateException("Invalid ownerAddress");
174175
}
175176

actuator/src/main/java/org/tron/core/actuator/ClearABIContractActuator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.util.Objects;
77
import lombok.extern.slf4j.Slf4j;
88
import org.tron.common.utils.Commons;
9+
import org.tron.common.utils.DecodeUtil;
910
import org.tron.common.utils.StringUtil;
1011
import org.tron.core.capsule.AccountCapsule;
1112
import org.tron.core.capsule.ContractCapsule;
@@ -28,8 +29,8 @@ public ClearABIContractActuator() {
2829

2930
@Override
3031
public boolean execute(Object result) throws ContractExeException {
31-
TransactionResultCapsule ret = (TransactionResultCapsule)result;
32-
if (Objects.isNull(ret)){
32+
TransactionResultCapsule ret = (TransactionResultCapsule) result;
33+
if (Objects.isNull(ret)) {
3334
throw new RuntimeException("TransactionResultCapsule is null");
3435
}
3536

@@ -80,7 +81,7 @@ public boolean validate() throws ContractValidateException {
8081
logger.debug(e.getMessage(), e);
8182
throw new ContractValidateException(e.getMessage());
8283
}
83-
if (!Commons.addressValid(contract.getOwnerAddress().toByteArray())) {
84+
if (!DecodeUtil.addressValid(contract.getOwnerAddress().toByteArray())) {
8485
throw new ContractValidateException("Invalid address");
8586
}
8687
byte[] ownerAddress = contract.getOwnerAddress().toByteArray();

actuator/src/main/java/org/tron/core/actuator/CreateAccountActuator.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.util.Objects;
66
import lombok.extern.slf4j.Slf4j;
77
import org.tron.common.utils.Commons;
8+
import org.tron.common.utils.DecodeUtil;
89
import org.tron.common.utils.StringUtil;
910
import org.tron.core.capsule.AccountCapsule;
1011
import org.tron.core.capsule.TransactionResultCapsule;
@@ -27,8 +28,8 @@ public CreateAccountActuator() {
2728
@Override
2829
public boolean execute(Object result)
2930
throws ContractExeException {
30-
TransactionResultCapsule ret = (TransactionResultCapsule)result;
31-
if (Objects.isNull(ret)){
31+
TransactionResultCapsule ret = (TransactionResultCapsule) result;
32+
if (Objects.isNull(ret)) {
3233
throw new RuntimeException("TransactionResultCapsule is null");
3334
}
3435

@@ -89,7 +90,7 @@ public boolean validate() throws ContractValidateException {
8990
// throw new ContractValidateException("AccountName is null");
9091
// }
9192
byte[] ownerAddress = contract.getOwnerAddress().toByteArray();
92-
if (!Commons.addressValid(ownerAddress)) {
93+
if (!DecodeUtil.addressValid(ownerAddress)) {
9394
throw new ContractValidateException("Invalid ownerAddress");
9495
}
9596

@@ -107,7 +108,7 @@ public boolean validate() throws ContractValidateException {
107108
}
108109

109110
byte[] accountAddress = contract.getAccountAddress().toByteArray();
110-
if (!Commons.addressValid(accountAddress)) {
111+
if (!DecodeUtil.addressValid(accountAddress)) {
111112
throw new ContractValidateException("Invalid account address");
112113
}
113114

actuator/src/main/java/org/tron/core/actuator/ExchangeCreateActuator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.util.Objects;
77
import lombok.extern.slf4j.Slf4j;
88
import org.tron.common.utils.Commons;
9+
import org.tron.common.utils.DecodeUtil;
910
import org.tron.common.utils.StringUtil;
1011
import org.tron.core.capsule.AccountCapsule;
1112
import org.tron.core.capsule.ExchangeCapsule;
@@ -32,8 +33,8 @@ public ExchangeCreateActuator() {
3233

3334
@Override
3435
public boolean execute(Object object) throws ContractExeException {
35-
TransactionResultCapsule ret = (TransactionResultCapsule)object;
36-
if (Objects.isNull(ret)){
36+
TransactionResultCapsule ret = (TransactionResultCapsule) object;
37+
if (Objects.isNull(ret)) {
3738
throw new RuntimeException("TransactionResultCapsule is null");
3839
}
3940

@@ -156,7 +157,7 @@ public boolean validate() throws ContractValidateException {
156157
byte[] ownerAddress = contract.getOwnerAddress().toByteArray();
157158
String readableOwnerAddress = StringUtil.createReadableString(ownerAddress);
158159

159-
if (!Commons.addressValid(ownerAddress)) {
160+
if (!DecodeUtil.addressValid(ownerAddress)) {
160161
throw new ContractValidateException("Invalid address");
161162
}
162163

actuator/src/main/java/org/tron/core/actuator/ExchangeInjectActuator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import lombok.extern.slf4j.Slf4j;
99
import org.tron.common.utils.ByteArray;
1010
import org.tron.common.utils.Commons;
11+
import org.tron.common.utils.DecodeUtil;
1112
import org.tron.common.utils.StringUtil;
1213
import org.tron.core.capsule.AccountCapsule;
1314
import org.tron.core.capsule.ExchangeCapsule;
@@ -34,8 +35,8 @@ public ExchangeInjectActuator() {
3435

3536
@Override
3637
public boolean execute(Object object) throws ContractExeException {
37-
TransactionResultCapsule ret = (TransactionResultCapsule)object;
38-
if (Objects.isNull(ret)){
38+
TransactionResultCapsule ret = (TransactionResultCapsule) object;
39+
if (Objects.isNull(ret)) {
3940
throw new RuntimeException("TransactionResultCapsule is null");
4041
}
4142

@@ -140,7 +141,7 @@ public boolean validate() throws ContractValidateException {
140141
byte[] ownerAddress = contract.getOwnerAddress().toByteArray();
141142
String readableOwnerAddress = StringUtil.createReadableString(ownerAddress);
142143

143-
if (!Commons.addressValid(ownerAddress)) {
144+
if (!DecodeUtil.addressValid(ownerAddress)) {
144145
throw new ContractValidateException("Invalid address");
145146
}
146147

actuator/src/main/java/org/tron/core/actuator/ExchangeTransactionActuator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import lombok.extern.slf4j.Slf4j;
88
import org.tron.common.utils.ByteArray;
99
import org.tron.common.utils.Commons;
10+
import org.tron.common.utils.DecodeUtil;
1011
import org.tron.common.utils.StringUtil;
1112
import org.tron.core.capsule.AccountCapsule;
1213
import org.tron.core.capsule.ExchangeCapsule;
@@ -33,8 +34,8 @@ public ExchangeTransactionActuator() {
3334

3435
@Override
3536
public boolean execute(Object object) throws ContractExeException {
36-
TransactionResultCapsule ret = (TransactionResultCapsule)object;
37-
if (Objects.isNull(ret)){
37+
TransactionResultCapsule ret = (TransactionResultCapsule) object;
38+
if (Objects.isNull(ret)) {
3839
throw new RuntimeException("TransactionResultCapsule is null");
3940
}
4041

@@ -132,7 +133,7 @@ public boolean validate() throws ContractValidateException {
132133
byte[] ownerAddress = contract.getOwnerAddress().toByteArray();
133134
String readableOwnerAddress = StringUtil.createReadableString(ownerAddress);
134135

135-
if (!Commons.addressValid(ownerAddress)) {
136+
if (!DecodeUtil.addressValid(ownerAddress)) {
136137
throw new ContractValidateException("Invalid address");
137138
}
138139

actuator/src/main/java/org/tron/core/actuator/ExchangeWithdrawActuator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import lombok.extern.slf4j.Slf4j;
1010
import org.tron.common.utils.ByteArray;
1111
import org.tron.common.utils.Commons;
12+
import org.tron.common.utils.DecodeUtil;
1213
import org.tron.common.utils.StringUtil;
1314
import org.tron.core.capsule.AccountCapsule;
1415
import org.tron.core.capsule.ExchangeCapsule;
@@ -35,8 +36,8 @@ public ExchangeWithdrawActuator() {
3536

3637
@Override
3738
public boolean execute(Object object) throws ContractExeException {
38-
TransactionResultCapsule ret = (TransactionResultCapsule)object;
39-
if (Objects.isNull(ret)){
39+
TransactionResultCapsule ret = (TransactionResultCapsule) object;
40+
if (Objects.isNull(ret)) {
4041
throw new RuntimeException("TransactionResultCapsule is null");
4142
}
4243

@@ -150,7 +151,7 @@ public boolean validate() throws ContractValidateException {
150151
byte[] ownerAddress = contract.getOwnerAddress().toByteArray();
151152
String readableOwnerAddress = StringUtil.createReadableString(ownerAddress);
152153

153-
if (!Commons.addressValid(ownerAddress)) {
154+
if (!DecodeUtil.addressValid(ownerAddress)) {
154155
throw new ContractValidateException("Invalid address");
155156
}
156157

actuator/src/main/java/org/tron/core/actuator/FreezeBalanceActuator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import java.util.Objects;
88
import lombok.extern.slf4j.Slf4j;
99
import org.apache.commons.lang3.ArrayUtils;
10-
import org.tron.common.utils.Commons;
1110
import org.tron.common.utils.DBConfig;
11+
import org.tron.common.utils.DecodeUtil;
1212
import org.tron.common.utils.StringUtil;
1313
import org.tron.core.capsule.AccountCapsule;
1414
import org.tron.core.capsule.DelegatedResourceAccountIndexCapsule;
@@ -34,8 +34,8 @@ public FreezeBalanceActuator() {
3434

3535
@Override
3636
public boolean execute(Object result) throws ContractExeException {
37-
TransactionResultCapsule ret = (TransactionResultCapsule)result;
38-
if (Objects.isNull(ret)){
37+
TransactionResultCapsule ret = (TransactionResultCapsule) result;
38+
if (Objects.isNull(ret)) {
3939
throw new RuntimeException("TransactionResultCapsule is null");
4040
}
4141

@@ -129,7 +129,7 @@ public boolean validate() throws ContractValidateException {
129129
throw new ContractValidateException(e.getMessage());
130130
}
131131
byte[] ownerAddress = freezeBalanceContract.getOwnerAddress().toByteArray();
132-
if (!Commons.addressValid(ownerAddress)) {
132+
if (!DecodeUtil.addressValid(ownerAddress)) {
133133
throw new ContractValidateException("Invalid address");
134134
}
135135

@@ -192,7 +192,7 @@ public boolean validate() throws ContractValidateException {
192192
"receiverAddress must not be the same as ownerAddress");
193193
}
194194

195-
if (!Commons.addressValid(receiverAddress)) {
195+
if (!DecodeUtil.addressValid(receiverAddress)) {
196196
throw new ContractValidateException("Invalid receiverAddress");
197197
}
198198

actuator/src/main/java/org/tron/core/actuator/ParticipateAssetIssueActuator.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import lombok.extern.slf4j.Slf4j;
2323
import org.tron.common.utils.ByteArray;
2424
import org.tron.common.utils.Commons;
25+
import org.tron.common.utils.DecodeUtil;
2526
import org.tron.core.capsule.AccountCapsule;
2627
import org.tron.core.capsule.AssetIssueCapsule;
2728
import org.tron.core.capsule.TransactionResultCapsule;
@@ -45,8 +46,8 @@ public ParticipateAssetIssueActuator() {
4546

4647
@Override
4748
public boolean execute(Object object) throws ContractExeException {
48-
TransactionResultCapsule ret = (TransactionResultCapsule)object;
49-
if (Objects.isNull(ret)){
49+
TransactionResultCapsule ret = (TransactionResultCapsule) object;
50+
if (Objects.isNull(ret)) {
5051
throw new RuntimeException("TransactionResultCapsule is null");
5152
}
5253

@@ -134,10 +135,10 @@ public boolean validate() throws ContractValidateException {
134135
byte[] assetName = participateAssetIssueContract.getAssetName().toByteArray();
135136
long amount = participateAssetIssueContract.getAmount();
136137

137-
if (!Commons.addressValid(ownerAddress)) {
138+
if (!DecodeUtil.addressValid(ownerAddress)) {
138139
throw new ContractValidateException("Invalid ownerAddress");
139140
}
140-
if (!Commons.addressValid(toAddress)) {
141+
if (!DecodeUtil.addressValid(toAddress)) {
141142
throw new ContractValidateException("Invalid toAddress");
142143
}
143144
// if (!TransactionUtil.validAssetName(assetName)) {

actuator/src/main/java/org/tron/core/actuator/ProposalApproveActuator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import java.util.Objects;
1111
import lombok.extern.slf4j.Slf4j;
1212
import org.tron.common.utils.ByteArray;
13-
import org.tron.common.utils.Commons;
13+
import org.tron.common.utils.DecodeUtil;
1414
import org.tron.common.utils.StringUtil;
1515
import org.tron.core.capsule.ProposalCapsule;
1616
import org.tron.core.capsule.TransactionResultCapsule;
@@ -35,8 +35,8 @@ public ProposalApproveActuator() {
3535

3636
@Override
3737
public boolean execute(Object result) throws ContractExeException {
38-
TransactionResultCapsule ret = (TransactionResultCapsule)result;
39-
if (Objects.isNull(ret)){
38+
TransactionResultCapsule ret = (TransactionResultCapsule) result;
39+
if (Objects.isNull(ret)) {
4040
throw new RuntimeException("TransactionResultCapsule is null");
4141
}
4242

@@ -95,7 +95,7 @@ public boolean validate() throws ContractValidateException {
9595
byte[] ownerAddress = contract.getOwnerAddress().toByteArray();
9696
String readableOwnerAddress = StringUtil.createReadableString(ownerAddress);
9797

98-
if (!Commons.addressValid(ownerAddress)) {
98+
if (!DecodeUtil.addressValid(ownerAddress)) {
9999
throw new ContractValidateException("Invalid address");
100100
}
101101

actuator/src/main/java/org/tron/core/actuator/ProposalCreateActuator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import java.util.Map;
1010
import java.util.Objects;
1111
import lombok.extern.slf4j.Slf4j;
12-
import org.tron.common.utils.Commons;
1312
import org.tron.common.utils.DBConfig;
13+
import org.tron.common.utils.DecodeUtil;
1414
import org.tron.common.utils.StringUtil;
1515
import org.tron.core.capsule.ProposalCapsule;
1616
import org.tron.core.capsule.TransactionResultCapsule;
@@ -30,8 +30,8 @@ public ProposalCreateActuator() {
3030

3131
@Override
3232
public boolean execute(Object result) throws ContractExeException {
33-
TransactionResultCapsule ret = (TransactionResultCapsule)result;
34-
if (Objects.isNull(ret)){
33+
TransactionResultCapsule ret = (TransactionResultCapsule) result;
34+
if (Objects.isNull(ret)) {
3535
throw new RuntimeException("TransactionResultCapsule is null");
3636
}
3737

@@ -94,7 +94,7 @@ public boolean validate() throws ContractValidateException {
9494
byte[] ownerAddress = contract.getOwnerAddress().toByteArray();
9595
String readableOwnerAddress = StringUtil.createReadableString(ownerAddress);
9696

97-
if (!Commons.addressValid(ownerAddress)) {
97+
if (!DecodeUtil.addressValid(ownerAddress)) {
9898
throw new ContractValidateException("Invalid address");
9999
}
100100

0 commit comments

Comments
 (0)