Skip to content

Commit

Permalink
Reinstate errorResultXdr with deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
tamirms committed Oct 24, 2024
1 parent 783bb05 commit e78e108
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 deletions.
18 changes: 13 additions & 5 deletions protocols/horizon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,20 @@ type AssetStat struct {
} `json:"_links"`

base.Asset
PT string `json:"paging_token"`
ContractID string `json:"contract_id,omitempty"`
NumClaimableBalances int32 `json:"num_claimable_balances"`
NumLiquidityPools int32 `json:"num_liquidity_pools"`
NumContracts int32 `json:"num_contracts"`
PT string `json:"paging_token"`
ContractID string `json:"contract_id,omitempty"`
NumClaimableBalances int32 `json:"num_claimable_balances"`
NumLiquidityPools int32 `json:"num_liquidity_pools"`
NumContracts int32 `json:"num_contracts"`
// NumArchivedContracts is deprecated and will be removed in the v23 release
// Action needed in release: horizon-v23.0.0: remove field
NumArchivedContracts int32 `json:"num_archived_contracts"`
Accounts AssetStatAccounts `json:"accounts"`
ClaimableBalancesAmount string `json:"claimable_balances_amount"`
LiquidityPoolsAmount string `json:"liquidity_pools_amount"`
ContractsAmount string `json:"contracts_amount"`
// ArchivedContractsAmount is deprecated and will be removed in the v23 release
// Action needed in release: horizon-v23.0.0: remove field
ArchivedContractsAmount string `json:"archived_contracts_amount"`
Balances AssetStatBalances `json:"balances"`
Flags AccountFlags `json:"flags"`
Expand Down Expand Up @@ -576,6 +580,10 @@ type AsyncTransactionSubmissionResponse struct {
// ErrorResultXDR is a TransactionResult xdr string which contains details on why
// the transaction could not be accepted by stellar-core.
ErrorResultXDR string `json:"error_result_xdr,omitempty"`
// DeprecatedErrorResultXDR is a deprecated field equivalent to ErrorResultXDR
// which will be removed in the v23 release. Use ErrorResultXDR instead of
// DeprecatedErrorResultXDR
DeprecatedErrorResultXDR string `json:"errorResultXdr,omitempty"`
// TxStatus represents the status of the transaction submission returned by stellar-core.
// It can be one of: proto.TXStatusPending, proto.TXStatusDuplicate,
// proto.TXStatusTryAgainLater, or proto.TXStatusError.
Expand Down
10 changes: 9 additions & 1 deletion services/horizon/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
All notable changes to this project will be documented in this
file. This project adheres to [Semantic Versioning](http://semver.org/).

## 22.0.0-rc
## 22.0.0-rc2


### Deprecations

- 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))
- 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))

## 22.0.0-rc1

**This release adds support for Protocol 22**

Expand Down
2 changes: 2 additions & 0 deletions services/horizon/internal/actions/submit_transaction_async.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ func (handler AsyncSubmitTransactionHandler) GetResource(_ HeaderWriter, r *http

if resp.Status == proto.TXStatusError {
response.ErrorResultXDR = resp.Error
// Action needed in release: horizon-v23.0.0: remove deprecated field
response.DeprecatedErrorResultXDR = resp.Error
}

return response, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,10 @@ func TestAsyncSubmitTransactionHandler_TransactionStatusResponse(t *testing.T) {
DiagnosticEvents: "test-diagnostic-events",
},
expectedResponse: horizon.AsyncTransactionSubmissionResponse{
ErrorResultXDR: "test-error",
TxStatus: proto.TXStatusError,
Hash: TxHash,
ErrorResultXDR: "test-error",
DeprecatedErrorResultXDR: "test-error",
TxStatus: proto.TXStatusError,
Hash: TxHash,
},
},
{
Expand Down
7 changes: 4 additions & 3 deletions services/horizon/internal/integration/txsub_async_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ func TestAsyncTxSub_SubmissionError(t *testing.T) {
txResp, err := itest.AsyncSubmitTransaction(master, txParams)
assert.NoError(t, err)
assert.Equal(t, txResp, horizon.AsyncTransactionSubmissionResponse{
ErrorResultXDR: "AAAAAAAAAGT////7AAAAAA==",
TxStatus: "ERROR",
Hash: "0684df00f20efd5876f1b8d17bc6d3a68d8b85c06bb41e448815ecaa6307a251",
ErrorResultXDR: "AAAAAAAAAGT////7AAAAAA==",
DeprecatedErrorResultXDR: "AAAAAAAAAGT////7AAAAAA==",
TxStatus: "ERROR",
Hash: "0684df00f20efd5876f1b8d17bc6d3a68d8b85c06bb41e448815ecaa6307a251",
})
}

Expand Down

0 comments on commit e78e108

Please sign in to comment.