Skip to content

Commit f94355b

Browse files
committed
Merge branch 'release_v4.7.2' into develop
2 parents 9e1d15d + 74b34bc commit f94355b

101 files changed

Lines changed: 1782 additions & 1840 deletions

File tree

Some content is hidden

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

DownloadLinks.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

actuator/src/main/java/org/tron/core/utils/TransactionUtil.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import org.tron.protos.Protocol.Transaction;
5050
import org.tron.protos.Protocol.Transaction.Contract;
5151
import org.tron.protos.Protocol.Transaction.Result.contractResult;
52-
import org.tron.protos.Protocol.TransactionSign;
5352
import org.tron.protos.contract.SmartContractOuterClass.CreateSmartContract;
5453
import org.tron.protos.contract.SmartContractOuterClass.TriggerSmartContract;
5554
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
@@ -184,21 +183,6 @@ public static String makeUpperCamelMethod(String originName) {
184183
.replace("_", "");
185184
}
186185

187-
public static TransactionCapsule getTransactionSign(TransactionSign transactionSign) {
188-
byte[] privateKey = transactionSign.getPrivateKey().toByteArray();
189-
TransactionCapsule trx = new TransactionCapsule(transactionSign.getTransaction());
190-
trx.sign(privateKey);
191-
return trx;
192-
}
193-
194-
public TransactionCapsule addSign(TransactionSign transactionSign)
195-
throws PermissionException, SignatureException, SignatureFormatException {
196-
byte[] privateKey = transactionSign.getPrivateKey().toByteArray();
197-
TransactionCapsule trx = new TransactionCapsule(transactionSign.getTransaction());
198-
trx.addSign(privateKey, chainBaseManager.getAccountStore());
199-
return trx;
200-
}
201-
202186
public TransactionSignWeight getTransactionSignWeight(Transaction trx) {
203187
TransactionSignWeight.Builder tswBuilder = TransactionSignWeight.newBuilder();
204188
TransactionExtention.Builder trxExBuilder = TransactionExtention.newBuilder();

actuator/src/main/java/org/tron/core/vm/nativecontract/DelegateResourceProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void validate(DelegateResourceParam param, Repository repo) throws Contra
9696
break;
9797
default:
9898
throw new ContractValidateException(
99-
"ResourceCode error, valid ResourceCode[BANDWIDTH、ENERGY]");
99+
"Unknown ResourceCode, valid ResourceCode[BANDWIDTH、ENERGY]");
100100
}
101101

102102
byte[] receiverAddress = param.getReceiverAddress();

actuator/src/main/java/org/tron/core/vm/nativecontract/FreezeBalanceProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void validate(FreezeBalanceParam param, Repository repo) throws ContractV
4848
break;
4949
default:
5050
throw new ContractValidateException(
51-
"ResourceCode error,valid ResourceCode[BANDWIDTH、ENERGY]");
51+
"Unknown ResourceCode, valid ResourceCode[BANDWIDTH、ENERGY]");
5252
}
5353

5454
// validate for delegating resource

actuator/src/main/java/org/tron/core/vm/nativecontract/FreezeBalanceV2Processor.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
package org.tron.core.vm.nativecontract;
22

3+
import static org.tron.core.actuator.ActuatorConstant.ACCOUNT_EXCEPTION_STR;
4+
import static org.tron.core.actuator.ActuatorConstant.STORE_NOT_EXIST;
5+
import static org.tron.core.config.Parameter.ChainConstant.TRX_PRECISION;
6+
import static org.tron.protos.contract.Common.ResourceCode.BANDWIDTH;
7+
import static org.tron.protos.contract.Common.ResourceCode.ENERGY;
8+
39
import lombok.extern.slf4j.Slf4j;
410
import org.tron.common.utils.DecodeUtil;
511
import org.tron.common.utils.StringUtil;
@@ -9,12 +15,6 @@
915
import org.tron.core.vm.nativecontract.param.FreezeBalanceV2Param;
1016
import org.tron.core.vm.repository.Repository;
1117

12-
import static org.tron.core.actuator.ActuatorConstant.ACCOUNT_EXCEPTION_STR;
13-
import static org.tron.core.actuator.ActuatorConstant.STORE_NOT_EXIST;
14-
import static org.tron.core.config.Parameter.ChainConstant.TRX_PRECISION;
15-
import static org.tron.protos.contract.Common.ResourceCode.BANDWIDTH;
16-
import static org.tron.protos.contract.Common.ResourceCode.ENERGY;
17-
1818
@Slf4j(topic = "VMProcessor")
1919
public class FreezeBalanceV2Processor {
2020

@@ -50,16 +50,16 @@ public void validate(FreezeBalanceV2Param param, Repository repo) throws Contrac
5050
case TRON_POWER:
5151
if (!repo.getDynamicPropertiesStore().supportAllowNewResourceModel()) {
5252
throw new ContractValidateException(
53-
"ResourceCode error, valid ResourceCode[BANDWIDTH、ENERGY]");
53+
"Unknown ResourceCode, valid ResourceCode[BANDWIDTH、ENERGY]");
5454
}
5555
break;
5656
default:
5757
if (repo.getDynamicPropertiesStore().supportAllowNewResourceModel()) {
5858
throw new ContractValidateException(
59-
"ResourceCode error, valid ResourceCode[BANDWIDTH、ENERGY、TRON_POWER]");
59+
"Unknown ResourceCode, valid ResourceCode[BANDWIDTH、ENERGY、TRON_POWER]");
6060
} else {
6161
throw new ContractValidateException(
62-
"ResourceCode error, valid ResourceCode[BANDWIDTH、ENERGY]");
62+
"Unknown ResourceCode, valid ResourceCode[BANDWIDTH、ENERGY]");
6363
}
6464
}
6565
}

actuator/src/main/java/org/tron/core/vm/nativecontract/UnDelegateResourceProcessor.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
package org.tron.core.vm.nativecontract;
22

3+
import static org.tron.core.actuator.ActuatorConstant.ACCOUNT_EXCEPTION_STR;
4+
import static org.tron.core.actuator.ActuatorConstant.STORE_NOT_EXIST;
5+
import static org.tron.core.config.Parameter.ChainConstant.TRX_PRECISION;
6+
import static org.tron.protos.contract.Common.ResourceCode.BANDWIDTH;
7+
import static org.tron.protos.contract.Common.ResourceCode.ENERGY;
8+
39
import com.google.common.primitives.Bytes;
10+
import java.util.Arrays;
11+
import java.util.Objects;
412
import lombok.extern.slf4j.Slf4j;
513
import org.apache.commons.lang3.ArrayUtils;
614
import org.tron.common.utils.DecodeUtil;
@@ -17,15 +25,6 @@
1725
import org.tron.core.vm.nativecontract.param.UnDelegateResourceParam;
1826
import org.tron.core.vm.repository.Repository;
1927

20-
import java.util.Arrays;
21-
import java.util.Objects;
22-
23-
import static org.tron.core.actuator.ActuatorConstant.ACCOUNT_EXCEPTION_STR;
24-
import static org.tron.core.actuator.ActuatorConstant.STORE_NOT_EXIST;
25-
import static org.tron.core.config.Parameter.ChainConstant.TRX_PRECISION;
26-
import static org.tron.protos.contract.Common.ResourceCode.BANDWIDTH;
27-
import static org.tron.protos.contract.Common.ResourceCode.ENERGY;
28-
2928
@Slf4j(topic = "VMProcessor")
3029
public class UnDelegateResourceProcessor {
3130

@@ -84,7 +83,7 @@ public void validate(UnDelegateResourceParam param, Repository repo) throws Cont
8483
break;
8584
default:
8685
throw new ContractValidateException(
87-
"ResourceCode error.valid ResourceCode[BANDWIDTH、ENERGY]");
86+
"Unknown ResourceCode, valid ResourceCode[BANDWIDTH、ENERGY]");
8887
}
8988
}
9089

actuator/src/main/java/org/tron/core/vm/nativecontract/UnfreezeBalanceProcessor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ public void validate(UnfreezeBalanceParam param, Repository repo)
6565
}
6666
break;
6767
default:
68-
throw new ContractValidateException("ResourceCode error."
69-
+ "valid ResourceCode[BANDWIDTH、Energy]");
68+
throw new ContractValidateException("Unknown ResourceCode, "
69+
+ "valid ResourceCode[BANDWIDTH、ENERGY]");
7070
}
7171
} else {
7272
switch (param.getResourceType()) {
@@ -95,8 +95,8 @@ public void validate(UnfreezeBalanceParam param, Repository repo)
9595
}
9696
break;
9797
default:
98-
throw new ContractValidateException("ResourceCode error."
99-
+ "valid ResourceCode[BANDWIDTH、Energy]");
98+
throw new ContractValidateException("Unknown ResourceCode, "
99+
+ "valid ResourceCode[BANDWIDTH、ENERGY]");
100100
}
101101
}
102102
}

actuator/src/main/java/org/tron/core/vm/nativecontract/UnfreezeBalanceV2Processor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ public void validate(UnfreezeBalanceV2Param param, Repository repo)
7171
throw new ContractValidateException("no frozenBalance(TRON_POWER)");
7272
}
7373
} else {
74-
throw new ContractValidateException("ResourceCode error.valid ResourceCode[BANDWIDTH、ENERGY]");
74+
throw new ContractValidateException("Unknown ResourceCode, valid ResourceCode[BANDWIDTH、ENERGY]");
7575
}
7676
break;
7777
default:
7878
if (dynamicStore.supportAllowNewResourceModel()) {
79-
throw new ContractValidateException("ResourceCode error.valid ResourceCode[BANDWIDTH、ENERGY、TRON_POWER]");
79+
throw new ContractValidateException("Unknown ResourceCode, valid ResourceCode[BANDWIDTH、ENERGY、TRON_POWER]");
8080
} else {
81-
throw new ContractValidateException("ResourceCode error.valid ResourceCode[BANDWIDTH、ENERGY]");
81+
throw new ContractValidateException("Unknown ResourceCode, valid ResourceCode[BANDWIDTH、ENERGY]");
8282
}
8383
}
8484

actuator/src/main/java/org/tron/core/vm/program/Program.java

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import java.util.Map;
1818
import java.util.Objects;
1919
import java.util.stream.Collectors;
20-
2120
import lombok.Getter;
2221
import lombok.Setter;
2322
import lombok.extern.slf4j.Slf4j;
@@ -1815,9 +1814,9 @@ public boolean freeze(DataWord receiverAddress, DataWord frozenBalance, DataWord
18151814
repository.commit();
18161815
return true;
18171816
} catch (ContractValidateException e) {
1818-
logger.error("TVM Freeze: validate failure. Reason: {}", e.getMessage());
1817+
logger.warn("TVM Freeze: validate failure. Reason: {}", e.getMessage());
18191818
} catch (ArithmeticException e) {
1820-
logger.error("TVM Freeze: frozenBalance out of long range.");
1819+
logger.warn("TVM Freeze: frozenBalance out of long range.");
18211820
}
18221821
if (internalTx != null) {
18231822
internalTx.reject();
@@ -1848,7 +1847,7 @@ public boolean unfreeze(DataWord receiverAddress, DataWord resourceType) {
18481847
}
18491848
return true;
18501849
} catch (ContractValidateException e) {
1851-
logger.error("TVM Unfreeze: validate failure. Reason: {}", e.getMessage());
1850+
logger.warn("TVM Unfreeze: validate failure. Reason: {}", e.getMessage());
18521851
}
18531852
if (internalTx != null) {
18541853
internalTx.reject();
@@ -1911,9 +1910,9 @@ public boolean freezeBalanceV2(DataWord frozenBalance, DataWord resourceType) {
19111910
repository.commit();
19121911
return true;
19131912
} catch (ContractValidateException e) {
1914-
logger.error("TVM FreezeBalanceV2: validate failure. Reason: {}", e.getMessage());
1913+
logger.warn("TVM FreezeBalanceV2: validate failure. Reason: {}", e.getMessage());
19151914
} catch (ArithmeticException e) {
1916-
logger.error("TVM FreezeBalanceV2: frozenBalance out of long range.");
1915+
logger.warn("TVM FreezeBalanceV2: frozenBalance out of long range.");
19171916
}
19181917
if (internalTx != null) {
19191918
internalTx.reject();
@@ -1947,9 +1946,9 @@ public boolean unfreezeBalanceV2(DataWord unfreezeBalance, DataWord resourceType
19471946
}
19481947
return true;
19491948
} catch (ContractValidateException e) {
1950-
logger.error("TVM UnfreezeBalanceV2: validate failure. Reason: {}", e.getMessage());
1949+
logger.warn("TVM UnfreezeBalanceV2: validate failure. Reason: {}", e.getMessage());
19511950
} catch (ArithmeticException e) {
1952-
logger.error("TVM UnfreezeBalanceV2: balance out of long range.");
1951+
logger.warn("TVM UnfreezeBalanceV2: balance out of long range.");
19531952
}
19541953
if (internalTx != null) {
19551954
internalTx.reject();
@@ -1978,9 +1977,9 @@ public long withdrawExpireUnfreeze() {
19781977
}
19791978
return expireUnfreezeBalance;
19801979
} catch (ContractValidateException e) {
1981-
logger.error("TVM WithdrawExpireUnfreeze: validate failure. Reason: {}", e.getMessage());
1980+
logger.warn("TVM WithdrawExpireUnfreeze: validate failure. Reason: {}", e.getMessage());
19821981
} catch (ContractExeException e) {
1983-
logger.error("TVM WithdrawExpireUnfreeze: execute failure. Reason: {}", e.getMessage());
1982+
logger.warn("TVM WithdrawExpireUnfreeze: execute failure. Reason: {}", e.getMessage());
19841983
}
19851984
if (internalTx != null) {
19861985
internalTx.reject();
@@ -2011,9 +2010,9 @@ public boolean cancelAllUnfreezeV2Action() {
20112010
}
20122011
return true;
20132012
} catch (ContractValidateException e) {
2014-
logger.error("TVM CancelAllUnfreezeV2: validate failure. Reason: {}", e.getMessage());
2013+
logger.warn("TVM CancelAllUnfreezeV2: validate failure. Reason: {}", e.getMessage());
20152014
} catch (ContractExeException e) {
2016-
logger.error("TVM CancelAllUnfreezeV2: execute failure. Reason: {}", e.getMessage());
2015+
logger.warn("TVM CancelAllUnfreezeV2: execute failure. Reason: {}", e.getMessage());
20172016
}
20182017
if (internalTx != null) {
20192018
internalTx.reject();
@@ -2045,9 +2044,9 @@ public boolean delegateResource(
20452044
repository.commit();
20462045
return true;
20472046
} catch (ContractValidateException e) {
2048-
logger.error("TVM DelegateResource: validate failure. Reason: {}", e.getMessage());
2047+
logger.warn("TVM DelegateResource: validate failure. Reason: {}", e.getMessage());
20492048
} catch (ArithmeticException e) {
2050-
logger.error("TVM DelegateResource: balance out of long range.");
2049+
logger.warn("TVM DelegateResource: balance out of long range.");
20512050
}
20522051
if (internalTx != null) {
20532052
internalTx.reject();
@@ -2079,9 +2078,9 @@ public boolean unDelegateResource(
20792078
repository.commit();
20802079
return true;
20812080
} catch (ContractValidateException e) {
2082-
logger.error("TVM UnDelegateResource: validate failure. Reason: {}", e.getMessage());
2081+
logger.warn("TVM UnDelegateResource: validate failure. Reason: {}", e.getMessage());
20832082
} catch (ArithmeticException e) {
2084-
logger.error("TVM UnDelegateResource: balance out of long range.");
2083+
logger.warn("TVM UnDelegateResource: balance out of long range.");
20852084
}
20862085
if (internalTx != null) {
20872086
internalTx.reject();
@@ -2114,7 +2113,7 @@ private Common.ResourceCode parseResourceCodeV2(DataWord resourceType) {
21142113
return Common.ResourceCode.UNRECOGNIZED;
21152114
}
21162115
} catch (ArithmeticException e) {
2117-
logger.error("TVM ParseResourceCodeV2: invalid resource code: {}", resourceType.sValue());
2116+
logger.warn("TVM ParseResourceCodeV2: invalid resource code: {}", resourceType.sValue());
21182117
return Common.ResourceCode.UNRECOGNIZED;
21192118
}
21202119
}
@@ -2180,11 +2179,11 @@ public boolean voteWitness(int witnessArrayOffset, int witnessArrayLength,
21802179
repository.commit();
21812180
return true;
21822181
} catch (ContractValidateException e) {
2183-
logger.error("TVM VoteWitness: validate failure. Reason: {}", e.getMessage());
2182+
logger.warn("TVM VoteWitness: validate failure. Reason: {}", e.getMessage());
21842183
} catch (ContractExeException e) {
2185-
logger.error("TVM VoteWitness: execute failure. Reason: {}", e.getMessage());
2184+
logger.warn("TVM VoteWitness: execute failure. Reason: {}", e.getMessage());
21862185
} catch (ArithmeticException e) {
2187-
logger.error("TVM VoteWitness: int or long out of range. caused by: {}", e.getMessage());
2186+
logger.warn("TVM VoteWitness: int or long out of range. caused by: {}", e.getMessage());
21882187
}
21892188
if (internalTx != null) {
21902189
internalTx.reject();
@@ -2213,9 +2212,9 @@ public long withdrawReward() {
22132212
}
22142213
return allowance;
22152214
} catch (ContractValidateException e) {
2216-
logger.error("TVM WithdrawReward: validate failure. Reason: {}", e.getMessage());
2215+
logger.warn("TVM WithdrawReward: validate failure. Reason: {}", e.getMessage());
22172216
} catch (ContractExeException e) {
2218-
logger.error("TVM WithdrawReward: execute failure. Reason: {}", e.getMessage());
2217+
logger.warn("TVM WithdrawReward: execute failure. Reason: {}", e.getMessage());
22192218
}
22202219
if (internalTx != null) {
22212220
internalTx.reject();

build.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ subprojects {
4444
annotationProcessor 'org.projectlombok:lombok:1.18.12'
4545
testCompileOnly 'org.projectlombok:lombok:1.18.12'
4646
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
47-
compile group: 'com.google.guava', name: 'guava', version: '24.1-jre'
47+
compile group: 'com.google.guava', name: 'guava', version: '30.1-jre'
4848
compile "com.google.code.findbugs:jsr305:3.0.0"
4949
compile group: 'org.springframework', name: 'spring-context', version: '5.3.18'
5050
compile group: 'org.springframework', name: 'spring-tx', version: '5.3.18'
@@ -70,6 +70,12 @@ subprojects {
7070
resolutionStrategy {
7171
force group: 'com.google.guava', name: 'guava', version: '30.1-jre'
7272
}
73+
resolutionStrategy.eachDependency { details ->
74+
// TODO if update grpc remove
75+
if(details.requested.group == 'io.netty') {
76+
details.useVersion "4.1.27.Final"
77+
}
78+
}
7379
}
7480
}
7581

@@ -89,4 +95,3 @@ gradle.buildFinished {
8995
}
9096
}
9197
}
92-

0 commit comments

Comments
 (0)