Repository navigation
feat(solidity-import): support Create2/Clones Yul address prediction, keccak256(_msgData()), and bounded deque pop while loops - #2502
Conversation
… keccak256(_msgData()), and bounded deque pop while loops
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 770535816f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| unless ← isIdentNamed m8Args[0]! startName do return none | ||
| let some prefixByte ← yulNatLit? m8Args[1]! | return none | ||
| unless prefixByte < 256 do return none | ||
| let some (varNode, kStartNode, kSizeNode) ← keccakAssign? stmts[6]! | return none |
There was a problem hiding this comment.
Unwrap the address mask before matching the hash
The OpenZeppelin blocks this branch is intended to support assign addr := and(keccak256(start, 85), 0xffff...ffff) (and Clones uses the same wrapper), as documented in docs/SOLIDITY_IMPORT.md:873-874. However, keccakAssign? only accepts an assignment whose RHS is directly a keccak256 call, so both real OpenZeppelin forms return none here and fall through to the generic lowering, which cannot handle this mload(0x40) block. The new positive fixture avoids the failure by omitting the and, so it does not exercise the advertised source form.
Useful? React with 👍 / 👎.
| unless fname == "popFront" || fname == "popBack" do return none | ||
| let params ← mArr (← mField (← mField fn "parameters") "parameters") | ||
| unless params.size == 1 && optStr params[0]! "storageLocation" == some "storage" do return none | ||
| let pty ← mType params[0]! | ||
| unless pty.startsWith "struct " && !pty.contains "[" do return none |
There was a problem hiding this comment.
Verify deque pop semantics before imposing a bound
This recognizes any function named popFront or popBack with a storage struct whose first two fields have the expected names and types, without proving that the function advances the corresponding index or reverts when empty. For example, a custom library with the same struct shape and a popFront that always returns a nonmatching constant would loop until out-of-gas in Solidity, while this lowering computes a one-iteration bound for an empty deque and then continues execution. Either validate the admitted function body against the deque operation or restrict resolution to a known implementation before replacing the loop.
Useful? React with 👍 / 👎.
Summary
Create2.computeAddress(bytes32,bytes32,address)(7-statement Yul block hashing the 85-byte0xff || deployer || salt || bytecodeHashwindow) andClones.predictDeterministicAddress(address,bytes32,address)(8-statement Yul block hashing the 55-byte EIP-1167 runtime initcode atptr..ptr+0x37and then the 85-byte CREATE2 window atptr+0x43..ptr+0x98).msg.datahelpers returningbytes calldataorbytes memory(such as OpenZeppelinContext._msgData()) insidekeccak256(_msgData())and encoded byte contexts by materializingcalldatasizebytes viacalldatacopy.DoubleEndedQueue.Bytes32DequepopFront/popBackwhileloops (while (_governanceCall.popFront() != msgDataHash) {}andwhile (target != _backQueue.popBack()) {}) as used in OpenZeppelinGovernorTimelockControl.executeOperations.Create2ClonesMsgDataDequeSequence.solandCreate2ClonesMsgDataDequeSequenceModel.lean, differential storage & stateful probes, rejection tests, and mutation anchors.