diff --git a/README.md b/README.md index e409e0407..6fc904a43 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,6 @@ git subtree pull --prefix src/main/protos/ protocol master ## Run the included *.sh files to initialize the dependencies +# Note❕ +To reduce the size of the generated JavaScript bundle, unnecessary parts of the Java-Tron protocol definition were removed. + diff --git a/core/Discover.proto b/core/Discover.proto deleted file mode 100644 index 4cc0d83b0..000000000 --- a/core/Discover.proto +++ /dev/null @@ -1,44 +0,0 @@ -syntax = "proto3"; - -package protocol; - - -option java_package = "org.tron.protos"; //Specify the name of the package that generated the Java file -option java_outer_classname = "Discover"; //Specify the class name of the generated Java file -option go_package = "github.com/tronprotocol/grpc-gateway/core"; - -message Endpoint { - bytes address = 1; - int32 port = 2; - bytes nodeId = 3; -} - -message PingMessage { - Endpoint from = 1; - Endpoint to = 2; - int32 version = 3; - int64 timestamp = 4; -} - -message PongMessage { - Endpoint from = 1; - int32 echo = 2; - int64 timestamp = 3; -} - -message FindNeighbours { - Endpoint from = 1; - bytes targetId = 2; - int64 timestamp = 3; -} - -message Neighbours { - Endpoint from = 1; - repeated Endpoint neighbours = 2; - int64 timestamp = 3; -} - -message BackupMessage { - bool flag = 1; - int32 priority = 2; -} \ No newline at end of file diff --git a/core/Tron.proto b/core/Tron.proto index 493b07bd0..290de38b8 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -1,7 +1,6 @@ syntax = "proto3"; import "google/protobuf/any.proto"; -import "core/Discover.proto"; package protocol; @@ -58,75 +57,6 @@ message Exchange { int64 second_token_balance = 9; } -// market -message MarketOrder { - bytes order_id = 1; - bytes owner_address = 2; - int64 create_time = 3; - bytes sell_token_id = 4; - int64 sell_token_quantity = 5; - bytes buy_token_id = 6; - int64 buy_token_quantity = 7; // min to receive - int64 sell_token_quantity_remain = 9; - // When state != ACTIVE and sell_token_quantity_return !=0, - //it means that some sell tokens are returned to the account due to insufficient remaining amount - int64 sell_token_quantity_return = 10; - - enum State { - ACTIVE = 0; - INACTIVE = 1; - CANCELED = 2; - } - State state = 11; - - bytes prev = 12; - bytes next = 13; -} - -message MarketOrderList { - repeated MarketOrder orders = 1; -} - -message MarketOrderPairList { - repeated MarketOrderPair orderPair = 1; -} - -message MarketOrderPair{ - bytes sell_token_id = 1; - bytes buy_token_id = 2; -} - -message MarketAccountOrder { - bytes owner_address = 1; - repeated bytes orders = 2; // order_id list - int64 count = 3; // active count - int64 total_count = 4; -} - -message MarketPrice { - int64 sell_token_quantity = 1; - int64 buy_token_quantity = 2; -} - -message MarketPriceList { - bytes sell_token_id = 1; - bytes buy_token_id = 2; - repeated MarketPrice prices = 3; -} - -message MarketOrderIdList { - bytes head = 1; - bytes tail = 2; -} - -message ChainParameters { - repeated ChainParameter chainParameter = 1; - message ChainParameter { - string key = 1; - int64 value = 2; - } -} - /* Account */ message Account { /* frozen balance */ @@ -270,37 +200,6 @@ message Votes { repeated Vote new_votes = 3; } -// Transcation - -message TXOutput { - int64 value = 1; - bytes pubKeyHash = 2; -} - -message TXInput { - message raw { - bytes txID = 1; - int64 vout = 2; - bytes pubKey = 3; - } - raw raw_data = 1; - bytes signature = 4; -} - -message TXOutputs { - repeated TXOutput outputs = 1; -} - -message ResourceReceipt { - int64 energy_usage = 1; - int64 energy_fee = 2; - int64 origin_energy_usage = 3; - int64 energy_usage_total = 4; - int64 net_usage = 5; - int64 net_fee = 6; - Transaction.Result.contractResult result = 7; -} - message MarketOrderDetail { bytes makerOrderId = 1; bytes takerOrderId = 2; @@ -416,442 +315,3 @@ message Transaction { repeated bytes signature = 2; repeated Result ret = 5; } - -message TransactionInfo { - enum code { - SUCESS = 0; - FAILED = 1; - } - message Log { - bytes address = 1; - repeated bytes topics = 2; - bytes data = 3; - } - bytes id = 1; - int64 fee = 2; - int64 blockNumber = 3; - int64 blockTimeStamp = 4; - repeated bytes contractResult = 5; - bytes contract_address = 6; - ResourceReceipt receipt = 7; - repeated Log log = 8; - code result = 9; - bytes resMessage = 10; - - string assetIssueID = 14; - int64 withdraw_amount = 15; - int64 unfreeze_amount = 16; - repeated InternalTransaction internal_transactions = 17; - int64 exchange_received_amount = 18; - int64 exchange_inject_another_amount = 19; - int64 exchange_withdraw_another_amount = 20; - int64 exchange_id = 21; - int64 shielded_transaction_fee = 22; - - bytes orderId = 25; - repeated MarketOrderDetail orderDetails = 26; - int64 packingFee = 27; -} - -message TransactionRet { - int64 blockNumber = 1; - int64 blockTimeStamp = 2; - repeated TransactionInfo transactioninfo = 3; -} - -message Transactions { - repeated Transaction transactions = 1; -} - -message TransactionSign { - Transaction transaction = 1; - bytes privateKey = 2; -} - -message BlockHeader { - message raw { - int64 timestamp = 1; - bytes txTrieRoot = 2; - bytes parentHash = 3; - //bytes nonce = 5; - //bytes difficulty = 6; - int64 number = 7; - int64 witness_id = 8; - bytes witness_address = 9; - int32 version = 10; - bytes accountStateRoot = 11; - } - raw raw_data = 1; - bytes witness_signature = 2; -} - -// block -message Block { - repeated Transaction transactions = 1; - BlockHeader block_header = 2; -} - -message ChainInventory { - message BlockId { - bytes hash = 1; - int64 number = 2; - } - repeated BlockId ids = 1; - int64 remain_num = 2; -} - -// Inventory -message BlockInventory { - enum Type { - SYNC = 0; - ADVTISE = 1; - FETCH = 2; - } - - message BlockId { - bytes hash = 1; - int64 number = 2; - } - repeated BlockId ids = 1; - Type type = 2; -} - -message Inventory { - enum InventoryType { - TRX = 0; - BLOCK = 1; - } - InventoryType type = 1; - repeated bytes ids = 2; -} - -message Items { - enum ItemType { - ERR = 0; - TRX = 1; - BLOCK = 2; - BLOCKHEADER = 3; - } - - ItemType type = 1; - repeated Block blocks = 2; - repeated BlockHeader block_headers = 3; - repeated Transaction transactions = 4; -} - -// DynamicProperties -message DynamicProperties { - int64 last_solidity_block_num = 1; -} - -enum ReasonCode { - REQUESTED = 0x00; - BAD_PROTOCOL = 0x02; - TOO_MANY_PEERS = 0x04; - DUPLICATE_PEER = 0x05; - INCOMPATIBLE_PROTOCOL = 0x06; - NULL_IDENTITY = 0x07; - PEER_QUITING = 0x08; - UNEXPECTED_IDENTITY = 0x09; - LOCAL_IDENTITY = 0x0A; - PING_TIMEOUT = 0x0B; - USER_REASON = 0x10; - RESET = 0x11; - SYNC_FAIL = 0x12; - FETCH_FAIL = 0x13; - BAD_TX = 0x14; - BAD_BLOCK = 0x15; - FORKED = 0x16; - UNLINKABLE = 0x17; - INCOMPATIBLE_VERSION = 0x18; - INCOMPATIBLE_CHAIN = 0x19; - TIME_OUT = 0x20; - CONNECT_FAIL = 0x21; - TOO_MANY_PEERS_WITH_SAME_IP = 0x22; - LIGHT_NODE_SYNC_FAIL = 0x23; - UNKNOWN = 0xFF; -} - -message DisconnectMessage { - ReasonCode reason = 1; -} - -message HelloMessage { - message BlockId { - bytes hash = 1; - int64 number = 2; - } - - Endpoint from = 1; - int32 version = 2; - int64 timestamp = 3; - BlockId genesisBlockId = 4; - BlockId solidBlockId = 5; - BlockId headBlockId = 6; - bytes address = 7; - bytes signature = 8; - int32 nodeType = 9; - int64 lowestBlockNum = 10; -} - -message InternalTransaction { - // internalTransaction identity, the root InternalTransaction hash - // should equals to root transaction id. - bytes hash = 1; - // the one send trx (TBD: or token) via function - bytes caller_address = 2; - // the one recieve trx (TBD: or token) via function - bytes transferTo_address = 3; - message CallValueInfo { - // trx (TBD: or token) value - int64 callValue = 1; - // TBD: tokenName, trx should be empty - string tokenId = 2; - } - repeated CallValueInfo callValueInfo = 4; - bytes note = 5; - bool rejected = 6; - string extra = 7; -} - -message DelegatedResourceAccountIndex { - bytes account = 1; - repeated bytes fromAccounts = 2; - repeated bytes toAccounts = 3; - int64 timestamp = 4; -} - -message NodeInfo { - int64 beginSyncNum = 1; - string block = 2; - string solidityBlock = 3; - //connect information - int32 currentConnectCount = 4; - int32 activeConnectCount = 5; - int32 passiveConnectCount = 6; - int64 totalFlow = 7; - repeated PeerInfo peerInfoList = 8; - ConfigNodeInfo configNodeInfo = 9; - MachineInfo machineInfo = 10; - map cheatWitnessInfoMap = 11; - - message PeerInfo { - string lastSyncBlock = 1; - int64 remainNum = 2; - int64 lastBlockUpdateTime = 3; - bool syncFlag = 4; - int64 headBlockTimeWeBothHave = 5; - bool needSyncFromPeer = 6; - bool needSyncFromUs = 7; - string host = 8; - int32 port = 9; - string nodeId = 10; - int64 connectTime = 11; - double avgLatency = 12; - int32 syncToFetchSize = 13; - int64 syncToFetchSizePeekNum = 14; - int32 syncBlockRequestedSize = 15; - int64 unFetchSynNum = 16; - int32 blockInPorcSize = 17; - string headBlockWeBothHave = 18; - bool isActive = 19; - int32 score = 20; - int32 nodeCount = 21; - int64 inFlow = 22; - int32 disconnectTimes = 23; - string localDisconnectReason = 24; - string remoteDisconnectReason = 25; - } - - message ConfigNodeInfo { - string codeVersion = 1; - string p2pVersion = 2; - int32 listenPort = 3; - bool discoverEnable = 4; - int32 activeNodeSize = 5; - int32 passiveNodeSize = 6; - int32 sendNodeSize = 7; - int32 maxConnectCount = 8; - int32 sameIpMaxConnectCount = 9; - int32 backupListenPort = 10; - int32 backupMemberSize = 11; - int32 backupPriority = 12; - int32 dbVersion = 13; - int32 minParticipationRate = 14; - bool supportConstant = 15; - double minTimeRatio = 16; - double maxTimeRatio = 17; - int64 allowCreationOfContracts = 18; - int64 allowAdaptiveEnergy = 19; - } - - message MachineInfo { - int32 threadCount = 1; - int32 deadLockThreadCount = 2; - int32 cpuCount = 3; - int64 totalMemory = 4; - int64 freeMemory = 5; - double cpuRate = 6; - string javaVersion = 7; - string osName = 8; - int64 jvmTotalMemory = 9; - int64 jvmFreeMemory = 10; - double processCpuRate = 11; - repeated MemoryDescInfo memoryDescInfoList = 12; - repeated DeadLockThreadInfo deadLockThreadInfoList = 13; - - message MemoryDescInfo { - string name = 1; - int64 initSize = 2; - int64 useSize = 3; - int64 maxSize = 4; - double useRate = 5; - } - - message DeadLockThreadInfo { - string name = 1; - string lockName = 2; - string lockOwner = 3; - string state = 4; - int64 blockTime = 5; - int64 waitTime = 6; - string stackTrace = 7; - } - } -} - -message MetricsInfo { - int64 interval = 1; - NodeInfo node = 2; - BlockChainInfo blockchain = 3; - NetInfo net = 4; - - message NodeInfo { - string ip = 1; - int32 nodeType = 2; - string version = 3; - int32 backupStatus = 4; - } - - message BlockChainInfo { - int64 headBlockNum = 1; - int64 headBlockTimestamp = 2; - string headBlockHash = 3; - int32 forkCount = 4; - int32 failForkCount = 5; - RateInfo blockProcessTime = 6; - RateInfo tps = 7; - int32 transactionCacheSize = 8; - RateInfo missedTransaction = 9; - repeated Witness witnesses = 10; - int64 failProcessBlockNum = 11; - string failProcessBlockReason = 12; - repeated DupWitness dupWitness = 13; - - message Witness { - string address = 1; - int32 version = 2; - } - - message DupWitness { - string address = 1; - int64 blockNum = 2; - int32 count = 3; - } - } - - message RateInfo { - int64 count = 1; - double meanRate = 2; - double oneMinuteRate = 3; - double fiveMinuteRate = 4; - double fifteenMinuteRate = 5; - } - - message NetInfo { - int32 errorProtoCount = 1; - ApiInfo api = 2; - int32 connectionCount = 3; - int32 validConnectionCount = 4; - RateInfo tcpInTraffic = 5; - RateInfo tcpOutTraffic = 6; - int32 disconnectionCount = 7; - repeated DisconnectionDetailInfo disconnectionDetail = 8; - RateInfo udpInTraffic = 9; - RateInfo udpOutTraffic = 10; - LatencyInfo latency = 11; - - message ApiInfo { - RateInfo qps = 1; - RateInfo failQps = 2; - RateInfo outTraffic = 3; - repeated ApiDetailInfo detail = 4; - - message ApiDetailInfo { - string name = 1; - RateInfo qps = 2; - RateInfo failQps = 3; - RateInfo outTraffic = 4; - } - } - - message DisconnectionDetailInfo { - string reason = 1; - int32 count = 2; - } - - message LatencyInfo { - int32 top99 = 1; - int32 top95 = 2; - int32 top75 = 3; - int32 totalCount = 4; - int32 delay1S = 5; - int32 delay2S = 6; - int32 delay3S = 7; - repeated LatencyDetailInfo detail = 8; - - message LatencyDetailInfo { - string witness = 1; - int32 top99 = 2; - int32 top95 = 3; - int32 top75 = 4; - int32 count = 5; - int32 delay1S = 6; - int32 delay2S = 7; - int32 delay3S = 8; - } - } - } -} - -message PBFTMessage { - enum MsgType { - VIEW_CHANGE = 0; - REQUEST = 1; - PREPREPARE = 2; - PREPARE = 3; - COMMIT = 4; - } - enum DataType { - BLOCK = 0; - SRL = 1; - } - message Raw { - MsgType msg_type = 1; - DataType data_type = 2; - int64 view_n = 3; - int64 epoch = 4; - bytes data = 5; - } - Raw raw_data = 1; - bytes signature = 2; -} - -message PBFTCommitResult { - bytes data = 1; - repeated bytes signature = 2; -} - -message SRL { - repeated bytes srAddress = 1; -} diff --git a/core/TronInventoryItems.proto b/core/TronInventoryItems.proto deleted file mode 100644 index a82d2de45..000000000 --- a/core/TronInventoryItems.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; - -package protocol; - -option java_package = "org.tron.protos"; //Specify the name of the package that generated the Java file -option java_outer_classname = "TronInventoryItems"; //Specify the class name of the generated Java file -option go_package = "github.com/tronprotocol/grpc-gateway/core"; - -message InventoryItems { - int32 type = 1; - repeated bytes items = 2; -} \ No newline at end of file diff --git a/core/contract/market_contract.proto b/core/contract/market_contract.proto deleted file mode 100644 index e12743500..000000000 --- a/core/contract/market_contract.proto +++ /dev/null @@ -1,19 +0,0 @@ -syntax = "proto3"; - -package protocol; - -option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file -option go_package = "github.com/tronprotocol/grpc-gateway/core"; - -message MarketSellAssetContract { - bytes owner_address = 1; - bytes sell_token_id = 2; - int64 sell_token_quantity = 3; - bytes buy_token_id = 4; - int64 buy_token_quantity = 5; // min to receive -} - -message MarketCancelOrderContract { - bytes owner_address = 1; - bytes order_id = 2; -} \ No newline at end of file diff --git a/core/contract/shield_contract.proto b/core/contract/shield_contract.proto deleted file mode 100644 index 660f9ddf7..000000000 --- a/core/contract/shield_contract.proto +++ /dev/null @@ -1,81 +0,0 @@ -syntax = "proto3"; - -package protocol; - -option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file -//option java_outer_classname = "ShieldedTransferContract"; //Specify the class name of the generated Java file -option go_package = "github.com/tronprotocol/grpc-gateway/core"; - -// for shielded transaction - -message AuthenticationPath { - repeated bool value = 1; -} - -message MerklePath { - repeated AuthenticationPath authentication_paths = 1; - repeated bool index = 2; - bytes rt = 3; -} - -message OutputPoint { - bytes hash = 1; - int32 index = 2; -} - -message OutputPointInfo { - repeated OutputPoint out_points = 1; - int32 block_num = 2; -} - -message PedersenHash { - bytes content = 1; -} - -message IncrementalMerkleTree { - PedersenHash left = 1; - PedersenHash right = 2; - repeated PedersenHash parents = 3; -} - -message IncrementalMerkleVoucher { - IncrementalMerkleTree tree = 1; - repeated PedersenHash filled = 2; - IncrementalMerkleTree cursor = 3; - int64 cursor_depth = 4; - bytes rt = 5; - OutputPoint output_point = 10; -} - -message IncrementalMerkleVoucherInfo { - repeated IncrementalMerkleVoucher vouchers = 1; - repeated bytes paths = 2; -} - -message SpendDescription { - bytes value_commitment = 1; - bytes anchor = 2; // merkle root - bytes nullifier = 3; // used for check double spend - bytes rk = 4; // used for check spend authority signature - bytes zkproof = 5; - bytes spend_authority_signature = 6; -} - -message ReceiveDescription { - bytes value_commitment = 1; - bytes note_commitment = 2; - bytes epk = 3; // for Encryption - bytes c_enc = 4; // Encryption for incoming, decrypt it with ivk - bytes c_out = 5; // Encryption for audit, decrypt it with ovk - bytes zkproof = 6; -} - -message ShieldedTransferContract { - bytes transparent_from_address = 1; // transparent address - int64 from_amount = 2; - repeated SpendDescription spend_description = 3; - repeated ReceiveDescription receive_description = 4; - bytes binding_signature = 5; - bytes transparent_to_address = 6; // transparent address - int64 to_amount = 7; // the amount to transparent to_address -} diff --git a/core/tron/account.proto b/core/tron/account.proto deleted file mode 100644 index e69de29bb..000000000 diff --git a/core/tron/block.proto b/core/tron/block.proto deleted file mode 100644 index e69de29bb..000000000 diff --git a/core/tron/delegated_resource.proto b/core/tron/delegated_resource.proto deleted file mode 100644 index e69de29bb..000000000 diff --git a/core/tron/p2p.proto b/core/tron/p2p.proto deleted file mode 100644 index e69de29bb..000000000 diff --git a/core/tron/proposal.proto b/core/tron/proposal.proto deleted file mode 100644 index e69de29bb..000000000 diff --git a/core/tron/transaction.proto b/core/tron/transaction.proto deleted file mode 100644 index e69de29bb..000000000 diff --git a/core/tron/vote.proto b/core/tron/vote.proto deleted file mode 100644 index e69de29bb..000000000 diff --git a/core/tron/witness.proto b/core/tron/witness.proto deleted file mode 100644 index e69de29bb..000000000