Skip to content

Commit 364ca19

Browse files
authored
protocols/horizon: Reinstate errorResultXdr with deprecation warning (#5496)
1 parent 783bb05 commit 364ca19

File tree

6 files changed

+36
-12
lines changed

6 files changed

+36
-12
lines changed

protocols/horizon/main.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,20 @@ type AssetStat struct {
175175
} `json:"_links"`
176176

177177
base.Asset
178-
PT string `json:"paging_token"`
179-
ContractID string `json:"contract_id,omitempty"`
180-
NumClaimableBalances int32 `json:"num_claimable_balances"`
181-
NumLiquidityPools int32 `json:"num_liquidity_pools"`
182-
NumContracts int32 `json:"num_contracts"`
178+
PT string `json:"paging_token"`
179+
ContractID string `json:"contract_id,omitempty"`
180+
NumClaimableBalances int32 `json:"num_claimable_balances"`
181+
NumLiquidityPools int32 `json:"num_liquidity_pools"`
182+
NumContracts int32 `json:"num_contracts"`
183+
// NumArchivedContracts is deprecated and will be removed in the v23 release
184+
// Action needed in release: horizon-v23.0.0: remove field
183185
NumArchivedContracts int32 `json:"num_archived_contracts"`
184186
Accounts AssetStatAccounts `json:"accounts"`
185187
ClaimableBalancesAmount string `json:"claimable_balances_amount"`
186188
LiquidityPoolsAmount string `json:"liquidity_pools_amount"`
187189
ContractsAmount string `json:"contracts_amount"`
190+
// ArchivedContractsAmount is deprecated and will be removed in the v23 release
191+
// Action needed in release: horizon-v23.0.0: remove field
188192
ArchivedContractsAmount string `json:"archived_contracts_amount"`
189193
Balances AssetStatBalances `json:"balances"`
190194
Flags AccountFlags `json:"flags"`
@@ -576,6 +580,10 @@ type AsyncTransactionSubmissionResponse struct {
576580
// ErrorResultXDR is a TransactionResult xdr string which contains details on why
577581
// the transaction could not be accepted by stellar-core.
578582
ErrorResultXDR string `json:"error_result_xdr,omitempty"`
583+
// DeprecatedErrorResultXDR is a deprecated field equivalent to ErrorResultXDR
584+
// which will be removed in the v23 release. Use ErrorResultXDR instead of
585+
// DeprecatedErrorResultXDR
586+
DeprecatedErrorResultXDR string `json:"errorResultXdr,omitempty"`
579587
// TxStatus represents the status of the transaction submission returned by stellar-core.
580588
// It can be one of: proto.TXStatusPending, proto.TXStatusDuplicate,
581589
// proto.TXStatusTryAgainLater, or proto.TXStatusError.

services/horizon/CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
All notable changes to this project will be documented in this
44
file. This project adheres to [Semantic Versioning](http://semver.org/).
55

6-
## 22.0.0-rc
6+
## 22.0.0-rc2
7+
8+
9+
### Deprecations
10+
11+
- The `errorResultXdr` field from the response of the async transaction submission endpoint has been temporarily reinstated. However it will be removed in the v23 release. ([5496](https://github.com/stellar/go/pull/5496))
12+
- The `num_archived_contracts` and `archived_contracts_amount` fields from the `/assets` response have been deprecated and will be removed in the v23 Horizon release. ([5496](https://github.com/stellar/go/pull/5496))
13+
14+
## 22.0.0-rc1
715

816
**This release adds support for Protocol 22**
917

services/horizon/internal/actions/submit_transaction_async.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ func (handler AsyncSubmitTransactionHandler) GetResource(_ HeaderWriter, r *http
115115

116116
if resp.Status == proto.TXStatusError {
117117
response.ErrorResultXDR = resp.Error
118+
// Action needed in release: horizon-v23.0.0: remove deprecated field
119+
response.DeprecatedErrorResultXDR = resp.Error
118120
}
119121

120122
return response, nil

services/horizon/internal/actions/submit_transaction_async_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,10 @@ func TestAsyncSubmitTransactionHandler_TransactionStatusResponse(t *testing.T) {
164164
DiagnosticEvents: "test-diagnostic-events",
165165
},
166166
expectedResponse: horizon.AsyncTransactionSubmissionResponse{
167-
ErrorResultXDR: "test-error",
168-
TxStatus: proto.TXStatusError,
169-
Hash: TxHash,
167+
ErrorResultXDR: "test-error",
168+
DeprecatedErrorResultXDR: "test-error",
169+
TxStatus: proto.TXStatusError,
170+
Hash: TxHash,
170171
},
171172
},
172173
{

services/horizon/internal/httpx/static/txsub_async_oapi.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ components:
140140
type: string
141141
nullable: true
142142
description: TransactionResult XDR string which is present only if the submission status from core is an ERROR.
143+
errorResultXdr:
144+
type: string
145+
nullable: true
146+
description: This field is deprecated, use error_result_xdr instead.
143147
tx_status:
144148
type: string
145149
enum: ["ERROR", "PENDING", "DUPLICATE", "TRY_AGAIN_LATER"]

services/horizon/internal/integration/txsub_async_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ func TestAsyncTxSub_SubmissionError(t *testing.T) {
8787
txResp, err := itest.AsyncSubmitTransaction(master, txParams)
8888
assert.NoError(t, err)
8989
assert.Equal(t, txResp, horizon.AsyncTransactionSubmissionResponse{
90-
ErrorResultXDR: "AAAAAAAAAGT////7AAAAAA==",
91-
TxStatus: "ERROR",
92-
Hash: "0684df00f20efd5876f1b8d17bc6d3a68d8b85c06bb41e448815ecaa6307a251",
90+
ErrorResultXDR: "AAAAAAAAAGT////7AAAAAA==",
91+
DeprecatedErrorResultXDR: "AAAAAAAAAGT////7AAAAAA==",
92+
TxStatus: "ERROR",
93+
Hash: "0684df00f20efd5876f1b8d17bc6d3a68d8b85c06bb41e448815ecaa6307a251",
9394
})
9495
}
9596

0 commit comments

Comments
 (0)