Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protocols/horizon: Reinstate errorResultXdr with deprecation warning #5496

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading