Skip to content

[TEST-3] [LOW] Negative-path FlowTransferV1 construction duplicated in Flow.transfer.t.sol #421

Description

@thedavidmeister

Negative-path FlowTransferV1 construction duplicated across Flow.transfer.t.sol

Three negative-path tests in test/src/concrete/Flow.transfer.t.sol build "invalid" FlowTransferV1 structs inline (where one transfer's from is a third-party that is neither the source contract nor msg.sender). The construction blocks repeat the same shape four times:

  • Lines 172-180 (ERC20: bob → flow, flow → alice)
  • Lines 187-197 (ERC20: alice → flow, bob → alice)
  • Lines 222-230 (ERC721: bob → flow, flow → alice)
  • Lines 261-274 (ERC1155: bob → flow, flow → alice)

Each block: declare ERC{20,721,1155}Transfer[2], populate two entries with the bad from, wrap in FlowTransferV1(...), call generateFlowStack, then interpreterEval2MockCall.

test/abstract/FlowTransferOperation.sol already provides positive-path constructors (createTransferERC20toERC20, createTransferERC721ToERC721, createTransferERC1155ToERC1155) but no analogue for the third-party-from shape these revert tests need.

Fix: add createUnauthorizedERC20Transfer(address from, address to, address flow, uint256 amount) (and ERC721/ERC1155 variants) to FlowTransferOperation.sol, then call them from Flow.transfer.t.sol. Reduces 30+ lines of inline struct manipulation per test.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

auditAudit findinglowSeverity: lowpass4Audit Pass 4: Code Quality

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions