Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
459 commits
Select commit Hold shift + click to select a range
1646399
set contractVersion
Aug 26, 2021
9af6aca
add tcmalloc release rate value
forfreeday Aug 27, 2021
e13e8e2
Merge branches 'feature/optimize_shell' and 'release_v4.4.0' of githu…
forfreeday Aug 27, 2021
0a234bc
modify getCallEnergy
Aug 27, 2021
65ea697
change writeBuffer for big db
halibobo1205 Aug 27, 2021
23b0997
Merge pull request #4016 from tronprotocol/feature/optimize_shell
forfreeday Aug 27, 2021
0f305d5
Merge pull request #4018 from halibobo1205/db/adjust-write-cache
forfreeday Aug 30, 2021
c8ad3d8
Merge pull request #4011 from wubin01/opt_p2p
forfreeday Aug 30, 2021
3499968
feat: estimatedGas support value
Aug 30, 2021
319af4f
feat: add test for construct data
Aug 30, 2021
e0267a6
typo
Aug 30, 2021
82a6c97
typo
Aug 30, 2021
dff9783
feat: set default result of call to 0x
Aug 30, 2021
d1e1b6e
typo: remove unused codes
Aug 30, 2021
0597ed7
add logback shutdown hock
Vikingzzu Aug 30, 2021
bc2798e
Merge pull request #4020 from Vikingzzu/release_v4.4.0
forfreeday Aug 30, 2021
33ba890
test(tvm): retry Create2Test if out of time
yanghang8612 Aug 30, 2021
e91d6e0
Stest assert adapt 4.4.0
daxinzang1 Aug 30, 2021
38f7dd5
Merge pull request #4022 from tronprotocol/feature/retry_create2_test
yanghang8612 Aug 30, 2021
be9dc54
Merge pull request #4023 from tronprotocol/stest_assert_adapt_4.4.0
wangzichichi Aug 30, 2021
7caa089
style(test): fix checkstyle
yanghang8612 Aug 31, 2021
6c72845
optimize code
Aug 31, 2021
c3ed898
func(tvm): revert uncheck max fee limit
yanghang8612 Aug 31, 2021
9486c7d
Merge pull request #4025 from tronprotocol/feature/retry_create2_test
yanghang8612 Aug 31, 2021
d14ec79
add:
forfreeday Aug 31, 2021
b7f03c4
func(rpc,store): remove unused bean or config check
yanghang8612 Aug 31, 2021
c338e53
remove unused method initCacheTxs
halibobo1205 Aug 31, 2021
ad66fa1
modify sync check logic
xxo1shine Aug 31, 2021
537f035
modify get active peers logic
xxo1shine Sep 1, 2021
e667882
remove setVersion in PublicMethod
Sep 1, 2021
463873f
Merge branch 'feature/tvm_compatible_evm' of github.com:tronprotocol/…
Sep 1, 2021
5b9c8e3
Merge pull request #4027 from halibobo1205/release_v4.4.0
forfreeday Sep 1, 2021
619a371
Merge pull request #4030 from wubin01/sync_check
forfreeday Sep 1, 2021
ccf8ca9
modify disconnect timeout
xxo1shine Sep 1, 2021
31b0fbb
Merge pull request #4031 from wubin01/sync_check
forfreeday Sep 1, 2021
c7f60fc
func(rpc): invoke deploy contract if contract address is empty throug…
yanghang8612 Sep 1, 2021
f903cf2
func(tvm): move setting constant result after consuming energy for sa…
yanghang8612 Sep 1, 2021
b4d8de2
Merge remote-tracking branch 'origin/feature/tvm_compatible_evm' into…
yanghang8612 Sep 1, 2021
89cd21f
add test
Sep 1, 2021
01f83c5
Merge branch 'feature/tvm_compatible_evm' of github.com:tronprotocol/…
Sep 1, 2021
dc86be3
Add rpc test case
daxinzang1 Sep 1, 2021
a8b3a81
fix checkStyle
Sep 1, 2021
573bf47
Merge pull request #4033 from tronprotocol/testcase-for-jsonrpc
wangzichichi Sep 1, 2021
5c9ef88
func(tvm): expand hash space for storage slot key
yanghang8612 Sep 1, 2021
f5fcf84
Merge branch 'release_v4.4.0' into feature/tvm_compatible_evm
yanghang8612 Sep 2, 2021
a877945
fix: transactionreceipt is success when result is 0 or 1
Sep 2, 2021
37ea5e0
Merge branch 'feature/jsonrpc' of ssh://github.com/tronprotocol/java-…
Sep 2, 2021
cdc5c9a
fix: add removed to log
Sep 2, 2021
f2beed5
fix: add type to transaction
Sep 2, 2021
2586e96
Merge pull request #4032 from tronprotocol/feature/tvm_compatible_evm
Lredhdx Sep 2, 2021
2a80b84
feat: modify coinbase and mining
Sep 3, 2021
753010d
feat: put pending as invalid
Sep 3, 2021
b96ff29
adapt case to java-tron v4.4.0
mumianhua Sep 3, 2021
97f5c1a
Merge remote-tracking branch 'origin/release_v4.4.0' into test/4.4.0_…
mumianhua Sep 3, 2021
c81d446
modify version
Sep 3, 2021
1d5d7b4
Merge branch 'feature/tvm_compatible_evm' of github.com:tronprotocol/…
Sep 3, 2021
4ab279b
Merge pull request #4039 from tronprotocol/feature/tvm_compatible_evm
yanghang8612 Sep 3, 2021
ceec737
feat: use getcontractinfo to get runtimecode
Sep 3, 2021
05a0970
fix checkstyle
mumianhua Sep 3, 2021
ea7b86d
optimize start.sh
forfreeday Sep 3, 2021
10a3c02
optimize start.sh
forfreeday Sep 3, 2021
3ca2f34
add shell options:
forfreeday Sep 6, 2021
757fe51
add shell.md
forfreeday Sep 6, 2021
0de75de
modify README.md
forfreeday Sep 6, 2021
8d7d34e
modify shell.md
forfreeday Sep 6, 2021
5bc9942
Merge pull request #4038 from tronprotocol/test/4.4.0_case
wangzichichi Sep 7, 2021
6ffee31
fix checkstyle
mumianhua Sep 7, 2021
06650de
add case for contact ""
mumianhua Sep 7, 2021
dd526ef
Merge remote-tracking branch 'origin/test/4.4.0_case' into test/4.4.0…
mumianhua Sep 7, 2021
a62e6b2
modify shell.md start.sh
forfreeday Sep 7, 2021
0b9e37e
add release and cb run
forfreeday Sep 7, 2021
b13a7ca
feat: add baseFeePerGas and mixHash to BlockResult
Sep 7, 2021
1591cc3
adapt case to java-tron v4.4.0
mumianhua Sep 8, 2021
3bdbc80
add option usage
forfreeday Sep 8, 2021
902b291
add option usage
forfreeday Sep 8, 2021
86d0391
add option usage
forfreeday Sep 8, 2021
b62d661
add option usage
forfreeday Sep 8, 2021
e9e9d64
modify: format
forfreeday Sep 8, 2021
62ee1db
add case to java-tron v4.4.0
mumianhua Sep 8, 2021
a5fe214
commit merge
mumianhua Sep 8, 2021
902a5e5
Add json rpc test case
daxinzang1 Sep 8, 2021
6c8f619
Add json rpc test case
daxinzang1 Sep 8, 2021
b672f81
Merge branch 'release_v4.4.0' into feature/api_access_config
Sep 8, 2021
a0c6b33
Merge branch 'release_v4.4.0' into feature/jsonrpc
Sep 8, 2021
5324fc7
feat: support deploy smart contract in estimatedGas
Sep 8, 2021
28bee7b
fix checkstyle and case
mumianhua Sep 8, 2021
8e3eb8e
Merge pull request #4044 from tronprotocol/test/4.4.0_case
wangzichichi Sep 8, 2021
0b43276
feat: use JsonRpcInvalidRequestException instead of JsonRpcInternalEx…
Sep 9, 2021
7d261b2
Merge pull request #4045 from tronprotocol/feature/api_access_config
waynercheung Sep 9, 2021
927dfda
Merge branch 'release_v4.4.0' into feature/jsonrpc
Sep 9, 2021
59f412f
modify shell upgrade
forfreeday Sep 9, 2021
fe719ad
fix case to adapt java-tron v4.4.0(call can use 63/64 left energy)
mumianhua Sep 9, 2021
6c49e45
modify:
forfreeday Sep 9, 2021
45fa136
Merge pull request #4047 from tronprotocol/test/4.4.0_case
wangzichichi Sep 9, 2021
6a540ab
Merge pull request #4046 from tronprotocol/feature/jsonrpc
waynercheung Sep 9, 2021
5418305
modify shell.md
forfreeday Sep 9, 2021
9a04ef0
modify shell.md
forfreeday Sep 9, 2021
5fc1df7
modify rebuild manifest tool
forfreeday Sep 9, 2021
5923634
add test case
mumianhua Sep 9, 2021
73add6e
Merge remote-tracking branch 'origin/release_v4.4.0' into test/4.4.0_…
mumianhua Sep 10, 2021
e0af11f
Add jsonprc base depand
daxinzang1 Sep 10, 2021
3710bb5
ignore unit test
mumianhua Sep 13, 2021
fc84e21
optimize md and start.sh
forfreeday Sep 13, 2021
091b54b
modify change getLatestReleaseVersion exit type
forfreeday Sep 13, 2021
4d96cd1
modify change getLatestReleaseVersion exit type
forfreeday Sep 13, 2021
c60dd19
modify format
forfreeday Sep 13, 2021
8b9658e
modify format
forfreeday Sep 13, 2021
889d2e5
modify format
forfreeday Sep 13, 2021
cfcd6df
Add jsonrpc test case
daxinzang1 Sep 13, 2021
d02fbce
Add jsonrpc test case
daxinzang1 Sep 13, 2021
b913d59
Optimization of single parameter startup
forfreeday Sep 13, 2021
8671091
ignore unit test
mumianhua Sep 13, 2021
1d969fb
Merge remote-tracking branch 'origin/test/4.4.0_case' into test/4.4.0…
mumianhua Sep 13, 2021
3dd9e98
Optimization of single parameter startup
forfreeday Sep 13, 2021
20f78c6
Optimization of single parameter startup
forfreeday Sep 13, 2021
49d6b42
Change json deploy
daxinzang1 Sep 13, 2021
06d5c1d
Change json deploy
daxinzang1 Sep 13, 2021
890e74e
enable unit test
mumianhua Sep 14, 2021
c1fc242
Merge remote-tracking branch 'origin/test/4.4.0_case' into test/4.4.0…
mumianhua Sep 14, 2021
64456da
Optimize shell.md
forfreeday Sep 14, 2021
ce4c437
Optimize shell.md
forfreeday Sep 14, 2021
8402cf1
Optimize table
forfreeday Sep 14, 2021
89b359a
Optimize table
forfreeday Sep 14, 2021
b55fc58
modify shell.md example and use steps
forfreeday Sep 14, 2021
7c9054d
remove unused import
halibobo1205 Sep 14, 2021
aa42def
Add jsonrpc test case
Yuanshandai Sep 14, 2021
216af89
Merge branch 'test/4.4.0_case' of https://github.com/tronprotocol/jav…
Yuanshandai Sep 14, 2021
8ce2318
modify shell.md example and use steps
forfreeday Sep 14, 2021
d06acd0
feat: add transactionIndex, cumulativeEnergyUsed to TransactionLogTri…
Sep 14, 2021
5f0d3fc
Add testcase
Yuanshandai Sep 14, 2021
6fcf085
feat: set blockHash to ContractTrigger
Sep 14, 2021
b0f14ed
fix testcase
Yuanshandai Sep 15, 2021
ed8b6ca
feat: add redundancy config to solidity log trigger
Sep 15, 2021
0c9cf28
fix testcase for 45
Yuanshandai Sep 15, 2021
80d932c
add test cases
mumianhua Sep 15, 2021
907ea0f
execute solidityTrigger after solidityEventTrigger and solidityLogTri…
317787106 Sep 15, 2021
4b91830
Merge remote-tracking branch 'origin/test/4.4.0_case' into test/4.4.0…
mumianhua Sep 15, 2021
8f18ab7
Merge pull request #4051 from halibobo1205/opt/remove-unused-code
forfreeday Sep 15, 2021
8c1af46
feat: add ethCompitable for transaction trigger
Sep 15, 2021
0c0235a
Merge branch 'feature/eventplugin_bttc' of ssh://github.com/tronproto…
Sep 15, 2021
21e004d
typo
Sep 15, 2021
bd2586c
feat: save hexstring of address to logPojo
Sep 15, 2021
a1a8b89
feat: add effectiveGasPrice to transactionLog
Sep 16, 2021
0327c9d
fix: to address is null when create smart contract
Sep 16, 2021
6ce8e05
feat: add effectiveGasPrice to TransactionReceipt and make result ord…
Sep 16, 2021
047d00a
feat: add order for TransactionLog in TransactionReceipt
Sep 16, 2021
d04b169
fix: fix get contract value due to proposal updated
Sep 16, 2021
50dc842
feat: clear nodeHandlerMap after test for trimTableTest_removeNotConn…
Sep 16, 2021
350a50f
typo
Sep 16, 2021
50fac88
typo
Sep 16, 2021
d9e41bb
fix(tvm): do not get energy limit from user when creating contract in…
yanghang8612 Sep 16, 2021
30e361f
feat: fix NodeManagerTest
Sep 16, 2021
59b08ce
add test cases
mumianhua Sep 16, 2021
1366a4e
Merge pull request #4059 from tronprotocol/hotfix/jsonrpc
waynercheung Sep 16, 2021
683343a
Merge pull request #4060 from tronprotocol/feature/tvm_compatible_evm
Lredhdx Sep 16, 2021
b7b944c
test: try to fix NodeManagerTest
Sep 16, 2021
b8fac0e
fix testcase
Yuanshandai Sep 16, 2021
0d1070b
typo
Sep 16, 2021
129dc1f
feat: update NodeHandlerTest
Sep 16, 2021
3f718ea
Merge remote-tracking branch 'origin/release_v4.4.0' into test/4.4.0_…
mumianhua Sep 17, 2021
dfee147
add script url
forfreeday Sep 17, 2021
d848903
add test case
mumianhua Sep 17, 2021
35ece47
fix: set contractAddress if transaction was a contract creation in tr…
Sep 17, 2021
9abdf25
Merge pull request #4061 from tronprotocol/hotfix/jsonrpc
waynercheung Sep 17, 2021
f59caee
feat: set contractAddress if transaction was a contract creation in t…
Sep 17, 2021
d8b2836
feat: add solidified to control if trigger solidity block or transaction
Sep 17, 2021
964bc41
Merge remote-tracking branch 'origin/release_v4.4.0' into test/4.4.0_…
mumianhua Sep 18, 2021
a905dae
feat: set solidity after block
Sep 18, 2021
65b6287
Merge pull request #4026 from forfreeday/feature/optimize_shell
lvs007 Sep 18, 2021
9a56518
modify format of shell.md
forfreeday Sep 18, 2021
1abf61b
Merge pull request #4062 from forfreeday/feature/optimize_shell
forfreeday Sep 18, 2021
e898ba9
Merge remote-tracking branch 'origin/release_v4.4.0' into test/4.4.0_…
mumianhua Sep 18, 2021
ca39338
fix testcase
Yuanshandai Sep 18, 2021
41a4730
Merge branch 'test/4.4.0_case' of https://github.com/tronprotocol/jav…
Yuanshandai Sep 18, 2021
2d8d3ef
fix testcase
Yuanshandai Sep 18, 2021
bbcbc15
feat: add api getenergyprices to fullnode and solidity
Sep 18, 2021
6296005
typo
Sep 18, 2021
0036c32
feat: update check to ignore log
Sep 18, 2021
e36748b
typo
Sep 19, 2021
902b8db
feat: add getenergyprices in pbft
Sep 22, 2021
9c5d2be
opt witness valid function
xxo1shine Sep 22, 2021
af81837
typo
Sep 22, 2021
b69d1c4
Merge pull request #4065 from wubin01/witness_opt
jwrct Sep 22, 2021
36013b2
Merge branch 'release_v4.4.0' into test/4.4.0_case
wangzichichi Sep 22, 2021
12acc54
Merge branch 'release_v4.4.0' into feature/eventplugin_bttc
Sep 22, 2021
99d0666
feat: set timestamp to solidity
Sep 22, 2021
a71801f
feat: update 32603 to 32000 for jsonrpc
Sep 22, 2021
76f2a7a
Merge pull request #4067 from tronprotocol/feature/eventplugin_bttc
waynercheung Sep 22, 2021
1c21c9f
Merge remote-tracking branch 'origin/release_v4.4.0' into test/4.4.0_…
mumianhua Sep 23, 2021
b48a14a
fix multisign error message
mumianhua Sep 23, 2021
1fc4632
feat: remove db after test
Sep 23, 2021
c12349c
typo
Sep 23, 2021
aa950df
feat: remove db for EnergyPriceHistoryLoaderTest
Sep 23, 2021
e0c0933
typo
Sep 23, 2021
15a7058
remove the hidden danger of blockid
xxo1shine Sep 24, 2021
721f19c
set generatedByMyself to true
xxo1shine Sep 24, 2021
6419f24
Merge pull request #4081 from wubin01/remove_blockid_danger
forfreeday Sep 24, 2021
760a55f
Merge branch 'release_v4.4.0' into test/4.4.0_case
wangzichichi Sep 24, 2021
ed2c62d
fix: set blockNum before postTransactionTrigger, reset block before p…
Sep 24, 2021
97aaaf2
typo
Sep 24, 2021
bed6263
Merge branch 'release_v4.4.0' into fix/eventplugin_bttc
Sep 24, 2021
458120c
typo
Sep 24, 2021
4578e48
feat: add some logs
Sep 24, 2021
f40fff2
Merge pull request #4082 from tronprotocol/fix/eventplugin_bttc
waynercheung Sep 24, 2021
92daff6
optimize the processing of expired transactions in the repush queue
xxo1shine Sep 28, 2021
e7d9f28
add expired logic
xxo1shine Sep 28, 2021
4c744f8
opt queue add logic
xxo1shine Sep 28, 2021
f9d9b45
opt queue add logic
xxo1shine Sep 28, 2021
99563ae
solve checkstyle problem
xxo1shine Sep 28, 2021
93a779b
Merge pull request #4088 from wubin01/opt_txs
lvs007 Sep 28, 2021
5abc309
feat(tvm,jsonrpc): cut chainid to four bytes
yanghang8612 Sep 28, 2021
c6e73db
set the blackhole account permission
Federico2014 Sep 28, 2021
c8b611a
typo
Sep 28, 2021
7a60636
Merge branch 'release_v4.4.0' into test/4.4.0_case
wangzichichi Sep 28, 2021
fb18845
feat: check if blockhole account exists
Sep 28, 2021
73b6962
test(tvm): add new CHAINID test
yanghang8612 Sep 29, 2021
fbdfed3
code(test): fix style
yanghang8612 Sep 29, 2021
a4c5c2c
feat: add blackhole config
Sep 29, 2021
9a53ee3
add testcase for energy price by http
Yuanshandai Sep 29, 2021
dbb3730
Merge branch 'release_v4.4.0' into test/remove_test_db
Sep 29, 2021
5d6bfd7
test: try to modity NodeManagerTest
Sep 29, 2021
10b7536
test: removed unused code
Sep 29, 2021
362648e
Merge pull request #4090 from tronprotocol/feature/set_blackhole_acco…
Federico2014 Sep 29, 2021
083eeb1
modify repush queue process
xxo1shine Sep 29, 2021
8d39344
Merge pull request #4069 from tronprotocol/test/remove_test_db
waynercheung Sep 29, 2021
a2b3d3d
Merge pull request #4089 from tronprotocol/feature/cut_chainid
Lredhdx Sep 29, 2021
35a1562
solve checkstyle problem
xxo1shine Sep 29, 2021
e3b04ac
Merge pull request #4093 from wubin01/release_v4.4.0_opt
lvs007 Sep 29, 2021
152e0a9
Merge release_v4.4.0
daxinzang1 Sep 30, 2021
e2fa3ce
modify testcase
Yuanshandai Sep 30, 2021
1956482
modify testcase
Yuanshandai Oct 8, 2021
34a39b1
fix case for chainid
mumianhua Oct 8, 2021
fa515aa
Merge remote-tracking branch 'origin/test/4.4.0_case' into test/4.4.0…
mumianhua Oct 8, 2021
3c45fa2
fix check style
mumianhua Oct 8, 2021
a11edf8
fix check style
mumianhua Oct 8, 2021
9f3ff13
fix ubuntu oom
mumianhua Oct 11, 2021
722d90f
revert fix
mumianhua Oct 11, 2021
f5297bb
Merge pull request #4100 from tronprotocol/test/4.4.0_case
wangzichichi Oct 12, 2021
024ba60
feat: add getCursor to Chainbase
Oct 12, 2021
4e58859
feat: disable buildTransaction in solidity and pbft
Oct 12, 2021
ad1cecf
typo: update config
Oct 12, 2021
f3a3647
Merge pull request #4104 from tronprotocol/feature/disable_buildTrans…
waynercheung Oct 12, 2021
5a507e0
change version 4.4.0
forfreeday Oct 14, 2021
cdb2a4b
Merge pull request #4111 from forfreeday/change_version
forfreeday Oct 14, 2021
9198137
fix: fix miner address, remove pre 41
Oct 14, 2021
3d61895
Merge pull request #4113 from tronprotocol/fix/miner_address
waynercheung Oct 14, 2021
ed0c7ba
modify shutdownhook catch interrupt
forfreeday Oct 14, 2021
299e146
Merge pull request #4114 from forfreeday/rix_sonar
forfreeday Oct 14, 2021
cd83f42
feat: use Thread.currentThread().getContextClassLoader() instead of t…
Oct 15, 2021
dae97ce
Merge pull request #4115 from tronprotocol/fix/sonar_classloader
waynercheung Oct 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ This guide walks the user through the TRON Quickstart (v2.0.0) image setup.
# Deploy
* [Build](./build.md) Please build java-tron after cloning the project
* [Run](./run.md) Run java-tron

