Skip to content

Commit b259af0

Browse files
committed
improve spend cpu and storage in method go().
1 parent de96e93 commit b259af0

3 files changed

Lines changed: 208 additions & 53 deletions

File tree

src/main/java/org/tron/core/Constant.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public class Constant {
5151
public static final long CPU_LIMIT_IN_ONE_TX_OF_SMART_CONTRACT = 100000; // 100 ms = 100000 us
5252
public static final long STORAGE_LIMIT_IN_ONE_TX_OF_SMART_CONTRACT = 32 * 1024 * 1024L; // 32MB
5353
public static final long CPU_IN_US_PER_TRX = 1000000 / 30; // 1 us <-> 30 SUN <-> 30 * 10^-6 TRX
54-
public static final long MAX_CONSUME_USER_RESOURCE_PERCENT = 100L; // 1 us <-> 30 SUN <-> 30 * 10^-6 TRX
55-
public static final long MIN_CONSUME_USER_RESOURCE_PERCENT = 0L; // 1 us <-> 30 SUN <-> 30 * 10^-6 TRX
56-
public static final long ACCORD_RANGE_PERCENT = 0L; // 1 us <-> 30 SUN <-> 30 * 10^-6 TRX
54+
public static final long MAX_CONSUME_USER_RESOURCE_PERCENT = 100L;
55+
public static final long MIN_CONSUME_USER_RESOURCE_PERCENT = 0L;
56+
public static final long ACCORD_RANGE_PERCENT = 0L;
5757

5858
}

