Conversation
Adds TransactionSource with HorizonSource as the only implementation and
routes poll_contract through it, so a Soroban RPC backend can be added later.
Horizon's /accounts/{id} routes only accept G-addresses, so a contract (C...)
address is rejected with HTTP 400; the trait is what lets a second source
replace that without touching poll_contract.
Surface Horizon's error body, which was being discarded. A rejected contract
address used to log only "HTTP 400", indistinguishable from any other 400; it
now reports the offending field and reason, e.g. "account_id: Account ID must
start with `G` and contain 56 alphanum characters". A rejected contract is
counted as a poll failure rather than aborting the cycle, so the operational
symptom is a watch that silently never sees anything.
Carries an earlier uncommitted fix: include_failed=true on the transactions
request (Tx-wats#2). Without it Horizon omits failed transactions and the
TransactionFailed rule can never fire.
|
@ayomidearegbeshola29-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Routes
poll_contractthrough a newTransactionSourcetrait, withHorizonSourceas the only implementation today, so a Soroban RPC backend canbe added later without touching the polling logic.
Also surfaces Horizon's error body, which was being discarded.
closes #4
Why
Horizon's
/accounts/{id}routes only accept G-addresses. A watched contract(C…) address is rejected with HTTP 400, so the current single source cannot
actually poll a contract. An RPC source is the fix, but it is not a drop-in:
RPC can only enumerate the events a contract emitted, not the transactions it
took part in, so a reverted invocation is invisible to it, and there is no
pagingTokento advance a cursor with. Putting the seam behind a trait firstmeans that work is additive.
This PR does not fix C-address polling. It makes the limitation a
documented, tested property of one implementation rather than a hard-wired
assumption in the poller.
Error bodies
Horizon explains a rejection in the body, not the status line. That body was
being thrown away, so a rejected contract address logged only
HTTP 400—indistinguishable from any other 400, and hard to diagnose from the field. It
now reports the offending field and reason:
A rejected contract is counted as a poll failure rather than aborting the
cycle, so the operational symptom is a watch that silently never sees anything.
Also included
An earlier uncommitted fix rode along:
include_failed=trueon thetransactions request (#2). Without it Horizon omits failed transactions and the
TransactionFailedrule can never fire.Tests
horizon_c_address_rejection_names_the_account_id_field(unit) — pins thestatus and field name from the recorded Horizon response.
horizon_rejects_a_contract_address_on_the_accounts_endpoint(integration) —replays the recorded 400 and asserts the contract is counted as a poll
failure, with no transactions or alerts.
cargo test --workspaceand workspace clippy are clean.Follow-up
fetch_soroban_detailsdiscards its error body the same way. Left alone hereto keep this change scoped.