Repository navigation
fix(module): refuse an EVM transaction with no recipient - #117
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Comment |
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): fix(module): refuse an EVM transaction with no recipient. The change replaces the silent mapping of a blank or whitespace-only EVM recipient to `to: None` (which in a legacy EVM transaction means contract creation) with an explicit `InvalidInput("EVM recipient is required")` refusal in the shared `evm_transaction` constructor, and updates the corresponding unit test to assert the refusal for `""` and `" "`. The latest push delta is unavailable, so only whole-pull-request evidence is described. Review snapshot
Completeness: Complete What changedAn EVM `TransactionSpec` with a blank or whitespace-only `to` was previously encoded as `to: None`, meaning a legacy contract creation that deploys `data` and sends `value` to the new contract. The `evm_transaction` constructor now trim-checks `to` and returns `Failure::InvalidInput("EVM recipient is required")` before constructing the transaction; the struct literal unconditionally uses `Some(to.clone())`, reachable only for non-blank input. The description lane reports both callers (`build_unsigned` and `attach_signature`) route through this one function, so both paths refuse consistently. No public API change; specs previously accepted as contract creation now error. Features
TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
evm_transaction mapped a blank `to` to None, which signs a contract creation. No wallet flow creates contracts, so a blank recipient is now InvalidInput instead of a transaction that deploys its data as code.
7292a38 to
926f2d4
Compare
Summary
The module rebuilds an EVM transaction from its wire fields before hashing and signing it. A blank or whitespace-only
towas mapped toNone, which in a legacy EVM transaction means contract creation: the wallet would sign a transaction that deploys itsdataas a new contract and sendsvalueto it. No wallet flow (transfers, swaps, bridges, dapp calls) creates contracts, and the comment beside the code already said so. A blank recipient is now refused withInvalidInput("EVM recipient is required")before anything is signed. Both callers (signing payload construction and signature attachment) go through this one function.Related issue
None.
API or behavior changes
An EVM
TransactionSpecwith an empty or whitespace-onlytois now refused (InvalidInput) instead of being signed as a contract creation. No public API change.Validation
cargo fmt --all -- --check(touched files, rustfmt edition 2024)cargo clippy --all-targets --all-features -- -D warnings: left to CIcargo build --all-targets --all-features: left to CIcargo test --all-features: only the targeted test below ran locally; CI runs the suiteTests
service::test::transaction_shape_and_key_guards_refuse_cross_chain_inputsasserted that a blank recipient produced a contract creation; it now asserts""and" "are refused withInvalidInput.cargo test -p tinywallet-module --lib -- transaction_shape_and_key_guards_refuse_cross_chain_inputsFAILED. 0 passed; 1 failed(the blank recipient was accepted).ok. 1 passed; 0 failed.Documentation
None needed; the inline comment is updated.
Checklist
#[allow(...)],#[ignore], or relaxed lints.envcontents in the diff or the description