Repository navigation
Refuse a plain value send to an address that holds code - #27
Conversation
_sign_and_send with empty calldata and a recipient that holds code (the WrappedSALT and EntryPoint entries of the live 40204 book) must refuse with "This address is a contract. Use its deposit function instead." before signing; a plain account is sent as before; a call with calldata is not checked; unreadable code is refused. Red: CONTRACT_RECIPIENT does not exist yet. Signed-off-by: Larry Klosowski <larryklosowski@proton.me> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019cgBjEUXiPasw1yPyGXkXC
_sign_and_send now reads eth_getCode for the recipient of a plain value transfer (no calldata, value > 0) before signing: code present raises "This address is a contract. Use its deposit function instead." (exported as CONTRACT_RECIPIENT); code that cannot be read is refused. Calls with calldata and sends to plain accounts are unchanged. Signed-off-by: Larry Klosowski <larryklosowski@proton.me> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019cgBjEUXiPasw1yPyGXkXC
Signed-off-by: Larry Klosowski <larryklosowski@proton.me> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019cgBjEUXiPasw1yPyGXkXC
|
Independent review (Claude R5) @5436f0ab: CHANGES (details in the private review packet) |
BerryManifold
left a comment
There was a problem hiding this comment.
Automated Codex static review of 5436f0abd66078bd8bff43774ff0886b68f84854 is complete. Result: blockers; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.
Matr0xshka
left a comment
There was a problem hiding this comment.
Automated Codex static review of 5436f0abd66078bd8bff43774ff0886b68f84854 is complete. Result: blockers; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.
…5 B1) A CitrateWalletFactory wallet is Solady's ERC1967 proxy whose implementation slot holds the book's CitrateWallet (receive() is empty), so a plain transfer credits it. The same proxy code for any other implementation, other code, or an unreadable slot is still refused. Pins the proxy runtime, its codehash and the ERC1967 slot as the definition Core shares. Message copy says why (R5 N2). Signed-off-by: Larry Klosowski <larryklosowski@proton.me> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019cgBjEUXiPasw1yPyGXkXC
The recipient check allows exactly one kind of code: CitrateWalletFactory's ERC1967 proxy runtime (Solady LibClone, the same bytes the address prediction hashes) whose ERC1967 implementation slot holds the book's CitrateWallet. Any other code, the same proxy for another implementation, or a slot that cannot be read is refused. The runtime, its codehash and the slot are exported from identity.wallet as the shared definition Core pins too. Message copy says why. Signed-off-by: Larry Klosowski <larryklosowski@proton.me> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019cgBjEUXiPasw1yPyGXkXC
Signed-off-by: Larry Klosowski <larryklosowski@proton.me> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019cgBjEUXiPasw1yPyGXkXC
|
Independent review (Claude R5) @48fc6e25: APPROVE (details in the private review packet) |
BerryManifold
left a comment
There was a problem hiding this comment.
Automated Codex static review of 48fc6e25cea6a6bda8c7cda7bf1407b1c4cf9d0b is complete. Result: blockers; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.
Matr0xshka
left a comment
There was a problem hiding this comment.
Automated Codex static review of 48fc6e25cea6a6bda8c7cda7bf1407b1c4cf9d0b is complete. Result: blockers; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.
Refuse a plain value send to an address that holds code
CitrateClient._sign_and_sendnow checks the recipient of a plain value transfer (no calldata, value above zero) witheth_getCodebefore signing. If the address holds code, it raisesCitrateError("This address is a contract. Use its deposit function instead.")(exported asCONTRACT_RECIPIENT). If the code cannot be read, it refuses as well. Calls that carry calldata, and sends to plain accounts, work as before.Data source (Rule 7):
eth_getCodeon the client'srpc_url.Tests (red first)
CONTRACT_RECIPIENTmissing). Green:tests/test_plain_transfer_recipient.py5/5. These tests send value to the WrappedSALT and EntryPoint entries of the live 40204 book and expect a refusal with nothing signed. They also cover a plain account (sent as before), calldata (not checked), and unreadable code (refused).test_client,test_audit_rm_g_chainid,test_call_site_guard_pins,test_gap_guard_pins,test_hardening_round3/4(182 passed). ruff and mypy are clean.Review record
Money path: one independent review requested in the swarm review queue.
🤖 Generated with Claude Code
https://claude.ai/code/session_019cgBjEUXiPasw1yPyGXkXC