From 0ba2540ea3bc1d45febd0160279f8bc343bc0dbd Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Fri, 31 Mar 2023 16:51:05 +0800 Subject: [PATCH 1/5] feat(net): add BELOW_THAN_ME for ReasonCode --- core/Tron.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/core/Tron.proto b/core/Tron.proto index e6aac408f..437f5bf85 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -600,6 +600,7 @@ enum ReasonCode { CONNECT_FAIL = 0x21; TOO_MANY_PEERS_WITH_SAME_IP = 0x22; LIGHT_NODE_SYNC_FAIL = 0x23; + BELOW_THAN_ME = 0X24; UNKNOWN = 0xFF; } From c07905f71fcc2be0e051e44663d8c4bcc16cbceb Mon Sep 17 00:00:00 2001 From: halibobo1205 Date: Thu, 30 Mar 2023 15:37:54 +0800 Subject: [PATCH 2/5] feat(api): remove insecure APIs --- api/api.proto | 116 ------------------------------------------------ core/Tron.proto | 5 --- 2 files changed, 121 deletions(-) diff --git a/api/api.proto b/api/api.proto index 95871f5aa..70297d095 100644 --- a/api/api.proto +++ b/api/api.proto @@ -624,68 +624,6 @@ service Wallet { } }; } - //Warning: do not invoke this interface provided by others. - //Please use GetTransactionSign2 instead of this function. - rpc GetTransactionSign (TransactionSign) returns (Transaction) { - option (google.api.http) = { - post: "/wallet/gettransactionsign" - body: "*" - additional_bindings { - get: "/wallet/gettransactionsign" - } - }; - }; - //Warning: do not invoke this interface provided by others. - //Use this function instead of GetTransactionSign. - rpc GetTransactionSign2 (TransactionSign) returns (TransactionExtention) { - }; - //Warning: do not invoke this interface provided by others. - rpc CreateAddress (BytesMessage) returns (BytesMessage) { - option (google.api.http) = { - post: "/wallet/createaddress" - body: "*" - additional_bindings { - get: "/wallet/createaddress" - } - }; - }; - //Warning: do not invoke this interface provided by others. - rpc EasyTransferAsset (EasyTransferAssetMessage) returns (EasyTransferResponse) { - }; - //Warning: do not invoke this interface provided by others. - rpc EasyTransferAssetByPrivate (EasyTransferAssetByPrivateMessage) returns (EasyTransferResponse) { - }; - //Warning: do not invoke this interface provided by others. - rpc EasyTransfer (EasyTransferMessage) returns (EasyTransferResponse) { - option (google.api.http) = { - post: "/wallet/easytransfer" - body: "*" - additional_bindings { - get: "/wallet/easytransfer" - } - }; - }; - //Warning: do not invoke this interface provided by others. - rpc EasyTransferByPrivate (EasyTransferByPrivateMessage) returns (EasyTransferResponse) { - option (google.api.http) = { - post: "/wallet/easytransferbyprivate" - body: "*" - additional_bindings { - get: "/wallet/easytransferbyprivate" - } - }; - }; - //Warning: do not invoke this interface provided by others. - rpc GenerateAddress (EmptyMessage) returns (AddressPrKeyPairMessage) { - - option (google.api.http) = { - post: "/wallet/generateaddress" - body: "*" - additional_bindings { - get: "/wallet/generateaddress" - } - }; - } rpc GetTransactionInfoById (BytesMessage) returns (TransactionInfo) { option (google.api.http) = { @@ -707,10 +645,6 @@ service Wallet { }; } - rpc AddSign (TransactionSign) returns (TransactionExtention) { - - } - rpc GetTransactionSignWeight (Transaction) returns (TransactionSignWeight) { } @@ -968,17 +902,6 @@ service WalletSolidity { }; } - //Warning: do not invoke this interface provided by others. - rpc GenerateAddress (EmptyMessage) returns (AddressPrKeyPairMessage) { - option (google.api.http) = { - post: "/walletsolidity/generateaddress" - body: "*" - additional_bindings { - get: "/walletsolidity/generateaddress" - } - }; - } - rpc GetMerkleTreeVoucherInfo (OutputPointInfo) returns (IncrementalMerkleVoucherInfo) { } @@ -1165,7 +1088,6 @@ message GetAvailableUnfreezeCountResponseMessage { int64 count = 1; } -//GetCanDelegatedMaxSize message CanDelegatedMaxSizeRequestMessage { int32 type = 1; bytes owner_address = 2; @@ -1174,7 +1096,6 @@ message CanDelegatedMaxSizeResponseMessage { int64 max_size = 1; } -//GetCanWithdrawUnfreezeAmount message CanWithdrawUnfreezeAmountRequestMessage { bytes owner_address = 1; int64 timestamp = 2; @@ -1271,43 +1192,6 @@ message PaginatedMessage { int64 limit = 2; } -message EasyTransferMessage { - bytes passPhrase = 1; - bytes toAddress = 2; - int64 amount = 3; -} - -message EasyTransferAssetMessage { - bytes passPhrase = 1; - bytes toAddress = 2; - string assetId = 3; - int64 amount = 4; -} - -message EasyTransferByPrivateMessage { - bytes privateKey = 1; - bytes toAddress = 2; - int64 amount = 3; -} - -message EasyTransferAssetByPrivateMessage { - bytes privateKey = 1; - bytes toAddress = 2; - string assetId = 3; - int64 amount = 4; -} - -message EasyTransferResponse { - Transaction transaction = 1; - Return result = 2; - bytes txid = 3; //transaction id = sha256(transaction.rowdata) -} - -message AddressPrKeyPairMessage { - string address = 1; - string privateKey = 2; -} - message TransactionExtention { Transaction transaction = 1; bytes txid = 2; //transaction id = sha256(transaction.rowdata) diff --git a/core/Tron.proto b/core/Tron.proto index 437f5bf85..e5145484f 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -494,11 +494,6 @@ message Transactions { repeated Transaction transactions = 1; } -message TransactionSign { - Transaction transaction = 1; - bytes privateKey = 2; -} - message BlockHeader { message raw { int64 timestamp = 1; From 7f5ce424d5a00f62f3e0bb723c4a55605a6c0d31 Mon Sep 17 00:00:00 2001 From: liuxincheng Date: Wed, 7 Jun 2023 16:41:46 +0800 Subject: [PATCH 3/5] feat(freezeV2): upgrade stake2.0 protocol Signed-off-by: liuxincheng --- api/api.proto | 3 +++ core/Tron.proto | 3 +++ core/contract/balance_contract.proto | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/api/api.proto b/api/api.proto index 70297d095..d23d6e017 100644 --- a/api/api.proto +++ b/api/api.proto @@ -281,6 +281,9 @@ service Wallet { rpc UnDelegateResource (UnDelegateResourceContract) returns (TransactionExtention) { } + rpc CancelAllUnfreezeV2 (CancelAllUnfreezeV2Contract) returns (TransactionExtention) { + } + //Please use UpdateAsset2 instead of this function. rpc UpdateAsset (UpdateAssetContract) returns (Transaction) { option (google.api.http) = { diff --git a/core/Tron.proto b/core/Tron.proto index e5145484f..f52c21162 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -374,6 +374,7 @@ message Transaction { WithdrawExpireUnfreezeContract = 56; DelegateResourceContract = 57; UnDelegateResourceContract = 58; + CancelAllUnfreezeV2Contract = 59; } ContractType type = 1; google.protobuf.Any parameter = 2; @@ -422,6 +423,7 @@ message Transaction { bytes orderId = 25; repeated MarketOrderDetail orderDetails = 26; int64 withdraw_expire_amount = 27; + int64 cancel_all_unfreezeV2_amount = 28; } message raw { @@ -482,6 +484,7 @@ message TransactionInfo { int64 packingFee = 27; int64 withdraw_expire_amount = 28; + int64 cancel_all_unfreezeV2_amount = 29; } message TransactionRet { diff --git a/core/contract/balance_contract.proto b/core/contract/balance_contract.proto index 90a2dfaa4..ea1c96270 100644 --- a/core/contract/balance_contract.proto +++ b/core/contract/balance_contract.proto @@ -103,6 +103,7 @@ message DelegateResourceContract { int64 balance = 3; bytes receiver_address = 4; bool lock = 5; + int64 lock_period = 6; } message UnDelegateResourceContract { @@ -110,4 +111,8 @@ message UnDelegateResourceContract { ResourceCode resource = 2; int64 balance = 3; bytes receiver_address = 4; +} + +message CancelAllUnfreezeV2Contract { + bytes owner_address = 1; } \ No newline at end of file From 79fd36c31dd97da3baf6c24501ce158083edca17 Mon Sep 17 00:00:00 2001 From: liuxincheng Date: Thu, 15 Jun 2023 18:48:46 +0800 Subject: [PATCH 4/5] feat(freezeV2): modify CancelAllUnfreezeV2 return info --- core/Tron.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/Tron.proto b/core/Tron.proto index f52c21162..05f8b990c 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -423,7 +423,7 @@ message Transaction { bytes orderId = 25; repeated MarketOrderDetail orderDetails = 26; int64 withdraw_expire_amount = 27; - int64 cancel_all_unfreezeV2_amount = 28; + map cancel_unfreezeV2_amount = 28; } message raw { @@ -484,7 +484,7 @@ message TransactionInfo { int64 packingFee = 27; int64 withdraw_expire_amount = 28; - int64 cancel_all_unfreezeV2_amount = 29; + map cancel_unfreezeV2_amount = 29; } message TransactionRet { From 8999d6b204f050698e2ab0f4d57b5bcaaac783a3 Mon Sep 17 00:00:00 2001 From: chaozhu Date: Sun, 25 Jun 2023 15:57:46 +0800 Subject: [PATCH 5/5] feature(mechanism): optmize resource recovery --- core/Tron.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/Tron.proto b/core/Tron.proto index 05f8b990c..aa6a96ba1 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -193,6 +193,7 @@ message Account { bytes account_id = 23; int64 net_window_size = 24; + bool net_window_optimized = 25; message AccountResource { // energy resource, get from frozen @@ -215,6 +216,7 @@ message Account { int64 delegated_frozenV2_balance_for_energy = 10; int64 acquired_delegated_frozenV2_balance_for_energy = 11; + bool energy_window_optimized = 12; } AccountResource account_resource = 26; bytes codeHash = 30;