Repository navigation
[ANCHOR-1341]: Reject SEP-31 quotes priced for a different funding method - #2099
Open
ceciliaromao wants to merge 4 commits into
Open
ceciliaromao wants to merge 4 commits into
ceciliaromao wants to merge 4 commits into
Conversation
…1 PATCH validator
…EP-6 and SEP-31 methods
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.
Description
POST /sep31/transactionsnow rejects, with a 400, a request whosefunding_methoddiffers from thebuy_delivery_methodof the SEP-38 quote it spends (funding_method(X) does not match quote buy delivery method(Y)). A quote with no buy delivery method is not bound to one, as in SEP-6. The check runs before the quote is bound, so a rejected request leaves the quote unused.PATCH /transactionsvalidator (TransactionService.validateQuoteAndAmounts) applies the same comparison between the SEP-31 transaction'sfunding_methodand its quote (transaction.funding_method != quote.buy_delivery_method).quick-run/config/assets.yaml.template: USD and CAD listSEPAandSWIFTas SEP-38 sell and buy delivery methods (replacingWIRE), so the SEP-6/SEP-31 and SEP-38 method sets overlap in the stock stack.Context
Testing
./gradlew test./gradlew :core:test --tests "org.stellar.anchor.sep31.Sep31ServiceTest"(SEPA quote spent as SWIFT and the mirror are rejected; matching method, and null or empty quote method, are accepted; earlier quote errors still win; a rejection leaves the quote unbound and saves nothing; the comparison is case-sensitive)./gradlew :platform:test --tests "org.stellar.anchor.platform.service.TransactionServiceTest"(PATCH rejects a conflicting method, including a case-only difference; accepts equal, null or empty methods and a transaction with no quote)./gradlew :core:test --tests "org.stellar.anchor.asset.QuickRunAssetsTemplateTest"(the template loads and its method sets overlap)buy_delivery_method=SEPA, thenPOST /sep31/transactionswith thatquote_idandfunding_method=SWIFT: expect 400. Withfunding_method=SEPA: expect success.Documentation
funding_methodagainst the quote, it already says it must match; no change needed.Known limitations
funding_methodconflicts with its quote now gets a 400 on every PATCH until the method is corrected.bank_account,cash) are unchanged, and SEP-31 stays disabled for the fiat assets there.