* [Build & Run by shell script](./shell.md)
# Deployment
[Deployment Guide](https://tronprotocol.github.io/documentation-en/developers/deployment/)
walks the user through how to deploy a FullNode and an SR node.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.tron.common.utils.Commons;
import org.tron.common.utils.DecodeUtil;
import org.tron.core.capsule.AccountCapsule;
import org.tron.core.capsule.ContractCapsule;
import org.tron.core.capsule.TransactionResultCapsule;
import org.tron.core.exception.BalanceInsufficientException;
import org.tron.core.exception.ContractExeException;
Expand Down Expand Up @@ -137,6 +138,23 @@ public boolean validate() throws ContractValidateException {

}

// after AllowTvmCompatibleEvm proposal, send trx to smartContract which version is one
// by actuator is not allowed.
if (dynamicStore.getAllowTvmCompatibleEvm() == 1
&& toAccount != null
&& toAccount.getType() == AccountType.Contract) {

ContractCapsule contractCapsule = chainBaseManager.getContractStore().get(toAddress);
if (contractCapsule == null) { // this can not happen
throw new ContractValidateException(
"Account type is Contract, but it is not exist in contract store.");
} else if (contractCapsule.getContractVersion() == 1) {
throw new ContractValidateException(
"Cannot transfer TRX to a smartContract which version is one. " +
"Instead please use TriggerSmartContract ");
}
}

if (balance < Math.addExact(amount, fee)) {
throw new ContractValidateException(
"Validate TransferContract error, balance is not sufficient.");
Expand Down
75 changes: 44 additions & 31 deletions actuator/src/main/java/org/tron/core/actuator/VMActuator.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,24 +177,14 @@ public void execute(Object object) throws ContractExeException {
vm.play(program);
result = program.getResult();

if (isConstantCall) {
long callValue = TransactionCapsule.getCallValue(trx.getRawData().getContract(0));
long callTokenValue = TransactionUtil
.getCallTokenValue(trx.getRawData().getContract(0));
if (callValue > 0 || callTokenValue > 0) {
result.setRuntimeError("constant cannot set call value or call token value.");
result.rejectInternalTransactions();
}
if (result.getException() != null) {
result.setRuntimeError(result.getException().getMessage());
result.rejectInternalTransactions();
}
context.setProgramResult(result);
return;
}

if (TrxType.TRX_CONTRACT_CREATION_TYPE == trxType && !result.isRevert()) {
byte[] code = program.getResult().getHReturn();
if (code.length != 0 && vmConfig.allowTvmLondon() && code[0] == (byte) 0xEF) {
if (null == result.getException()) {
result.setException(Program.Exception
.invalidCodeException());
}
}
long saveCodeEnergy = (long) getLength(code) * EnergyCost.getInstance().getCREATE_DATA();
long afterSpend = program.getEnergyLimitLeft().longValue() - saveCodeEnergy;
if (afterSpend < 0) {
Expand All @@ -211,6 +201,15 @@ public void execute(Object object) throws ContractExeException {
}
}

if (isConstantCall) {
if (result.getException() != null) {
result.setRuntimeError(result.getException().getMessage());
result.rejectInternalTransactions();
}
context.setProgramResult(result);
return;
}

if (result.getException() != null || result.isRevert()) {
result.getDeleteAccounts().clear();
result.getLogInfoList().clear();
Expand Down Expand Up @@ -297,7 +296,12 @@ private void create()
if (contract == null) {
throw new ContractValidateException("Cannot get CreateSmartContract from transaction");
}
SmartContract newSmartContract = contract.getNewContract();
SmartContract newSmartContract;
if (VMConfig.allowTvmCompatibleEvm()) {
newSmartContract = contract.getNewContract().toBuilder().setVersion(1).build();
} else {
newSmartContract = contract.getNewContract().toBuilder().clearVersion().build();
}
if (!contract.getOwnerAddress().equals(newSmartContract.getOriginAddress())) {
logger.info("OwnerAddress not equals OriginAddress");
throw new ContractValidateException("OwnerAddress is not equals OriginAddress");
Expand Down Expand Up @@ -346,19 +350,23 @@ private void create()
long energyLimit;
// according to version

if (StorageUtils.getEnergyLimitHardFork()) {
if (callValue < 0) {
throw new ContractValidateException("callValue must be >= 0");
}
if (tokenValue < 0) {
throw new ContractValidateException("tokenValue must be >= 0");
}
if (newSmartContract.getOriginEnergyLimit() <= 0) {
throw new ContractValidateException("The originEnergyLimit must be > 0");
}
energyLimit = getAccountEnergyLimitWithFixRatio(creator, feeLimit, callValue);
if (isConstantCall) {
energyLimit = CommonParameter.getInstance().maxEnergyLimitForConstant;
} else {
energyLimit = getAccountEnergyLimitWithFloatRatio(creator, feeLimit, callValue);
if (StorageUtils.getEnergyLimitHardFork()) {
if (callValue < 0) {
throw new ContractValidateException("callValue must be >= 0");
}
if (tokenValue < 0) {
throw new ContractValidateException("tokenValue must be >= 0");
}
if (newSmartContract.getOriginEnergyLimit() <= 0) {
throw new ContractValidateException("The originEnergyLimit must be > 0");
}
energyLimit = getAccountEnergyLimitWithFixRatio(creator, feeLimit, callValue);
} else {
energyLimit = getAccountEnergyLimitWithFloatRatio(creator, feeLimit, callValue);
}
}

checkTokenValueAndId(tokenValue, tokenId);
Expand All @@ -377,6 +385,9 @@ private void create()
vmShouldEndInUs, energyLimit);
this.vm = new VM();
this.program = new Program(ops, programInvoke, rootInternalTransaction, vmConfig);
if (VMConfig.allowTvmCompatibleEvm()) {
this.program.setContractVersion(1);
}
byte[] txId = TransactionUtil.getTransactionId(trx).getBytes();
this.program.setRootTransactionId(txId);
if (enableEventListener && isCheckTransaction()) {
Expand Down Expand Up @@ -459,7 +470,6 @@ private void call()

byte[] code = repository.getCode(contractAddress);
if (isNotEmpty(code)) {

long feeLimit = trx.getRawData().getFeeLimit();
if (feeLimit < 0 || feeLimit > repository.getDynamicPropertiesStore().getMaxFeeLimit()) {
logger.info("invalid feeLimit {}", feeLimit);
Expand All @@ -469,7 +479,7 @@ private void call()
AccountCapsule caller = repository.getAccount(callerAddress);
long energyLimit;
if (isConstantCall) {
energyLimit = VMConstant.ENERGY_LIMIT_IN_CONSTANT_TX;
energyLimit = CommonParameter.getInstance().maxEnergyLimitForConstant;
} else {
AccountCapsule creator = repository
.getAccount(deployedContract.getInstance().getOriginAddress().toByteArray());
Expand All @@ -492,6 +502,9 @@ private void call()
this.vm = new VM();
rootInternalTransaction = new InternalTransaction(trx, trxType);
this.program = new Program(code, programInvoke, rootInternalTransaction, vmConfig);
if (VMConfig.allowTvmCompatibleEvm()) {
this.program.setContractVersion(deployedContract.getContractVersion());
}
byte[] txId = TransactionUtil.getTransactionId(trx).getBytes();
this.program.setRootTransactionId(txId);

Expand Down
41 changes: 36 additions & 5 deletions actuator/src/main/java/org/tron/core/utils/ProposalUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,17 @@ public static void validator(DynamicPropertiesStore dynamicPropertiesStore,
if (!forkController.pass(ForkBlockVersionEnum.VERSION_4_1_2)) {
throw new ContractValidateException("Bad chain parameter id [MAX_FEE_LIMIT]");
}
if (value < 0 || value > 10_000_000_000L) {
if (value < 0) {
throw new ContractValidateException(
"Bad MAX_FEE_LIMIT parameter value, valid range is [0,10_000_000_000L]");
"Bad MAX_FEE_LIMIT parameter value, value must not be negative");
} else if (value > 10_000_000_000L) {
if (dynamicPropertiesStore.getAllowTvmLondon() == 0) {
throw new ContractValidateException(
"Bad MAX_FEE_LIMIT parameter value, valid range is [0,10_000_000_000L]");
}
if (value > LONG_VALUE) {
throw new ContractValidateException(LONG_VALUE_ERROR);
}
}
break;
}
Expand Down Expand Up @@ -469,7 +477,6 @@ public static void validator(DynamicPropertiesStore dynamicPropertiesStore,
}
break;
}

case FREE_NET_LIMIT: {
if (!forkController.pass(ForkBlockVersionEnum.VERSION_4_3)) {
throw new ContractValidateException("Bad chain parameter id [FREE_NET_LIMIT]");
Expand Down Expand Up @@ -502,6 +509,28 @@ public static void validator(DynamicPropertiesStore dynamicPropertiesStore,
}
break;
}
case ALLOW_TVM_LONDON: {
if (!forkController.pass(ForkBlockVersionEnum.VERSION_4_4)) {
throw new ContractValidateException(
"Bad chain parameter id [ALLOW_TVM_LONDON]");
}
if (value != 1) {
throw new ContractValidateException(
"This value[ALLOW_TVM_LONDON] is only allowed to be 1");
}
break;
}
case ALLOW_TVM_COMPATIBLE_EVM: {
if (!forkController.pass(ForkBlockVersionEnum.VERSION_4_4)) {
throw new ContractValidateException(
"Bad chain parameter id [ALLOW_TVM_COMPATIBLE_EVM]");
}
if (value != 1) {
throw new ContractValidateException(
"This value[ALLOW_TVM_COMPATIBLE_EVM] is only allowed to be 1");
}
break;
}
default:
break;
}
Expand Down Expand Up @@ -552,16 +581,18 @@ public enum ProposalType { // current value, value range
ALLOW_MARKET_TRANSACTION(44), // {0, 1}
MARKET_SELL_FEE(45), // 0 [0,10_000_000_000]
MARKET_CANCEL_FEE(46), // 0 [0,10_000_000_000]
MAX_FEE_LIMIT(47), // [0, 10_000_000_000]
MAX_FEE_LIMIT(47), // [0, 100_000_000_000] TRX
ALLOW_TRANSACTION_FEE_POOL(48), // 0, 1
ALLOW_BLACKHOLE_OPTIMIZATION(49),// 0,1
ALLOW_NEW_RESOURCE_MODEL(51),// 0,1
ALLOW_TVM_FREEZE(52), // 0, 1
ALLOW_ACCOUNT_ASSET_OPTIMIZATION(53), // 1
// ALLOW_NEW_REWARD_ALGORITHM(58), // 0, 1
ALLOW_TVM_VOTE(59), // 0, 1
ALLOW_TVM_COMPATIBLE_EVM(60), // 0, 1
FREE_NET_LIMIT(61), // 5000, [0, 100_000]
TOTAL_NET_LIMIT(62); // 43_200_000_000L, [0, 1000_000_000_000L]
TOTAL_NET_LIMIT(62), // 43_200_000_000L, [0, 1000_000_000_000L]
ALLOW_TVM_LONDON(63); // 0, 1

private long code;

Expand Down
4 changes: 4 additions & 0 deletions actuator/src/main/java/org/tron/core/vm/OpCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ public enum OpCode {
* (0x47) Get current account balance
*/
SELFBALANCE(0x47, 0, 1, Tier.LowTier),
/**
* (0x48) Get block's basefee
*/
BASEFEE(0x48, 0, 1, Tier.BaseTier),


/* Memory, Storage and Flow Operations */
Expand Down
80 changes: 80 additions & 0 deletions actuator/src/main/java/org/tron/core/vm/PrecompiledContracts.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
import static org.tron.common.utils.BIUtil.isZero;
import static org.tron.common.utils.ByteUtil.*;
import static org.tron.core.db.TransactionTrace.convertToTronAddress;
import static java.util.Arrays.copyOfRange;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
Expand All @@ -45,6 +47,8 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.tron.common.crypto.Blake2bfMessageDigest;
import org.tron.common.crypto.Hash;
import org.tron.common.crypto.SignUtils;
import org.tron.common.crypto.SignatureInterface;
import org.tron.common.crypto.zksnark.BN128;
Expand Down Expand Up @@ -107,6 +111,9 @@ public class PrecompiledContracts {
private static final ReceivedVoteCount receivedVoteCount = new ReceivedVoteCount();
private static final TotalVoteCount totalVoteCount = new TotalVoteCount();

private static final EthRipemd160 ethRipemd160 = new EthRipemd160();
private static final Blake2F blake2F = new Blake2F();

private static final DataWord ecRecoverAddr = new DataWord(
"0000000000000000000000000000000000000000000000000000000000000001");
private static final DataWord sha256Addr = new DataWord(
Expand Down Expand Up @@ -147,6 +154,11 @@ public class PrecompiledContracts {
"0000000000000000000000000000000000000000000000000000000001000009");
private static final DataWord totalVoteCountAddr = new DataWord(
"000000000000000000000000000000000000000000000000000000000100000a");
private static final DataWord ethRipemd160Addr = new DataWord(
"0000000000000000000000000000000000000000000000000000000000020003");
private static final DataWord blake2FAddr = new DataWord(
"0000000000000000000000000000000000000000000000000000000000020009");


public static PrecompiledContract getContractForAddress(DataWord address) {

Expand Down Expand Up @@ -214,6 +226,12 @@ public static PrecompiledContract getContractForAddress(DataWord address) {
if (VMConfig.allowTvmVote() && address.equals(totalVoteCountAddr)) {
return totalVoteCount;
}
if (VMConfig.allowTvmCompatibleEvm() && address.equals(ethRipemd160Addr)) {
return ethRipemd160;
}
if (VMConfig.allowTvmCompatibleEvm() && address.equals(blake2FAddr)) {
return blake2F;
}

return null;
}
Expand Down Expand Up @@ -1721,4 +1739,66 @@ public Pair<Boolean, byte[]> execute(byte[] data) {
}
}

public static class EthRipemd160 extends PrecompiledContract {


@Override
public long getEnergyForData(byte[] data) {

if (data == null) {
return 600;
}
return 600L + (data.length + 31) / 32 * 120;
}

@Override
public Pair<Boolean, byte[]> execute(byte[] data) {

byte[] result;
if (data == null) {
result = Hash.ripemd160(EMPTY_BYTE_ARRAY);
} else {
result = Hash.ripemd160(data);
}
return Pair.of(true, new DataWord(result).getData());
}
}

public static class Blake2F extends PrecompiledContract {


@Override
public long getEnergyForData(byte[] data) {

if (data.length != 213 || (data[212] & 0xFE) != 0) {
return 0;
}
final byte[] roundsBytes = copyOfRange(data, 0, 4);
final BigInteger rounds = new BigInteger(1, roundsBytes);
return rounds.longValue();
}

@Override
public Pair<Boolean, byte[]> execute(byte[] data) {

if (data.length != 213) {
logger.info("Incorrect input length. Expected {} and got {}", 213, data.length);
return Pair.of(false, DataWord.ZERO().getData());
}
if ((data[212] & 0xFE) != 0) {
logger.info("Incorrect finalization flag, expected 0 or 1 and got {}", data[212]);
return Pair.of(false, DataWord.ZERO().getData());
}
final MessageDigest digest = new Blake2bfMessageDigest();
byte[] result;
try {
digest.update(data);
result = digest.digest();
} catch (Exception e) {
return Pair.of(true, EMPTY_BYTE_ARRAY);
}
return Pair.of(true, result);
}
}

}
Loading