-
Notifications
You must be signed in to change notification settings - Fork 608
[X402] Fix network comparison in decodePaymentRequest #8313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[X402] Fix network comparison in decodePaymentRequest #8313
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 2fc5974 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Caution Review failedThe pull request is closed. WalkthroughPatch release metadata added and a network comparison in payment decoding changed to compare normalized chain IDs via Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Decoder as decodePaymentRequest()
participant Value as selectedPaymentRequirements.value
participant Decoded as decodedPayment
rect rgba(0,128,0,0.06)
Note over Decoder,Value: Previous check (string equality)
Decoder->>Value: compare value.network === decodedPayment.network
alt equal
Decoder-->>Decoder: match
else not equal (different representations)
Decoder-->>Decoder: no match (false negative)
end
end
rect rgba(0,64,128,0.06)
Note over Decoder,Value: New check (normalized chain IDs)
Decoder->>Value: networkToChainId(value.network)
Decoder->>Decoded: networkToChainId(decodedPayment.network)
alt same chain id
Decoder-->>Decoder: match (correct)
else different chain id
Decoder-->>Decoder: no match
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (2)
Comment |
59145bc to
2fc5974
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8313 +/- ##
==========================================
- Coverage 54.90% 54.90% -0.01%
==========================================
Files 919 919
Lines 60687 60697 +10
Branches 4135 4130 -5
==========================================
+ Hits 33319 33323 +4
- Misses 27267 27272 +5
- Partials 101 102 +1
🚀 New features to boost your workflow:
|
size-limit report 📦
|

PR-Codex overview
This PR focuses on fixing the network comparison logic in the
thirdweblibrary by updating the way network values are compared.Detailed summary
packages/thirdweb/src/x402/common.tsfile.value.network === decodedPayment.networktonetworkToChainId(value.network) === networkToChainId(decodedPayment.network).Summary by CodeRabbit
Bug Fixes