-
Notifications
You must be signed in to change notification settings - Fork 101
fix: correct toAddress assignment in transaction queueing logic #917
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
Conversation
WalkthroughUpdates ERC20 transfer flow to pass the queued transaction’s toAddress from the prepared transaction object (transaction.to) instead of the original input address. Native transfer flow remains unchanged. No public API signatures altered. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client
participant R as Route: /backend-wallet/transfer
participant T as ERC20 Tx Preparer
participant Q as Queue Service
C->>R: POST transfer (ERC20)
R->>T: prepare ERC20 transaction
T-->>R: transaction { to, data, ... }
note right of R: New: use transaction.to for queued toAddress
R->>Q: queueTransaction({ toAddress = checksum(transaction.to), ... })
Q-->>R: queued
R-->>C: 202 Accepted
rect rgb(240,248,255)
note over R: Native transfer path unchanged
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal). Please share your feedback with us on this Discord post. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/server/routes/backend-wallet/transfer.ts (3)
160-166
: Defensive fallback iftransaction.to
is ever undefined.Small hardening: use the known
currencyAddress
as a fallback.queueId = await queueTransaction({ transaction, fromAddress: getChecksumAddress(walletAddress), - toAddress: getChecksumAddress(transaction.to), + toAddress: getChecksumAddress(transaction.to ?? currencyAddress), accountAddress: getChecksumAddress(accountAddress),
112-118
: Normalize/checksum native transferto
for consistency.You checksum
target
but notto
ininsertedTransaction
. Align both.- to: to as Address, + to: getChecksumAddress(to) as Address,
167-167
: Avoid passingvalue
overrides on ERC20 calls.If callers set
value
intxOverrides
, ERC20transfer
(non‑payable) will revert. Stripvalue
for token transfers unless you explicitly support payable extensions.- txOverrides, + // drop value for ERC20 to prevent accidental reverts + { ...(txOverrides ?? {}), value: undefined },If
queueTransaction
sanitizesvalue
for non‑payable calls already, ignore this suggestion. Otherwise, please confirm.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/server/routes/backend-wallet/transfer.ts
(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/server/routes/backend-wallet/transfer.ts (1)
src/shared/utils/primitive-types.ts (1)
getChecksumAddress
(34-38)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build
- GitHub Check: lint
🔇 Additional comments (1)
src/server/routes/backend-wallet/transfer.ts (1)
160-166
: Good fix — use the token contract (transaction.to) as the L1 target; verify PreparedTransaction.to is always setqueueTransaction stores the passed toAddress into queued.to and queued.target, and send-transaction-worker uses to ?? target and asserts a to value exists — so passing transaction.to is the correct semantic.
I couldn't find the PreparedTransaction type/creator in the repo scan; confirm transferERC20 (or whichever builds this PreparedTransaction) always populates transaction.to, or add a guard before calling getChecksumAddress(transaction.to).
PR-Codex overview
This PR focuses on modifying the way the
toAddress
is derived in thetransfer.ts
file, ensuring it uses theto
address from thetransaction
object instead of a separate variable.Detailed summary
toAddress
fromgetChecksumAddress(to)
togetChecksumAddress(transaction.to)
.Summary by CodeRabbit