feat(svm): implement extra.memo support for exact scheme#1688
Open
tenequm wants to merge 3 commits intocoinbase:mainfrom
Open
feat(svm): implement extra.memo support for exact scheme#1688tenequm wants to merge 3 commits intocoinbase:mainfrom
tenequm wants to merge 3 commits intocoinbase:mainfrom
Conversation
Implement the spec change from PR coinbase#1682, adding optional seller-defined memo support to the SVM exact scheme across all three SDKs. Client changes (TypeScript, Go, Python - both v1 and v2): - When extra.memo is present, use its UTF-8 value as memo instruction data - When absent, fall back to existing random 16-byte nonce behavior - Validate memo does not exceed MAX_MEMO_BYTES (256) limit Facilitator changes (TypeScript, Go, Python - both v1 and v2): - When extra.memo is present in requirements, verify exactly one memo instruction exists and its data matches the expected value - Return specific error codes: memo_count / memo_mismatch Constants added: - MAX_MEMO_BYTES / MaxMemoBytes (256) across all languages - ERR_MEMO_MISMATCH, ERR_MEMO_COUNT (Python/Go) - ErrMemoExceedsMaxSize (Go client) Tests added: - TypeScript: 4 memo tests in duplicateTx.test.ts - Go: TestSellerMemo with 4 subtests in duplicate_tx_test.go - Python: TestSellerMemo class with 4 tests in test_duplicate_tx.py Closes coinbase#1682
🟡 Heimdall Review Status
|
|
@tenequm is attempting to deploy a commit to the Coinbase Team on Vercel. A member of the Team first needs to authorize it. |
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.
Summary
Implements the
extra.memospec from #1682 across all three SDKs (TypeScript, Go, Python), both v1 and v2 versions.Changes
Client (all languages, v1 + v2)
extra.memois present in payment requirements, use its UTF-8 value as the Memo instruction dataMAX_MEMO_BYTES(256 bytes)Facilitator (all languages, v1 + v2)
extra.memois present in requirements, verify:extra.memovalue (UTF-8)memo_count/memo_mismatchConstants added
MAX_MEMO_BYTES256MaxMemoBytes256ErrMemoMismatch,ErrMemoCountErrMemoExceedsMaxSizeMAX_MEMO_BYTES256ERR_MEMO_MISMATCH,ERR_MEMO_COUNTTests added
duplicateTx.test.tsTestSellerMemowith 4 subtests induplicate_tx_test.goTestSellerMemoclass with 4 tests intest_duplicate_tx.pyAll test suites pass (TS: 129, Go: 50, Python: 120). All linters/formatters clean.
Files changed (26)
TypeScript (6 files)
src/constants.ts- addedMAX_MEMO_BYTESsrc/exact/client/scheme.ts- v2 client memo supportsrc/exact/v1/client/scheme.ts- v1 client memo supportsrc/exact/facilitator/scheme.ts- v2 facilitator memo validationsrc/exact/v1/facilitator/scheme.ts- v1 facilitator memo validationtest/unit/duplicateTx.test.ts- memo testsGo (10 files)
mechanisms/svm/constants.go- addedMaxMemoBytesmechanisms/svm/exact/client/scheme.go+errors.go- v2 clientmechanisms/svm/exact/v1/client/scheme.go+errors.go- v1 clientmechanisms/svm/exact/facilitator/scheme.go+errors.go- v2 facilitatormechanisms/svm/exact/v1/facilitator/scheme.go+errors.go- v1 facilitatormechanisms/svm/exact/client/duplicate_tx_test.go- memo testsPython (7 files)
mechanisms/svm/constants.py- addedMAX_MEMO_BYTES, error constantsmechanisms/svm/__init__.py- exportsmechanisms/svm/exact/client.py- v2 client memo supportmechanisms/svm/exact/v1/client.py- v1 client memo supportmechanisms/svm/exact/facilitator.py- v2 facilitator memo validationmechanisms/svm/exact/v1/facilitator.py- v1 facilitator memo validationtests/unit/mechanisms/svm/test_duplicate_tx.py- memo testsChangesets (3 files)
typescript/.changeset/svm-seller-memo.mdgo/.changes/unreleased/svm-seller-memo.yamlpython/x402/changelog.d/1682.feature.md