From 11f22708c8f3bca7339b8d80091f22381a837279 Mon Sep 17 00:00:00 2001 From: Aditya Vyas Date: Tue, 27 Aug 2024 14:53:40 -0400 Subject: [PATCH 1/3] convert json to snake-case --- protocols/horizon/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/horizon/main.go b/protocols/horizon/main.go index dd9cc7814f..df4aee78cf 100644 --- a/protocols/horizon/main.go +++ b/protocols/horizon/main.go @@ -582,7 +582,7 @@ type AsyncTransactionSubmissionResponse struct { // ErrorResultXDR is present only if Status is equal to proto.TXStatusError. // ErrorResultXDR is a TransactionResult xdr string which contains details on why // the transaction could not be accepted by stellar-core. - ErrorResultXDR string `json:"errorResultXdr,omitempty"` + ErrorResultXDR string `json:"error_result_xdr,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. From 4bdbe726c59b652b55c82e5d5504d5ea7ef4d329 Mon Sep 17 00:00:00 2001 From: Aditya Vyas Date: Tue, 27 Aug 2024 15:11:14 -0400 Subject: [PATCH 2/3] change naming to snake-case - 2 --- .../horizon/internal/httpx/static/txsub_async_oapi.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/horizon/internal/httpx/static/txsub_async_oapi.yaml b/services/horizon/internal/httpx/static/txsub_async_oapi.yaml index f889cf4ec8..0e9a23e676 100644 --- a/services/horizon/internal/httpx/static/txsub_async_oapi.yaml +++ b/services/horizon/internal/httpx/static/txsub_async_oapi.yaml @@ -52,7 +52,7 @@ paths: ErrorStatusExample: summary: ERROR Status from core value: - errorResultXdr: "AAAAAAAAAGT////7AAAAAA==" + error_result_xdr: "AAAAAAAAAGT////7AAAAAA==" tx_status: "ERROR" hash: "6cbb7f714bd08cea7c30cab7818a35c510cbbfc0a6aa06172a1e94146ecf0165" '405': @@ -78,7 +78,7 @@ paths: schema: $ref: '#/components/schemas/AsyncTransactionSubmissionResponse' example: - errorResultXdr: "" + error_result_xdr: "" tx_status: "DUPLICATE" hash: "6cbb7f714bd08cea7c30cab7818a35c510cbbfc0a6aa06172a1e94146ecf0165" '500': @@ -136,7 +136,7 @@ components: AsyncTransactionSubmissionResponse: type: object properties: - errorResultXdr: + error_result_xdr: type: string nullable: true description: TransactionResult XDR string which is present only if the submission status from core is an ERROR. From f10ea0f79143c1b5594f5a91c5aeb4a8ae39f2cc Mon Sep 17 00:00:00 2001 From: George Date: Tue, 27 Aug 2024 13:24:25 -0700 Subject: [PATCH 3/3] ingest: Add verbosity to missing file error for `BufferedStorageBackend` (#5442) * Specify object key in 404 error message * Update tests to match new error message --- ingest/ledgerbackend/buffered_storage_backend_test.go | 9 +++++++-- ingest/ledgerbackend/ledger_buffer.go | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ingest/ledgerbackend/buffered_storage_backend_test.go b/ingest/ledgerbackend/buffered_storage_backend_test.go index ca2711c40d..6c95b465f7 100644 --- a/ingest/ledgerbackend/buffered_storage_backend_test.go +++ b/ingest/ledgerbackend/buffered_storage_backend_test.go @@ -505,7 +505,9 @@ func TestLedgerBufferBoundedObjectNotFound(t *testing.T) { bsb.ledgerBuffer.wg.Wait() _, err := bsb.GetLedger(ctx, 3) - assert.EqualError(t, err, "failed getting next ledger batch from queue: ledger object containing sequence 3 is missing: file does not exist") + assert.ErrorContains(t, err, "ledger object containing sequence 3 is missing") + assert.ErrorContains(t, err, objectName) + assert.ErrorContains(t, err, "file does not exist") } func TestLedgerBufferUnboundedObjectNotFound(t *testing.T) { @@ -571,5 +573,8 @@ func TestLedgerBufferRetryLimit(t *testing.T) { bsb.ledgerBuffer.wg.Wait() _, err := bsb.GetLedger(context.Background(), 3) - assert.EqualError(t, err, "failed getting next ledger batch from queue: maximum retries exceeded for downloading object containing sequence 3: transient error") + assert.ErrorContains(t, err, "failed getting next ledger batch from queue") + assert.ErrorContains(t, err, "maximum retries exceeded for downloading object containing sequence 3") + assert.ErrorContains(t, err, objectName) + assert.ErrorContains(t, err, "transient error") } diff --git a/ingest/ledgerbackend/ledger_buffer.go b/ingest/ledgerbackend/ledger_buffer.go index 6965461bba..d23bf0bfbd 100644 --- a/ingest/ledgerbackend/ledger_buffer.go +++ b/ingest/ledgerbackend/ledger_buffer.go @@ -167,7 +167,7 @@ func (lb *ledgerBuffer) downloadLedgerObject(ctx context.Context, sequence uint3 reader, err := lb.dataStore.GetFile(ctx, objectKey) if err != nil { - return nil, err + return nil, errors.Wrapf(err, "unable to retrieve file: %s", objectKey) } defer reader.Close()