From fbdc5de8f644f99df4a5b183537a7824d3b479e6 Mon Sep 17 00:00:00 2001 From: geb789 Date: Thu, 14 Nov 2019 12:33:05 +0800 Subject: [PATCH] fix --- .../rocksdb/RocksDbDataSourceImpl.java | 1 + .../java/org/tron/common/utils/DBConfig.java | 2 +- common/build.gradle | 2 + .../tron/common/config}/DbBackupConfig.java | 2 +- .../tron/common/option/KademliaOptions.java | 13 + .../common/parameter/CommonParameter.java | 428 +++++++++++ .../parameter}/RateLimiterInitialization.java | 2 +- .../tron/common/setting}/RocksDbSettings.java | 2 +- .../common/overlay/discover/node/Node.java | 75 +- .../java/org/tron/core/config/args/Args.java | 455 +---------- .../services/http/RateLimiterServlet.java | 2 +- .../ratelimiter/RateLimiterInterceptor.java | 2 +- framework/src/main/resources/config.conf | 708 +++++------------- 13 files changed, 670 insertions(+), 1024 deletions(-) rename {framework/src/main/java/org/tron/core/db/backup => common/src/main/java/org/tron/common/config}/DbBackupConfig.java (98%) create mode 100644 common/src/main/java/org/tron/common/option/KademliaOptions.java create mode 100644 common/src/main/java/org/tron/common/parameter/CommonParameter.java rename {framework/src/main/java/org/tron/core/config/args => common/src/main/java/org/tron/common/parameter}/RateLimiterInitialization.java (98%) rename {chainbase/src/main/java/org/tron/common/storage/rocksdb => common/src/main/java/org/tron/common/setting}/RocksDbSettings.java (99%) diff --git a/chainbase/src/main/java/org/tron/common/storage/rocksdb/RocksDbDataSourceImpl.java b/chainbase/src/main/java/org/tron/common/storage/rocksdb/RocksDbDataSourceImpl.java index 11bddc3f8cc..a1adea668ae 100644 --- a/chainbase/src/main/java/org/tron/common/storage/rocksdb/RocksDbDataSourceImpl.java +++ b/chainbase/src/main/java/org/tron/common/storage/rocksdb/RocksDbDataSourceImpl.java @@ -26,6 +26,7 @@ import org.rocksdb.Statistics; import org.rocksdb.WriteBatch; import org.rocksdb.WriteOptions; +import org.tron.common.setting.RocksDbSettings; import org.tron.common.storage.WriteOptionsWrapper; import org.tron.common.utils.FileUtil; import org.tron.common.utils.PropUtil; diff --git a/chainbase/src/main/java/org/tron/common/utils/DBConfig.java b/chainbase/src/main/java/org/tron/common/utils/DBConfig.java index d69cd0f599c..fb2f8f4b6b9 100644 --- a/chainbase/src/main/java/org/tron/common/utils/DBConfig.java +++ b/chainbase/src/main/java/org/tron/common/utils/DBConfig.java @@ -9,7 +9,7 @@ import org.apache.commons.lang3.StringUtils; import org.iq80.leveldb.CompressionType; import org.iq80.leveldb.Options; -import org.tron.common.storage.rocksdb.RocksDbSettings; +import org.tron.common.setting.RocksDbSettings; import org.tron.core.config.args.GenesisBlock; public class DBConfig { diff --git a/common/build.gradle b/common/build.gradle index 969e264e62a..dadc60b4c57 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -18,5 +18,7 @@ dependencies { compile "com.cedarsoftware:java-util:1.8.0" compile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.1.1' compile group: 'commons-codec', name: 'commons-codec', version: '1.11' + compile group: 'com.beust', name: 'jcommander', version: '1.72' + compile group: 'com.typesafe', name: 'config', version: '1.3.2' compile project(":protocol") } diff --git a/framework/src/main/java/org/tron/core/db/backup/DbBackupConfig.java b/common/src/main/java/org/tron/common/config/DbBackupConfig.java similarity index 98% rename from framework/src/main/java/org/tron/core/db/backup/DbBackupConfig.java rename to common/src/main/java/org/tron/common/config/DbBackupConfig.java index bd9ea957307..694ae7c3155 100644 --- a/framework/src/main/java/org/tron/core/db/backup/DbBackupConfig.java +++ b/common/src/main/java/org/tron/common/config/DbBackupConfig.java @@ -1,4 +1,4 @@ -package org.tron.core.db.backup; +package org.tron.common.config; import java.io.File; import lombok.Getter; diff --git a/common/src/main/java/org/tron/common/option/KademliaOptions.java b/common/src/main/java/org/tron/common/option/KademliaOptions.java new file mode 100644 index 00000000000..b2fd6865fa6 --- /dev/null +++ b/common/src/main/java/org/tron/common/option/KademliaOptions.java @@ -0,0 +1,13 @@ +package org.tron.common.option; + +public class KademliaOptions { + + public static final int NODE_ID_LEN = 64; + public static final int BUCKET_SIZE = 16; + public static final int ALPHA = 3; + public static final int BINS = 256; + public static final int MAX_STEPS = 8; + + public static final long BUCKET_REFRESH = 7200; //bucket refreshing interval in millis + public static final long DISCOVER_CYCLE = 30; //discovery cycle interval in seconds +} diff --git a/common/src/main/java/org/tron/common/parameter/CommonParameter.java b/common/src/main/java/org/tron/common/parameter/CommonParameter.java new file mode 100644 index 00000000000..2a698af0378 --- /dev/null +++ b/common/src/main/java/org/tron/common/parameter/CommonParameter.java @@ -0,0 +1,428 @@ +package org.tron.common.parameter; + +import com.beust.jcommander.Parameter; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import lombok.Getter; +import lombok.Setter; +import org.tron.common.config.DbBackupConfig; +import org.tron.common.setting.RocksDbSettings; + +public class CommonParameter { + @Parameter(names = {"-c", "--config"}, description = "Config File") + protected String shellConfFileName = ""; + + @Parameter(names = {"-d", "--output-directory"}, description = "Directory") + protected String outputDirectory = "output-directory"; + + @Getter + @Parameter(names = {"--log-config"}) + protected String logbackPath = ""; + + @Getter + @Parameter(names = {"-h", "--help"}, help = true, description = "HELP message") + protected boolean help = false; + + @Getter + @Setter + @Parameter(names = {"-w", "--witness"}) + protected boolean witness = false; + + @Getter + @Setter + @Parameter(names = {"--support-constant"}) + protected boolean supportConstant = false; + + @Getter + @Setter + @Parameter(names = {"--debug"}) + protected boolean debug = false; + + @Getter + @Setter + @Parameter(names = {"--min-time-ratio"}) + protected double minTimeRatio = 0.0; + + @Getter + @Setter + @Parameter(names = {"--max-time-ratio"}) + protected double maxTimeRatio = calcMaxTimeRatio(); + + @Getter + @Setter + @Parameter(names = {"--long-running-time"}) + protected int longRunningTime = 10; + + @Getter + @Setter + @Parameter(names = {"--max-connect-number"}) + protected int maxHttpConnectNumber = 50; + + @Getter + @Parameter(description = "--seed-nodes") + protected List seedNodes = new ArrayList<>(); + + @Parameter(names = {"-p", "--private-key"}, description = "private-key") + protected String privateKey = ""; + + @Parameter(names = {"--witness-address"}, description = "witness-address") + protected String witnessAddress = ""; + + @Parameter(names = {"--password"}, description = "password") + protected String password; + + @Parameter(names = {"--storage-db-directory"}, description = "Storage db directory") + protected String storageDbDirectory = ""; + + @Parameter(names = {"--storage-db-version"}, description = "Storage db version.(1 or 2)") + protected String storageDbVersion = ""; + + @Parameter(names = { + "--storage-db-engine"}, description = "Storage db engine.(leveldb or rocksdb)") + protected String storageDbEngine = ""; + + @Parameter(names = { + "--storage-db-synchronous"}, + description = "Storage db is synchronous or not.(true or false)") + protected String storageDbSynchronous = ""; + + @Parameter(names = {"--contract-parse-enable"}, + description = "enable contract parses in java-tron or not.(true or false)") + protected String contractParseEnable = ""; + + @Parameter(names = {"--storage-index-directory"}, + description = "Storage index directory") + protected String storageIndexDirectory = ""; + + @Parameter(names = {"--storage-index-switch"}, description = "Storage index switch.(on or off)") + protected String storageIndexSwitch = ""; + + @Parameter(names = {"--storage-transactionHistory-switch"}, + description = "Storage transaction history switch.(on or off)") + protected String storageTransactionHistoreSwitch = ""; + + @Getter + @Parameter(names = {"--fast-forward"}) + protected boolean fastForward = false; + + @Getter + @Setter + protected String chainId; + + @Getter + @Setter + protected boolean needSyncCheck; + + @Getter + @Setter + protected boolean nodeDiscoveryEnable; + + @Getter + @Setter + protected boolean nodeDiscoveryPersist; + + @Getter + @Setter + protected int nodeConnectionTimeout; + + @Getter + @Setter + protected int nodeChannelReadTimeout; + + @Getter + @Setter + protected int nodeMaxActiveNodes; + + @Getter + @Setter + protected int nodeMaxActiveNodesWithSameIp; + + @Getter + @Setter + protected int minParticipationRate; + + @Getter + @Setter + protected int nodeListenPort; + + @Getter + @Setter + protected String nodeDiscoveryBindIp; + + @Getter + @Setter + protected String nodeExternalIp; + + @Getter + @Setter + protected boolean nodeDiscoveryPublicHomeNode; + + @Getter + @Setter + protected long nodeP2pPingInterval; + + @Getter + @Setter + @Parameter(names = {"--save-internaltx"}) + protected boolean saveInternalTx; + + @Getter + @Setter + protected int nodeP2pVersion; + + @Getter + @Setter + protected String p2pNodeId; + + //If you are running a solidity node for java tron, this flag is set to true + @Getter + @Setter + protected boolean solidityNode = false; + + @Getter + @Setter + protected int rpcPort; + + @Getter + @Setter + protected int rpcOnSolidityPort; + + @Getter + @Setter + protected int fullNodeHttpPort; + + @Getter + @Setter + protected int solidityHttpPort; + + @Getter + @Setter + @Parameter(names = {"--rpc-thread"}, description = "Num of gRPC thread") + protected int rpcThreadNum; + + @Getter + @Setter + @Parameter(names = {"--solidity-thread"}, description = "Num of solidity thread") + protected int solidityThreads; + + @Getter + @Setter + protected int maxConcurrentCallsPerConnection; + + @Getter + @Setter + protected int flowControlWindow; + + @Getter + @Setter + protected long maxConnectionIdleInMillis; + + @Getter + @Setter + protected int blockProducedTimeOut; + + @Getter + @Setter + protected long netMaxTrxPerSecond; + + @Getter + @Setter + protected long maxConnectionAgeInMillis; + + @Getter + @Setter + protected int maxMessageSize; + + @Getter + @Setter + protected int maxHeaderListSize; + + @Getter + @Setter + @Parameter(names = {"--validate-sign-thread"}, description = "Num of validate thread") + protected int validateSignThreadNum; + + @Getter + @Setter + protected long maintenanceTimeInterval; // (ms) + + @Getter + @Setter + protected long proposalExpireTime; // (ms) + + @Getter + @Setter + protected int checkFrozenTime; // for test only + + @Getter + @Setter + protected long allowCreationOfContracts; //committee parameter + + @Getter + @Setter + protected long allowAdaptiveEnergy; //committee parameter + + @Getter + @Setter + protected long allowDelegateResource; //committee parameter + + @Getter + @Setter + protected long allowSameTokenName; //committee parameter + + @Getter + @Setter + protected long allowTvmTransferTrc10; //committee parameter + + @Getter + @Setter + protected long allowTvmConstantinople; //committee parameter + + @Getter + @Setter + protected long allowTvmSolidity059; //committee parameter + + @Getter + @Setter + protected int tcpNettyWorkThreadNum; + + @Getter + @Setter + protected int udpNettyWorkThreadNum; + + @Getter + @Setter + @Parameter(names = {"--trust-node"}, description = "Trust node addr") + protected String trustNodeAddr; + + @Getter + @Setter + protected boolean walletExtensionApi; + + @Getter + @Setter + protected int backupPriority; + + @Getter + @Setter + protected int backupPort; + + @Getter + @Setter + protected List backupMembers; + + @Getter + @Setter + protected double connectFactor; + + @Getter + @Setter + protected double activeConnectFactor; + + @Getter + @Setter + protected double disconnectNumberFactor; + + @Getter + @Setter + protected double maxConnectNumberFactor; + + @Getter + @Setter + protected long receiveTcpMinDataLength; + + @Getter + @Setter + protected boolean isOpenFullTcpDisconnect; + + @Getter + @Setter + protected int allowMultiSign; + + @Getter + @Setter + protected boolean vmTrace; + + @Getter + @Setter + protected boolean needToUpdateAsset; + + @Getter + @Setter + protected String trxReferenceBlock; + + @Getter + @Setter + protected int minEffectiveConnection; + + @Getter + @Setter + protected long allowShieldedTransaction; //committee parameter + + // full node used this parameter to close shielded transaction + @Getter + @Setter + protected boolean fullNodeAllowShieldedTransactionArgs; + + @Getter + @Setter + protected long blockNumForEneryLimit; + + @Getter + @Setter + @Parameter(names = {"--es"}) + protected boolean eventSubscribe = false; + + @Getter + @Setter + protected long trxExpirationTimeInMilliseconds; // (ms) + + @Parameter(names = {"-v", "--version"}, description = "output code version", help = true) + protected boolean version; + + + @Getter + @Setter + protected String zenTokenId; + + @Getter + @Setter + protected long allowProtoFilterNum; + + @Getter + @Setter + protected long allowAccountStateRoot; + + @Getter + @Setter + protected int validContractProtoThreadNum; + + @Getter + @Setter + protected int shieldedTransInPendingMaxCounts; + + @Getter + @Setter + protected long changedDelegation; + + @Getter + @Setter + protected Set actuatorSet; + + @Getter + @Setter + protected RateLimiterInitialization rateLimiterInitialization; + + + @Getter + protected DbBackupConfig dbBackupConfig; + + @Getter + protected RocksDbSettings rocksDBCustomSettings; + + private static double calcMaxTimeRatio() { + //return max(2.0, min(5.0, 5 * 4.0 / max(Runtime.getRuntime().availableProcessors(), 1))); + return 5.0; + } +} diff --git a/framework/src/main/java/org/tron/core/config/args/RateLimiterInitialization.java b/common/src/main/java/org/tron/common/parameter/RateLimiterInitialization.java similarity index 98% rename from framework/src/main/java/org/tron/core/config/args/RateLimiterInitialization.java rename to common/src/main/java/org/tron/common/parameter/RateLimiterInitialization.java index e7ba34ef0e6..9ae7eb7db68 100644 --- a/framework/src/main/java/org/tron/core/config/args/RateLimiterInitialization.java +++ b/common/src/main/java/org/tron/common/parameter/RateLimiterInitialization.java @@ -1,4 +1,4 @@ -package org.tron.core.config.args; +package org.tron.common.parameter; import com.typesafe.config.ConfigObject; import java.util.HashMap; diff --git a/chainbase/src/main/java/org/tron/common/storage/rocksdb/RocksDbSettings.java b/common/src/main/java/org/tron/common/setting/RocksDbSettings.java similarity index 99% rename from chainbase/src/main/java/org/tron/common/storage/rocksdb/RocksDbSettings.java rename to common/src/main/java/org/tron/common/setting/RocksDbSettings.java index 61d312af9e3..c9d2fe13181 100644 --- a/chainbase/src/main/java/org/tron/common/storage/rocksdb/RocksDbSettings.java +++ b/common/src/main/java/org/tron/common/setting/RocksDbSettings.java @@ -1,4 +1,4 @@ -package org.tron.common.storage.rocksdb; +package org.tron.common.setting; import lombok.Getter; import lombok.Setter; diff --git a/framework/src/main/java/org/tron/common/overlay/discover/node/Node.java b/framework/src/main/java/org/tron/common/overlay/discover/node/Node.java index d68fc6eee5a..41624ee351e 100644 --- a/framework/src/main/java/org/tron/common/overlay/discover/node/Node.java +++ b/framework/src/main/java/org/tron/common/overlay/discover/node/Node.java @@ -8,7 +8,6 @@ import lombok.Setter; import org.apache.commons.lang3.StringUtils; import org.spongycastle.util.encoders.Hex; -import org.tron.common.overlay.discover.table.KademliaOptions; import org.tron.common.utils.ByteArray; import org.tron.common.utils.Utils; import org.tron.core.config.args.Args; @@ -33,6 +32,36 @@ public class Node implements Serializable { private boolean isFakeNodeId = false; + public int getReputation() { + return reputation; + } + + public void setReputation(int reputation) { + this.reputation = reputation; + } + + public static Node instanceOf(String addressOrEnode) { + try { + URI uri = new URI(addressOrEnode); + if ("enode".equals(uri.getScheme())) { + return new Node(addressOrEnode); + } + } catch (URISyntaxException e) { + // continue + } + + final String generatedNodeId = Hex.toHexString(getNodeId()); + final Node node = new Node("enode://" + generatedNodeId + "@" + addressOrEnode); + return node; + } + + public String getEnodeURL() { + return new StringBuilder("enode://") + .append(ByteArray.toHexString(id)).append("@") + .append(host).append(":") + .append(port).toString(); + } + public Node(String enodeURL) { try { URI uri = new URI(enodeURL); @@ -67,43 +96,6 @@ public Node(byte[] id, String host, int port, int bindPort) { this.bindPort = bindPort; } - public static Node instanceOf(String addressOrEnode) { - try { - URI uri = new URI(addressOrEnode); - if ("enode".equals(uri.getScheme())) { - return new Node(addressOrEnode); - } - } catch (URISyntaxException e) { - // continue - } - - final String generatedNodeId = Hex.toHexString(getNodeId()); - final Node node = new Node("enode://" + generatedNodeId + "@" + addressOrEnode); - return node; - } - - public static byte[] getNodeId() { - Random gen = new Random(); - byte[] id = new byte[KademliaOptions.NODE_ID_LEN]; - gen.nextBytes(id); - return id; - } - - public int getReputation() { - return reputation; - } - - public void setReputation(int reputation) { - this.reputation = reputation; - } - - public String getEnodeURL() { - return new StringBuilder("enode://") - .append(ByteArray.toHexString(id)).append("@") - .append(host).append(":") - .append(port).toString(); - } - public boolean isConnectible() { return port == bindPort && p2pVersion == Args.getInstance().getNodeP2pVersion(); } @@ -147,6 +139,13 @@ public String getIdString() { return new String(id); } + public static byte[] getNodeId() { + Random gen = new Random(); + byte[] id = new byte[64]; + gen.nextBytes(id); + return id; + } + @Override public String toString() { return "Node{" + " host='" + host + '\'' + ", port=" + port diff --git a/framework/src/main/java/org/tron/core/config/args/Args.java b/framework/src/main/java/org/tron/core/config/args/Args.java index 1a72f6a7e53..d4469c7b40f 100644 --- a/framework/src/main/java/org/tron/core/config/args/Args.java +++ b/framework/src/main/java/org/tron/core/config/args/Args.java @@ -6,7 +6,6 @@ import static org.tron.core.Constant.ADD_PRE_FIX_BYTE_MAINNET; import com.beust.jcommander.JCommander; -import com.beust.jcommander.Parameter; import com.typesafe.config.Config; import com.typesafe.config.ConfigObject; import io.grpc.internal.GrpcUtil; @@ -39,12 +38,15 @@ import org.apache.commons.lang3.StringUtils; import org.spongycastle.util.encoders.Hex; import org.springframework.stereotype.Component; +import org.tron.common.config.DbBackupConfig; import org.tron.common.crypto.ECKey; import org.tron.common.logsfilter.EventPluginConfig; import org.tron.common.logsfilter.FilterQuery; import org.tron.common.logsfilter.TriggerConfig; import org.tron.common.overlay.discover.node.Node; -import org.tron.common.storage.rocksdb.RocksDbSettings; +import org.tron.common.parameter.CommonParameter; +import org.tron.common.parameter.RateLimiterInitialization; +import org.tron.common.setting.RocksDbSettings; import org.tron.common.utils.ByteArray; import org.tron.common.utils.Commons; import org.tron.common.utils.DBConfig; @@ -53,7 +55,6 @@ import org.tron.core.config.Configuration; import org.tron.core.config.Parameter.NetConstants; import org.tron.core.config.Parameter.NodeConstant; -import org.tron.core.db.backup.DbBackupConfig; import org.tron.core.store.AccountStore; import org.tron.keystore.CipherException; import org.tron.keystore.Credentials; @@ -63,105 +64,21 @@ @Slf4j(topic = "app") @NoArgsConstructor @Component -public class Args { +public class Args extends CommonParameter { private static final Args INSTANCE = new Args(); - @Parameter(names = {"-c", "--config"}, description = "Config File") - private String shellConfFileName = ""; - - @Parameter(names = {"-d", "--output-directory"}, description = "Directory") - private String outputDirectory = "output-directory"; - - @Getter - @Parameter(names = {"--log-config"}) - private String logbackPath = ""; - - @Getter - @Parameter(names = {"-h", "--help"}, help = true, description = "HELP message") - private boolean help = false; - - @Getter - @Setter - @Parameter(names = {"-w", "--witness"}) - private boolean witness = false; - - @Getter - @Setter - @Parameter(names = {"--support-constant"}) - private boolean supportConstant = false; - - @Getter - @Setter - @Parameter(names = {"--debug"}) - private boolean debug = false; - - @Getter - @Setter - @Parameter(names = {"--min-time-ratio"}) - private double minTimeRatio = 0.0; - @Getter @Setter - @Parameter(names = {"--max-time-ratio"}) - private double maxTimeRatio = calcMaxTimeRatio(); + private List activeNodes; @Getter @Setter - @Parameter(names = {"--long-running-time"}) - private int longRunningTime = 10; + private List passiveNodes; @Getter @Setter - @Parameter(names = {"--max-connect-number"}) - private int maxHttpConnectNumber = 50; - - @Getter - @Parameter(description = "--seed-nodes") - private List seedNodes = new ArrayList<>(); - - @Parameter(names = {"-p", "--private-key"}, description = "private-key") - private String privateKey = ""; - - @Parameter(names = {"--witness-address"}, description = "witness-address") - private String witnessAddress = ""; - - @Parameter(names = {"--password"}, description = "password") - private String password; - - @Parameter(names = {"--storage-db-directory"}, description = "Storage db directory") - private String storageDbDirectory = ""; - - @Parameter(names = {"--storage-db-version"}, description = "Storage db version.(1 or 2)") - private String storageDbVersion = ""; - - @Parameter(names = { - "--storage-db-engine"}, description = "Storage db engine.(leveldb or rocksdb)") - private String storageDbEngine = ""; - - @Parameter(names = { - "--storage-db-synchronous"}, - description = "Storage db is synchronous or not.(true or false)") - private String storageDbSynchronous = ""; - - @Parameter(names = {"--contract-parse-enable"}, - description = "enable contract parses in java-tron or not.(true or false)") - private String contractParseEnable = ""; - - @Parameter(names = {"--storage-index-directory"}, - description = "Storage index directory") - private String storageIndexDirectory = ""; - - @Parameter(names = {"--storage-index-switch"}, description = "Storage index switch.(on or off)") - private String storageIndexSwitch = ""; - - @Parameter(names = {"--storage-transactionHistory-switch"}, - description = "Storage transaction history switch.(on or off)") - private String storageTransactionHistoreSwitch = ""; - - @Getter - @Parameter(names = {"--fast-forward"}) - private boolean fastForward = false; + private List fastForwardNodes; @Getter private Storage storage; @@ -175,342 +92,16 @@ public class Args { @Getter private GenesisBlock genesisBlock; - @Getter - @Setter - private String chainId; - @Getter @Setter private LocalWitnesses localWitnesses = new LocalWitnesses(); - @Getter - @Setter - private boolean needSyncCheck; - - @Getter - @Setter - private boolean nodeDiscoveryEnable; - - @Getter - @Setter - private boolean nodeDiscoveryPersist; - - @Getter - @Setter - private int nodeConnectionTimeout; - - @Getter - @Setter - private List activeNodes; - - @Getter - @Setter - private List passiveNodes; - - @Getter - @Setter - private List fastForwardNodes; - - @Getter - @Setter - private int nodeChannelReadTimeout; - - @Getter - @Setter - private int nodeMaxActiveNodes; - - @Getter - @Setter - private int nodeMaxActiveNodesWithSameIp; - - @Getter - @Setter - private int minParticipationRate; - - @Getter - @Setter - private int nodeListenPort; - - @Getter - @Setter - private String nodeDiscoveryBindIp; - - @Getter - @Setter - private String nodeExternalIp; - - @Getter - @Setter - private boolean nodeDiscoveryPublicHomeNode; - - @Getter - @Setter - private long nodeP2pPingInterval; - - @Getter - @Setter - @Parameter(names = {"--save-internaltx"}) - private boolean saveInternalTx; - - @Getter - @Setter - private int nodeP2pVersion; - - @Getter - @Setter - private String p2pNodeId; - - //If you are running a solidity node for java tron, this flag is set to true - @Getter - @Setter - private boolean solidityNode = false; - - @Getter - @Setter - private int rpcPort; - - @Getter - @Setter - private int rpcOnSolidityPort; - - @Getter - @Setter - private int fullNodeHttpPort; - - @Getter - @Setter - private int solidityHttpPort; - - @Getter - @Setter - @Parameter(names = {"--rpc-thread"}, description = "Num of gRPC thread") - private int rpcThreadNum; - - @Getter - @Setter - @Parameter(names = {"--solidity-thread"}, description = "Num of solidity thread") - private int solidityThreads; - - @Getter - @Setter - private int maxConcurrentCallsPerConnection; - - @Getter - @Setter - private int flowControlWindow; - - @Getter - @Setter - private long maxConnectionIdleInMillis; - - @Getter - @Setter - private int blockProducedTimeOut; - - @Getter - @Setter - private long netMaxTrxPerSecond; - - @Getter - @Setter - private long maxConnectionAgeInMillis; - - @Getter - @Setter - private int maxMessageSize; - - @Getter - @Setter - private int maxHeaderListSize; - - @Getter - @Setter - @Parameter(names = {"--validate-sign-thread"}, description = "Num of validate thread") - private int validateSignThreadNum; - - @Getter - @Setter - private long maintenanceTimeInterval; // (ms) - - @Getter - @Setter - private long proposalExpireTime; // (ms) - - @Getter - @Setter - private int checkFrozenTime; // for test only - - @Getter - @Setter - private long allowCreationOfContracts; //committee parameter - - @Getter - @Setter - private long allowAdaptiveEnergy; //committee parameter - - @Getter - @Setter - private long allowDelegateResource; //committee parameter - - @Getter - @Setter - private long allowSameTokenName; //committee parameter - - @Getter - @Setter - private long allowTvmTransferTrc10; //committee parameter - - @Getter - @Setter - private long allowTvmConstantinople; //committee parameter - - @Getter - @Setter - private long allowTvmSolidity059; //committee parameter - - @Getter - @Setter - private int tcpNettyWorkThreadNum; - - @Getter - @Setter - private int udpNettyWorkThreadNum; - - @Getter - @Setter - @Parameter(names = {"--trust-node"}, description = "Trust node addr") - private String trustNodeAddr; - - @Getter - @Setter - private boolean walletExtensionApi; - - @Getter - @Setter - private int backupPriority; - - @Getter - @Setter - private int backupPort; - - @Getter - @Setter - private List backupMembers; - - @Getter - @Setter - private double connectFactor; - - @Getter - @Setter - private double activeConnectFactor; - - @Getter - @Setter - private double disconnectNumberFactor; - - @Getter - @Setter - private double maxConnectNumberFactor; - - @Getter - @Setter - private long receiveTcpMinDataLength; - - @Getter - @Setter - private boolean isOpenFullTcpDisconnect; - - @Getter - @Setter - private int allowMultiSign; - - @Getter - @Setter - private boolean vmTrace; - - @Getter - @Setter - private boolean needToUpdateAsset; - - @Getter - @Setter - private String trxReferenceBlock; - - @Getter - @Setter - private int minEffectiveConnection; - - @Getter - @Setter - private long allowShieldedTransaction; //committee parameter - - // full node used this parameter to close shielded transaction - @Getter - @Setter - private boolean fullNodeAllowShieldedTransactionArgs; - - @Getter - @Setter - private long blockNumForEneryLimit; - - @Getter - @Setter - @Parameter(names = {"--es"}) - private boolean eventSubscribe = false; - @Getter private EventPluginConfig eventPluginConfig; @Getter private FilterQuery eventFilter; - @Getter - @Setter - private long trxExpirationTimeInMilliseconds; // (ms) - - @Getter - private DbBackupConfig dbBackupConfig; - - @Getter - private RocksDbSettings rocksDBCustomSettings; - - @Parameter(names = {"-v", "--version"}, description = "output code version", help = true) - private boolean version; - - - @Getter - @Setter - private String zenTokenId; - - @Getter - @Setter - private long allowProtoFilterNum; - - @Getter - @Setter - private long allowAccountStateRoot; - - @Getter - @Setter - private int validContractProtoThreadNum; - - @Getter - @Setter - private int shieldedTransInPendingMaxCounts; - - @Getter - @Setter - private RateLimiterInitialization rateLimiterInitialization; - - @Getter - @Setter - private long changedDelegation; - - @Getter - @Setter - private Set actuatorSet; - public static void clearParam() { INSTANCE.outputDirectory = "output-directory"; INSTANCE.help = false; @@ -1360,11 +951,6 @@ private static void externalIp(final com.typesafe.config.Config config) { } } - private static double calcMaxTimeRatio() { - //return max(2.0, min(5.0, 5 * 4.0 / max(Runtime.getRuntime().availableProcessors(), 1))); - return 5.0; - } - private static void initRocksDbSettings(Config config) { String prefix = "storage.dbSettings."; int levelNumber = config.hasPath(prefix + "levelNumber") @@ -1465,32 +1051,7 @@ public static void initDBConfig(Args cfgArgs) { DBConfig.setOutputDirectoryConfig(cfgArgs.getOutputDirectory()); DBConfig.setRocksDbSettings(cfgArgs.getRocksDBCustomSettings()); - DBConfig.setAllowMultiSign(cfgArgs.getAllowMultiSign()); - DBConfig.setMaintenanceTimeInterval(cfgArgs.getMaintenanceTimeInterval()); - DBConfig.setAllowAdaptiveEnergy(cfgArgs.getAllowAdaptiveEnergy()); - DBConfig.setAllowDelegateResource(cfgArgs.getAllowDelegateResource()); - DBConfig.setAllowTvmTransferTrc10(cfgArgs.getAllowTvmTransferTrc10()); - DBConfig.setAllowTvmConstantinople(cfgArgs.getAllowTvmConstantinople()); - DBConfig.setAllowTvmSolidity059(cfgArgs.getAllowTvmSolidity059()); - DBConfig.setAllowSameTokenName(cfgArgs.getAllowSameTokenName()); - DBConfig.setAllowCreationOfContracts(cfgArgs.getAllowCreationOfContracts()); - DBConfig.setAllowShieldedTransaction(cfgArgs.getAllowShieldedTransaction()); - DBConfig.setAllowAccountStateRoot(cfgArgs.getAllowAccountStateRoot()); - DBConfig.setAllowProtoFilterNum(cfgArgs.getAllowProtoFilterNum()); - DBConfig.setProposalExpireTime(cfgArgs.getProposalExpireTime()); - DBConfig.setBlockNumForEneryLimit(cfgArgs.getBlockNumForEneryLimit()); DBConfig.setFullNodeAllowShieldedTransaction(cfgArgs.isFullNodeAllowShieldedTransactionArgs()); - DBConfig.setZenTokenId(cfgArgs.getZenTokenId()); - DBConfig.setCheckFrozenTime(cfgArgs.getCheckFrozenTime()); - DBConfig.setValidContractProtoThreadNum(cfgArgs.getValidContractProtoThreadNum()); - DBConfig.setVmTrace(cfgArgs.isVmTrace()); - DBConfig.setDebug(cfgArgs.isDebug()); - DBConfig.setMinTimeRatio(cfgArgs.getMinTimeRatio()); - DBConfig.setMaxTimeRatio(cfgArgs.getMaxTimeRatio()); - DBConfig.setSolidityNode(cfgArgs.isSolidityNode()); - DBConfig.setSupportConstant(cfgArgs.isSupportConstant()); - DBConfig.setLongRunningTime(cfgArgs.getLongRunningTime()); - DBConfig.setChangedDelegation(cfgArgs.getChangedDelegation()); DBConfig.setActuatorSet(cfgArgs.getActuatorSet()); } diff --git a/framework/src/main/java/org/tron/core/services/http/RateLimiterServlet.java b/framework/src/main/java/org/tron/core/services/http/RateLimiterServlet.java index f9d0ae7a139..8fa47fd60eb 100644 --- a/framework/src/main/java/org/tron/core/services/http/RateLimiterServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/RateLimiterServlet.java @@ -9,8 +9,8 @@ import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.tron.common.parameter.RateLimiterInitialization; import org.tron.core.config.args.Args; -import org.tron.core.config.args.RateLimiterInitialization; import org.tron.core.services.ratelimiter.RateLimiterContainer; import org.tron.core.services.ratelimiter.RuntimeData; import org.tron.core.services.ratelimiter.adapter.DefaultBaseQqsAdapter; diff --git a/framework/src/main/java/org/tron/core/services/ratelimiter/RateLimiterInterceptor.java b/framework/src/main/java/org/tron/core/services/ratelimiter/RateLimiterInterceptor.java index 2d85bd5d7b0..51d3ddea64c 100644 --- a/framework/src/main/java/org/tron/core/services/ratelimiter/RateLimiterInterceptor.java +++ b/framework/src/main/java/org/tron/core/services/ratelimiter/RateLimiterInterceptor.java @@ -16,8 +16,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.common.parameter.RateLimiterInitialization.RpcRateLimiterItem; import org.tron.core.config.args.Args; -import org.tron.core.config.args.RateLimiterInitialization.RpcRateLimiterItem; import org.tron.core.services.ratelimiter.adapter.DefaultBaseQqsAdapter; import org.tron.core.services.ratelimiter.adapter.GlobalPreemptibleAdapter; import org.tron.core.services.ratelimiter.adapter.IPQPSRateLimiterAdapter; diff --git a/framework/src/main/resources/config.conf b/framework/src/main/resources/config.conf index efaf3d530ba..7e081d75d28 100644 --- a/framework/src/main/resources/config.conf +++ b/framework/src/main/resources/config.conf @@ -1,551 +1,193 @@ -net { - type = mainnet - # type = testnet -} - -storage { - # Directory for storing persistent data - db.version = 2, - db.engine = "LEVELDB", - db.sync = false, - db.directory = "database", - index.directory = "index", - transHistory.switch = "on", - # You can custom these 14 databases' configs: - - # account, account-index, asset-issue, block, block-index, - # block_KDB, peers, properties, recent-block, trans, - # utxo, votes, witness, witness_schedule. - - # Otherwise, db configs will remain defualt and data will be stored in - # the path of "output-directory" or which is set by "-d" ("--output-directory"). - - # Attention: name is a required field that must be set !!! - properties = [ - // { - // name = "account", - // path = "storage_directory_test", - // createIfMissing = true, - // paranoidChecks = true, - // verifyChecksums = true, - // compressionType = 1, // compressed with snappy - // blockSize = 4096, // 4 KB = 4 * 1024 B - // writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // maxOpenFiles = 100 - // }, - // { - // name = "account-index", - // path = "storage_directory_test", - // createIfMissing = true, - // paranoidChecks = true, - // verifyChecksums = true, - // compressionType = 1, // compressed with snappy - // blockSize = 4096, // 4 KB = 4 * 1024 B - // writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // maxOpenFiles = 100 - // }, +actuator { + whitelist=[ + WitnessCreateActuator, + UnfreezeAssetActuator, + ProposalApproveActuator, + UpdateEnergyLimitContractActuator, + AccountPermissionUpdateActuator, + VoteWitnessActuator, + ExchangeInjectActuator, + ExchangeTransactionActuator, + UpdateBrokerageActuator, + ClearABIContractActuator, + UnfreezeBalanceActuator, + UpdateAssetActuator, + UpdateSettingContractActuator, + UpdateAccountActuator, + TransferActuator, + ShieldedTransferActuator, + TransferAssetActuator, + CreateAccountActuator, + ProposalDeleteActuator, + AssetIssueActuator, + FreezeBalanceActuator, + ParticipateAssetIssueActuator, + ExchangeWithdrawActuator, + ProposalCreateActuator, + WitnessUpdateActuator, + ExchangeCreateActuator, + SetAccountIdActuator, + WithdrawBalanceActuator ] - - needToUpdateAsset = true - - //dbsettings is needed when using rocksdb as the storage implement (db.version=2 and db.engine="ROCKSDB"). - //we'd strongly recommend that do not modify it unless you know every item's meaning clearly. - dbSettings = { - levelNumber = 7 - //compactThreads = 32 - blocksize = 64 // n * KB - maxBytesForLevelBase = 256 // n * MB - maxBytesForLevelMultiplier = 10 - level0FileNumCompactionTrigger = 4 - targetFileSizeBase = 256 // n * MB - targetFileSizeMultiplier = 1 +} +block { + checkFrozenTime=0 + maintenanceTimeInterval=30000 + needSyncCheck=false + proposalExpireTime=6000 +} +committee { + allowAccountStateRoot=1 + allowAdaptiveEnergy=1 + allowCreationOfContracts=1 + allowDeferredTransaction=1 + allowDelegateResource=1 + allowMultiSign=1 + allowProtoFilterNum=1 + allowSameTokenName=1 + allowTvmConstantinople=1 + allowTvmSolidity059=1 + allowTvmTransferTrc10=1 + changedDelegation=1 +} +connectFactor=0.3 +enery { + limit { + block { + num=0 + } } - - //backup settings when using rocks db as the storage implement (db.version=2 and db.engine="ROCKSDB"). - //if you want to use the backup plugin, please confirm set the db.version=2 and db.engine="ROCKSDB" above. - backup = { - enable = false // indicate whether enable the backup plugin - propPath = "prop.properties" // record which bak directory is valid - bak1path = "bak1/database" // you must set two backup directories to prevent application halt unexpected(e.g. kill -9). - bak2path = "bak2/database" - frequency = 10000 // indicate backup db once every 10000 blocks processed. +} +genesis { + block { + assets=[ + { + accountName=Zion + accountType=AssetIssue + address=TLLM21wteSPs4hKjbxgmH1L6poyMjeTbHm + balance=99000000000000000 + }, + { + accountName=Sun + accountType=AssetIssue + address=TXmVpin5vq5gdZsciyyjdZgKRUju4st1wM + balance=0 + }, + { + accountName=Blackhole + accountType=AssetIssue + address=TLsV52sRDL79HXGGm9yzwKibb6BeruhUzy + balance=-9223372036854775808 + } + ] + parentHash="0x0000000000000000000000000000000000000000000000000000000000000000" + timestamp="0" + witnesses=[ + { + address=TT1smsmhxype64boboU8xTuNZVCKP1w6qT + url="http://www.baidu.com" + voteCount=104 + }, + { + address=TB4B1RMhoPeivkj4Hebm6tttHjRY9yQFes + url="http://www.taobao.com" + voteCount=104 + } + ] } } - -node.discovery = { - enable = true - persist = true - bind.ip = "" - external.ip = null +localwitness=[] +log { + level { + root=INFO + } } - -node.backup { - port = 10001 - - # my priority, each member should use different priority - priority = 8 - - # peer's ip list, can't contain mine - members = [ - # "ip", - # "ip" - ] +net { + type=mainnet } - node { - # trust node for solidity node - # trustNode = "ip:port" - trustNode = "127.0.0.1:50051" - - # expose extension api to public or not - walletExtensionApi = true - - listen.port = 18888 - - connection.timeout = 2 - - tcpNettyWorkThreadNum = 0 - - udpNettyWorkThreadNum = 1 - - # Number of validate sign thread, default availableProcessors / 2 - # validateSignThreadNum = 16 - - connectFactor = 0.3 - activeConnectFactor = 0.1 - - maxActiveNodes = 30 - - maxActiveNodesWithSameIp = 2 - - maxHttpConnectNumber = 50 - - minParticipationRate = 15 - - # check the peer data transfer ,disconnect factor - disconnectNumberFactor = 0.4 - maxConnectNumberFactor = 0.8 - receiveTcpMinDataLength = 2048 - isOpenFullTcpDisconnect = true - - p2p { - version = 11111 # 11111: mainnet; 20180622: testnet + active=[] + activeConnectFactor=0.1 + backup { + members=[] + port=10001 + priority=8 } - - active = [ - # Active establish connection in any case - # Sample entries: - # "ip:port", - # "ip:port" - ] - - passive = [ - # Passive accept connection in any case - # Sample entries: - # "ip:port", - # "ip:port" - ] - - fastForward = [ - "100.26.245.209:18888", - "15.188.6.125:18888" - ] - + blockProducedTimeOut=50 + connectFactor=0.3 + connection { + timeout=2 + } + disconnectNumberFactor=0.4 + discovery { + bind { + ip="" + } + enable=true + external { + ip=null + } + persist=true + } + fullNodeAllowShieldedTransaction=true http { - fullNodePort = 8090 - solidityPort = 8091 + fullNodePort=50061 + solidityPort=8191 } - + isOpenFullTcpDisconnect=true + listen { + port=18889 + } + maxActiveNodes=30 + maxActiveNodesWithSameIp=2 + maxConnectNumberFactor=0.8 + maxHttpConnectNumber=50 + minParticipationRate=0 + p2p { + version=708 + } + receiveTcpMinDataLength=2048 rpc { - port = 50051 - #solidityPort = 50061 - # Number of gRPC thread, default availableProcessors / 2 - # thread = 16 - - # The maximum number of concurrent calls permitted for each incoming connection - # maxConcurrentCallsPerConnection = - - # The HTTP/2 flow control window, default 1MB - # flowControlWindow = - - # Connection being idle for longer than which will be gracefully terminated - maxConnectionIdleInMillis = 60000 - - # Connection lasting longer than which will be gracefully terminated - # maxConnectionAgeInMillis = - - # The maximum message size allowed to be received on the server, default 4MB - # maxMessageSize = - - # The maximum size of header list allowed to be received, default 8192 - # maxHeaderListSize = - - # Transactions can only be broadcast if the number of effective connections is reached. - minEffectiveConnection = 1 + maxConnectionIdleInMillis=60000 + port=50051 + solidityPort=8190 } - - # number of solidity thread in the FullNode. - # If accessing solidity rpc and http interface timeout, could increase the number of threads, - # The default value is the number of cpu cores of the machine. - #solidity.threads = 8 - - # Limits the maximum percentage (default 75%) of producing block interval - # to provide sufficient time to perform other operations e.g. broadcast block - # blockProducedTimeOut = 75 - - # Limits the maximum number (default 700) of transaction from network layer - # netMaxTrxPerSecond = 700 -} - -## rate limiter config -rate.limiter = { - # Every api could be set a specific rate limit strategy. Three strategy are supported:GlobalPreemptibleAdapter、IPQPSRateLimiterAdapte、QpsRateLimiterAdapter - # GlobalPreemptibleAdapter: permit is the number of preemptible resource, every client must apply one resourse - # before do the request and release the resource after got the reponse automaticlly. permit should be a Integer. - # QpsRateLimiterAdapter: qps is the average request count in one second supported by the server, it could be a Double or a Integer. - # IPQPSRateLimiterAdapter: similar to the QpsRateLimiterAdapter, qps could be a Double or a Integer. - # If do not set, the "default strategy" is set.The "default startegy" is based on QpsRateLimiterAdapter, the qps is set as 10000. - # - # Sample entries: - # - http = [ - # { - # component = "GetNowBlockServlet", - # strategy = "GlobalPreemptibleAdapter", - # paramString = "permit=1" - # }, - - # { - # component = "GetAccountServlet", - # strategy = "IPQPSRateLimiterAdapter", - # paramString = "qps=1" - # }, - - # { - # component = "ListWitnessesServlet", - # strategy = "QpsRateLimiterAdapter", - # paramString = "qps=1" - # } - ], - - rpc = [ - # { - # component = "protocol.Wallet/GetBlockByLatestNum2", - # strategy = "GlobalPreemptibleAdapter", - # paramString = "permit=1" - # }, - - # { - # component = "protocol.Wallet/GetAccount", - # strategy = "IPQPSRateLimiterAdapter", - # paramString = "qps=1" - # }, - - # { - # component = "protocol.Wallet/ListWitnesses", - # strategy = "QpsRateLimiterAdapter", - # paramString = "qps=1" - # }, - ] - + tcpNettyWorkThreadNum=0 + trustNode="127.0.0.1:50051" + udpNettyWorkThreadNum=1 + walletExtensionApi=true + zenTokenId=1000001 } - - -seed.node = { - # List of the seed nodes - # Seed nodes are stable full nodes - # example: - # ip.list = [ - # "ip:port", - # "ip:port" - # ] - ip.list = [ - "54.236.37.243:18888", - "52.53.189.99:18888", - "18.196.99.16:18888", - "34.253.187.192:18888", - "52.56.56.149:18888", - "35.180.51.163:18888", - "54.252.224.209:18888", - "18.228.15.36:18888", - "52.15.93.92:18888", - "34.220.77.106:18888", - "13.127.47.162:18888", - "13.124.62.58:18888", - "13.229.128.108:18888", - "35.182.37.246:18888", - "34.200.228.125:18888", - "18.220.232.201:18888", - "13.57.30.186:18888", - "35.165.103.105:18888", - "18.184.238.21:18888", - "34.250.140.143:18888", - "35.176.192.130:18888", - "52.47.197.188:18888", - "52.62.210.100:18888", - "13.231.4.243:18888", - "18.231.76.29:18888", - "35.154.90.144:18888", - "13.125.210.234:18888", - "13.250.40.82:18888", - "35.183.101.48:18888" - ] -} - -genesis.block = { - # Reserve balance - assets = [ - { - accountName = "Zion" - accountType = "AssetIssue" - address = "TLLM21wteSPs4hKjbxgmH1L6poyMjeTbHm" - balance = "99000000000000000" - }, - { - accountName = "Sun" - accountType = "AssetIssue" - address = "TXmVpin5vq5gdZsciyyjdZgKRUju4st1wM" - balance = "0" - }, - { - accountName = "Blackhole" - accountType = "AssetIssue" - address = "TLsV52sRDL79HXGGm9yzwKibb6BeruhUzy" - balance = "-9223372036854775808" +seed { + node { + ip { + list=[ + "47.252.2.112:18889", + "47.252.3.198:18889", + "47.89.189.124:18889" + ] } - ] - - witnesses = [ - { - address: THKJYuUmMKKARNf7s2VT51g5uPY6KEqnat, - url = "http://GR1.com", - voteCount = 100000026 - }, - { - address: TVDmPWGYxgi5DNeW8hXrzrhY8Y6zgxPNg4, - url = "http://GR2.com", - voteCount = 100000025 - }, - { - address: TWKZN1JJPFydd5rMgMCV5aZTSiwmoksSZv, - url = "http://GR3.com", - voteCount = 100000024 - }, - { - address: TDarXEG2rAD57oa7JTK785Yb2Et32UzY32, - url = "http://GR4.com", - voteCount = 100000023 - }, - { - address: TAmFfS4Tmm8yKeoqZN8x51ASwdQBdnVizt, - url = "http://GR5.com", - voteCount = 100000022 - }, - { - address: TK6V5Pw2UWQWpySnZyCDZaAvu1y48oRgXN, - url = "http://GR6.com", - voteCount = 100000021 - }, - { - address: TGqFJPFiEqdZx52ZR4QcKHz4Zr3QXA24VL, - url = "http://GR7.com", - voteCount = 100000020 - }, - { - address: TC1ZCj9Ne3j5v3TLx5ZCDLD55MU9g3XqQW, - url = "http://GR8.com", - voteCount = 100000019 - }, - { - address: TWm3id3mrQ42guf7c4oVpYExyTYnEGy3JL, - url = "http://GR9.com", - voteCount = 100000018 - }, - { - address: TCvwc3FV3ssq2rD82rMmjhT4PVXYTsFcKV, - url = "http://GR10.com", - voteCount = 100000017 - }, - { - address: TFuC2Qge4GxA2U9abKxk1pw3YZvGM5XRir, - url = "http://GR11.com", - voteCount = 100000016 - }, - { - address: TNGoca1VHC6Y5Jd2B1VFpFEhizVk92Rz85, - url = "http://GR12.com", - voteCount = 100000015 - }, - { - address: TLCjmH6SqGK8twZ9XrBDWpBbfyvEXihhNS, - url = "http://GR13.com", - voteCount = 100000014 - }, - { - address: TEEzguTtCihbRPfjf1CvW8Euxz1kKuvtR9, - url = "http://GR14.com", - voteCount = 100000013 - }, - { - address: TZHvwiw9cehbMxrtTbmAexm9oPo4eFFvLS, - url = "http://GR15.com", - voteCount = 100000012 - }, - { - address: TGK6iAKgBmHeQyp5hn3imB71EDnFPkXiPR, - url = "http://GR16.com", - voteCount = 100000011 - }, - { - address: TLaqfGrxZ3dykAFps7M2B4gETTX1yixPgN, - url = "http://GR17.com", - voteCount = 100000010 - }, - { - address: TX3ZceVew6yLC5hWTXnjrUFtiFfUDGKGty, - url = "http://GR18.com", - voteCount = 100000009 - }, - { - address: TYednHaV9zXpnPchSywVpnseQxY9Pxw4do, - url = "http://GR19.com", - voteCount = 100000008 - }, - { - address: TCf5cqLffPccEY7hcsabiFnMfdipfyryvr, - url = "http://GR20.com", - voteCount = 100000007 - }, - { - address: TAa14iLEKPAetX49mzaxZmH6saRxcX7dT5, - url = "http://GR21.com", - voteCount = 100000006 - }, - { - address: TBYsHxDmFaRmfCF3jZNmgeJE8sDnTNKHbz, - url = "http://GR22.com", - voteCount = 100000005 - }, - { - address: TEVAq8dmSQyTYK7uP1ZnZpa6MBVR83GsV6, - url = "http://GR23.com", - voteCount = 100000004 - }, - { - address: TRKJzrZxN34YyB8aBqqPDt7g4fv6sieemz, - url = "http://GR24.com", - voteCount = 100000003 - }, - { - address: TRMP6SKeFUt5NtMLzJv8kdpYuHRnEGjGfe, - url = "http://GR25.com", - voteCount = 100000002 - }, - { - address: TDbNE1VajxjpgM5p7FyGNDASt3UVoFbiD3, - url = "http://GR26.com", - voteCount = 100000001 - }, - { - address: TLTDZBcPoJ8tZ6TTEeEqEvwYFk2wgotSfD, - url = "http://GR27.com", - voteCount = 100000000 - } - ] - - timestamp = "0" #2017-8-26 12:00:00 - - parentHash = "0xe58f33f9baf9305dc6f82b9f1934ea8f0ade2defb951258d50167028c780351f" -} - -// Optional.The default is empty. -// It is used when the witness account has set the witnessPermission. -// When it is not empty, the localWitnessAccountAddress represents the address of the witness account, -// and the localwitness is configured with the private key of the witnessPermissionAddress in the witness account. -// When it is empty,the localwitness is configured with the private key of the witness account. - -//localWitnessAccountAddress = - -localwitness = [ -] - -#localwitnesskeystore = [ -# "localwitnesskeystore.json" -#] - -block = { - needSyncCheck = true - maintenanceTimeInterval = 21600000 - proposalExpireTime = 259200000 // 3 day: 259200000(ms) -} - -# Transaction reference block, default is "head", configure to "solid" can avoid TaPos error -# trx.reference.block = "head" // head;solid; - -# This property sets the number of milliseconds after the creation of the transaction that is expired, default value is 60000. -# trx.expiration.timeInMilliseconds = 60000 - -vm = { - supportConstant = false - minTimeRatio = 0.0 - maxTimeRatio = 5.0 - saveInternalTx = false - - # In rare cases, transactions that will be within the specified maximum execution time (default 10(ms)) are re-executed and packaged - # longRunningTime = 10 -} - -committee = { - allowCreationOfContracts = 0 //mainnet:0 (reset by committee),test:1 - allowAdaptiveEnergy = 0 //mainnet:0 (reset by committee),test:1 + } } - -event.subscribe = { - native = { - useNativeQueue = true // if true, use native message queue, else use event plugin. - bindport = 5555 // bind port - sendqueuelength = 1000 //max length of send queue +storage { + db { + directory=database + engine=LEVELDB + sync=true + version=2 } - - path = "" // absolute path of plugin - server = "" // target server address to receive event triggers - dbconfig = "" // dbname|username|password - contractParse = true, - topics = [ - { - triggerName = "block" // block trigger, the value can't be modified - enable = false - topic = "block" // plugin topic, the value could be modified - }, - { - triggerName = "transaction" - enable = false - topic = "transaction" - }, - { - triggerName = "contractevent" - enable = false - topic = "contractevent" - }, - { - triggerName = "contractlog" - enable = false - topic = "contractlog" - } - ] - - filter = { - fromblock = "" // the value could be "", "earliest" or a specified block number as the beginning of the queried range - toblock = "" // the value could be "", "latest" or a specified block number as end of the queried range - contractAddress = [ - "" // contract address you want to subscribe, if it's set to "", you will receive contract logs/events with any contract address. - ] - - contractTopic = [ - "" // contract topic you want to subscribe, if it's set to "", you will receive contract logs/events with any contract topic. - ] + index { + directory=index + } + needToUpdateAsset=true + properties=[] + transHistory { + switch=on } - } +vm { + maxTimeRatio=10 + minTimeRatio=0 + saveInternalTx=true + supportConstant=true +} \ No newline at end of file