Repository navigation
[ANCHOR-1323]: Stop SEP-24 withdrawal memos from colliding across protocols - #2096
Open
ceciliaromao wants to merge 11 commits into
Open
ceciliaromao wants to merge 11 commits into
ceciliaromao wants to merge 11 commits into
Conversation
…d SEP-31 store interfaces
… assigning deposit info
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
Sep24DepositInfoSelfGeneratoralways returns a generated id memo, as the SEP-6 and SEP-31 generators already do, andSep24Service.withdrawstill validates the request'smemo/memo_typebut no longer stores them, so the row holds no memo untilrequest_onchain_fundsassigns one.request_onchain_fundsrefuses a memo (and account) already held by a pending SEP-6, SEP-24 or SEP-31 transaction, with the existingmemo_in_usemessage. The check lives in the application, so it also holds without Flyway/V28. The three store interfaces expose the pending-memo lookup it needs.DefaultPaymentListenerlooks up SEP-31, SEP-24 and SEP-6 before handling any of them. When one payment matches pending rows of more than one protocol it credits none, logs the matched ids and incrementsPAYMENT_OBSERVER_AMBIGUOUS_ROUTINGwithsep=cross. Same-protocol ambiguity keeps its24/6/31tags.withdraw_memothe anchor returns, is no longer credited. The contract-account e2e test is changed to pay the returned memo. Needs a release note.Context
Testing
./gradlew test./gradlew :platform:test --tests "org.stellar.anchor.platform.service.Sep24DepositInfoSelfGeneratorTest"(client id memo replaced, minted per call and in range, text/hash/absent types)./gradlew :core:test --tests "org.stellar.anchor.sep24.Sep24ServiceTest"(withdraw stores no memo of any type, deposit memo unchanged, invalid memo still 400)./gradlew :platform:test --tests "org.stellar.anchor.platform.rpc.RequestOnchainFundsHandlerTest"(every protocol pair refused, own row and non-pending rows accepted, refusal leaves the row unsaved, business-server memo canonicalised, no database constraint needed)./gradlew :platform:test --tests "org.stellar.anchor.platform.observer.stellar.DefaultPaymentListenerTest"(cross-protocol refusal for 24+6, 31+24, 31+6 and muxed ids, the reported scenario, the control case, single match, same-protocol tags, either row created first)./gradlew runEssentialTests;Sep24End2EndTeststest contract account withdrawnow pays the returnedwithdraw_memoand asserts it differs from the memo the wallet asked for. Run in CI (essential_tests), not run locally.Documentation
withdraw_memothe anchor reports; rows already pending keep their memo).Known limitations
DefaultPaymentListenerTest) and by the server-minted memo.deposit_info_generator_type: none) can still race. Server-minted memos collide with probability 2^-63.PATCH /transactionspath still assigns memos without this check; it is out of scope here.