src/main/java/org/tron/core/db/TransactionTrace.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public void init() throws ContractValidateException {
3838
List<Contract> contractList = trx.getInstance().getRawData().getContractList();
3939
long castMaxTrx = 0;
4040
for (Contract contract : contractList) {
41-
castMaxTrx = Math.addExact(castMaxTrx, TransactionCapsule.getCpuLimitInTrx(contract));
42-
castMaxTrx = Math.addExact(castMaxTrx, TransactionCapsule.getStorageLimitInTrx(contract));
43-
castMaxTrx = Math.addExact(castMaxTrx, TransactionCapsule.getCallValue(contract));
41+
// castMaxTrx = Math.addExact(castMaxTrx, TransactionCapsule.getCpuLimitInTrx(contract));
42+
// castMaxTrx = Math.addExact(castMaxTrx, TransactionCapsule.getStorageLimitInTrx(contract));
43+
// castMaxTrx = Math.addExact(castMaxTrx, TransactionCapsule.getCallValue(contract));
4444
}
4545
if (owner.getBalance() < castMaxTrx) {
4646
throw new ContractValidateException(

src/main/resources/config.conf

Lines changed: 202 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// 配置文件
21
net {
32
type = mainnet
43
# type = testnet
@@ -21,24 +20,24 @@ storage {
2120

2221
# Attention: name is a required field that must be set !!!
2322
properties = [
24-
// {
25-
// name = "account",
26-
// path = "storage_directory_test",
27-
// createIfMissing = true,
28-
// paranoidChecks = true,
29-
// verifyChecksums = true,
23+
// {
24+
// name = "account",
25+
// path = "storage_directory_test",
26+
// createIfMissing = true,
27+
// paranoidChecks = true,
28+
// verifyChecksums = true,
3029
// compressionType = 1, // compressed with snappy
3130
// blockSize = 4096, // 4 KB = 4 * 1024 B
3231
// writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B
3332
// cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B
3433
// maxOpenFiles = 100
3534
// },
36-
// {
37-
// name = "account-index",
38-
// path = "storage_directory_test",
39-
// createIfMissing = true,
40-
// paranoidChecks = true,
41-
// verifyChecksums = true,
35+
// {
36+
// name = "account-index",
37+
// path = "storage_directory_test",
38+
// createIfMissing = true,
39+
// paranoidChecks = true,
40+
// verifyChecksums = true,
4241
// compressionType = 1, // compressed with snappy
4342
// blockSize = 4096, // 4 KB = 4 * 1024 B
4443
// writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B
@@ -50,7 +49,7 @@ storage {
5049
}
5150

5251
node.discovery = {
53-
enable = false
52+
enable = true
5453
persist = true
5554
bind.ip = ""
5655
external.ip = null
@@ -82,19 +81,22 @@ node {
8281
# Number of validate sign thread, default availableProcessors / 2
8382
# validateSignThreadNum = 16
8483

84+
connectFactor = 0.3
85+
activeConnectFactor = 0.1
86+
8587
maxActiveNodes = 30
8688

8789
maxActiveNodesWithSameIp = 2
8890

89-
minParticipationRate = 0
91+
minParticipationRate = 15
9092

9193
# check the peer data transfer ,disconnect factor
9294
disconnectNumberFactor = 0.4
9395
maxConnectNumberFactor = 0.8
9496
receiveTcpMinDataLength = 2048
9597

9698
p2p {
97-
version = 10000 # 10000: mainnet; 71: testnet
99+
version = 11111 # 11111: mainnet; 20180622: testnet
98100
}
99101

100102
active = [
@@ -111,6 +113,11 @@ node {
111113
# "ip:port"
112114
]
113115

116+
http {
117+
fullNodePort = 8090
118+
solidityPort = 8091
119+
}
120+
114121
rpc {
115122
port = 50051
116123

@@ -139,25 +146,46 @@ node {
139146
}
140147

141148

149+
142150
seed.node = {
143151
# List of the seed nodes
144152
# Seed nodes are stable full nodes
145153
# example:
154+
# ip.list = [
155+
# "ip:port",
156+
# "ip:port"
157+
# ]
146158
ip.list = [
147-
"127.0.0.1:18888"
159+
"54.236.37.243:18888",
160+
"52.53.189.99:18888",
161+
"18.196.99.16:18888",
162+
"34.253.187.192:18888",
163+
"52.56.56.149:18888",
164+
"35.180.51.163:18888",
165+
"54.252.224.209:18888",
166+
"18.228.15.36:18888",
167+
"52.15.93.92:18888",
168+
"34.220.77.106:18888",
169+
"13.127.47.162:18888",
170+
"13.124.62.58:18888",
171+
"13.229.128.108:18888",
172+
"35.182.37.246:18888",
173+
"34.200.228.125:18888",
174+
"18.220.232.201:18888",
175+
"13.57.30.186:18888",
176+
"35.165.103.105:18888",
177+
"18.184.238.21:18888",
178+
"34.250.140.143:18888",
179+
"35.176.192.130:18888",
180+
"52.47.197.188:18888",
181+
"52.62.210.100:18888",
182+
"13.231.4.243:18888",
183+
"18.231.76.29:18888",
184+
"35.154.90.144:18888",
185+
"13.125.210.234:18888",
186+
"13.250.40.82:18888",
187+
"35.183.101.48:18888"
148188
]
149-
// ip.list = [
150-
// "47.91.246.252:18888",
151-
// "39.106.220.120:18888",
152-
// "35.169.113.187:18888",
153-
// "18.208.116.213:18888",
154-
// "18.188.111.53:18888",
155-
// "52.14.211.18:18888",
156-
// "54.219.41.56:18888",
157-
// "13.57.78.225:18888",
158-
// "34.214.241.188:18888",
159-
// "54.200.48.177:18888"
160-
// ]
161189
}
162190

163191
genesis.block = {
@@ -166,48 +194,175 @@ genesis.block = {
166194
{
167195
accountName = "Zion"
168196
accountType = "AssetIssue"
169-
address = "TTMKgisRekC8ZahM3MouCHsk9A3JZJKcn1"
170-
balance = "95000000000000000"
197+
address = "TLLM21wteSPs4hKjbxgmH1L6poyMjeTbHm"
198+
balance = "99000000000000000"
171199
},
172200
{
173201
accountName = "Sun"
174202
accountType = "AssetIssue"
175-
address = "TBHBkZg8TgSBBui4u33P8dEyZBKGLwkyeP"
176-
balance = "5000000000000000"
203+
address = "TXmVpin5vq5gdZsciyyjdZgKRUju4st1wM"
204+
balance = "0"
177205
},
178206
{
179207
accountName = "Blackhole"
180208
accountType = "AssetIssue"
181-
address = "TSJD5rdu6wZXP7F2m3a3tn8Co3JcMjtBip"
209+
address = "TLsV52sRDL79HXGGm9yzwKibb6BeruhUzy"
182210
balance = "-9223372036854775808"
183211
}
184212
]
185213

186214
witnesses = [
187215
{
188-
address: TTMKgisRekC8ZahM3MouCHsk9A3JZJKcn1,
189-
url = "http://Jack.com",
190-
voteCount = 100027
216+
address: THKJYuUmMKKARNf7s2VT51g5uPY6KEqnat,
217+
url = "http://GR1.com",
218+
voteCount = 100000026
219+
},
220+
{
221+
address: TVDmPWGYxgi5DNeW8hXrzrhY8Y6zgxPNg4,
222+
url = "http://GR2.com",
223+
voteCount = 100000025
224+
},
225+
{
226+
address: TWKZN1JJPFydd5rMgMCV5aZTSiwmoksSZv,
227+
url = "http://GR3.com",
228+
voteCount = 100000024
229+
},
230+
{
231+
address: TDarXEG2rAD57oa7JTK785Yb2Et32UzY32,
232+
url = "http://GR4.com",
233+
voteCount = 100000023
234+
},
235+
{
236+
address: TAmFfS4Tmm8yKeoqZN8x51ASwdQBdnVizt,
237+
url = "http://GR5.com",
238+
voteCount = 100000022
239+
},
240+
{
241+
address: TK6V5Pw2UWQWpySnZyCDZaAvu1y48oRgXN,
242+
url = "http://GR6.com",
243+
voteCount = 100000021
244+
},
245+
{
246+
address: TGqFJPFiEqdZx52ZR4QcKHz4Zr3QXA24VL,
247+
url = "http://GR7.com",
248+
voteCount = 100000020
249+
},
250+
{
251+
address: TC1ZCj9Ne3j5v3TLx5ZCDLD55MU9g3XqQW,
252+
url = "http://GR8.com",
253+
voteCount = 100000019
254+
},
255+
{
256+
address: TWm3id3mrQ42guf7c4oVpYExyTYnEGy3JL,
257+
url = "http://GR9.com",
258+
voteCount = 100000018
259+
},
260+
{
261+
address: TCvwc3FV3ssq2rD82rMmjhT4PVXYTsFcKV,
262+
url = "http://GR10.com",
263+
voteCount = 100000017
264+
},
265+
{
266+
address: TFuC2Qge4GxA2U9abKxk1pw3YZvGM5XRir,
267+
url = "http://GR11.com",
268+
voteCount = 100000016
269+
},
270+
{
271+
address: TNGoca1VHC6Y5Jd2B1VFpFEhizVk92Rz85,
272+
url = "http://GR12.com",
273+
voteCount = 100000015
274+
},
275+
{
276+
address: TLCjmH6SqGK8twZ9XrBDWpBbfyvEXihhNS,
277+
url = "http://GR13.com",
278+
voteCount = 100000014
279+
},
280+
{
281+
address: TEEzguTtCihbRPfjf1CvW8Euxz1kKuvtR9,
282+
url = "http://GR14.com",
283+
voteCount = 100000013
284+
},
285+
{
286+
address: TZHvwiw9cehbMxrtTbmAexm9oPo4eFFvLS,
287+
url = "http://GR15.com",
288+
voteCount = 100000012
289+
},
290+
{
291+
address: TGK6iAKgBmHeQyp5hn3imB71EDnFPkXiPR,
292+
url = "http://GR16.com",
293+
voteCount = 100000011
294+
},
295+
{
296+
address: TLaqfGrxZ3dykAFps7M2B4gETTX1yixPgN,
297+
url = "http://GR17.com",
298+
voteCount = 100000010
299+
},
300+
{
301+
address: TX3ZceVew6yLC5hWTXnjrUFtiFfUDGKGty,
302+
url = "http://GR18.com",
303+
voteCount = 100000009
304+
},
305+
{
306+
address: TYednHaV9zXpnPchSywVpnseQxY9Pxw4do,
307+
url = "http://GR19.com",
308+
voteCount = 100000008
309+
},
310+
{
311+
address: TCf5cqLffPccEY7hcsabiFnMfdipfyryvr,
312+
url = "http://GR20.com",
313+
voteCount = 100000007
314+
},
315+
{
316+
address: TAa14iLEKPAetX49mzaxZmH6saRxcX7dT5,
317+
url = "http://GR21.com",
318+
voteCount = 100000006
319+
},
320+
{
321+
address: TBYsHxDmFaRmfCF3jZNmgeJE8sDnTNKHbz,
322+
url = "http://GR22.com",
323+
voteCount = 100000005
324+
},
325+
{
326+
address: TEVAq8dmSQyTYK7uP1ZnZpa6MBVR83GsV6,
327+
url = "http://GR23.com",
328+
voteCount = 100000004
329+
},
330+
{
331+
address: TRKJzrZxN34YyB8aBqqPDt7g4fv6sieemz,
332+
url = "http://GR24.com",
333+
voteCount = 100000003
334+
},
335+
{
336+
address: TRMP6SKeFUt5NtMLzJv8kdpYuHRnEGjGfe,
337+
url = "http://GR25.com",
338+
voteCount = 100000002
339+
},
340+
{
341+
address: TDbNE1VajxjpgM5p7FyGNDASt3UVoFbiD3,
342+
url = "http://GR26.com",
343+
voteCount = 100000001
344+
},
345+
{
346+
address: TLTDZBcPoJ8tZ6TTEeEqEvwYFk2wgotSfD,
347+
url = "http://GR27.com",
348+
voteCount = 100000000
191349
}
192350
]
193351

194352
timestamp = "0" #2017-8-26 12:00:00
195353

196-
parentHash = "0x0000000000000000000000000000000000000000000000000000000000000000"
354+
parentHash = "0xe58f33f9baf9305dc6f82b9f1934ea8f0ade2defb951258d50167028c780351f"
197355
}
198356

199357
localwitness = [
200-
FE22C55DCF5CBA27241796EEF710C7445CFEDCDA2F3DF886E1E0DCF8FEEB73E0
201358
]
202359

203-
# localwitnesskeystore = [
204-
# "src/main/resources/localwitnesskeystore.json"
205-
# ]
360+
#localwitnesskeystore = [
361+
# "localwitnesskeystore.json"
362+
#]
206363

207364
block = {
208-
needSyncCheck = false # first node : false, other : true
209-
maintenanceTimeInterval = 21600000 // 1 day: 86400000(ms), 6 hours: 21600000(ms)
365+
needSyncCheck = true
366+
maintenanceTimeInterval = 21600000
367+
proposalExpireTime = 259200000 // 3 day: 259200000(ms)
210368
}
211-
212-
213-

0 commit comments

Comments
 (0)