Improve 0.8.35 compatibility#6494
Conversation
and keep "XXX will do not promote promoted to keyword in the future" warnings to errors.
…d DoubleEndedQueue
|
WalkthroughThis pull request introduces a systematic refactoring of enumerable data structures and parameter naming conventions. The 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
contracts/utils/structs/EnumerableMap.sol (1)
292-294: ⚡ Quick winUse
_inner.pos(index)directly inside typedpos(...)wrappers.These wrappers still call
_inner.at(index)indirectly. Switching to_inner.pos(index)keeps the migration consistent and removes deprecated-path usage in new code.♻️ Proposed change pattern
function pos(UintToUintMap storage map, uint256 index) internal view returns (uint256 key, uint256 value) { - (bytes32 atKey, bytes32 val) = at(map._inner, index); + (bytes32 atKey, bytes32 val) = pos(map._inner, index); return (uint256(atKey), uint256(val)); }Apply the same replacement pattern to the other typed
pos(...)wrappers listed above.Also applies to: 433-435, 574-576, 715-717, 856-858, 1001-1003, 1146-1148, 1287-1289, 1432-1434
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@contracts/utils/structs/EnumerableMap.sol` around lines 292 - 294, The typed pos wrapper pos(UintToUintMap storage map, uint256 index) currently calls at(map._inner, index); replace that deprecated indirect call with the new direct inner method by calling map._inner.pos(index) (or _inner.pos(index)) and cast the returned (bytes32, bytes32) to (uint256, uint256) as before; apply the same replacement pattern to the other typed pos(...) wrappers referenced (the wrappers around _inner.at at the other listed locations) so each uses _inner.pos(index) directly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/generate/templates/EnumerableMap.js`:
- Around line 291-293: The generated pos function still calls the deprecated at
helper; update the implementation of pos(${name} storage map, uint256 index) to
call pos(map._inner, index) instead of at(map._inner, index), then convert the
returned bytes32 values to the appropriate types using the existing
${fromBytes32} helpers (i.e., use the bytes32 results from pos(...) named atKey
and val and pass them through ${fromBytes32(key.type, 'atKey')} and
${fromBytes32(value.type, 'val')} as before). Ensure the symbol names (pos,
atKey, val, ${fromBytes32}) match the template so generated code no longer
references the deprecated at helper.
---
Nitpick comments:
In `@contracts/utils/structs/EnumerableMap.sol`:
- Around line 292-294: The typed pos wrapper pos(UintToUintMap storage map,
uint256 index) currently calls at(map._inner, index); replace that deprecated
indirect call with the new direct inner method by calling map._inner.pos(index)
(or _inner.pos(index)) and cast the returned (bytes32, bytes32) to (uint256,
uint256) as before; apply the same replacement pattern to the other typed
pos(...) wrappers referenced (the wrappers around _inner.at at the other listed
locations) so each uses _inner.pos(index) directly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: d9c2109a-d8d3-44e4-b601-83575de9def9
📒 Files selected for processing (17)
contracts/access/extensions/AccessControlEnumerable.solcontracts/governance/utils/Votes.solcontracts/mocks/ConstructorMock.solcontracts/mocks/docs/AccessManagerEnumerable.solcontracts/mocks/token/ERC1155ReceiverMock.solcontracts/mocks/token/ERC1363ReceiverMock.solcontracts/mocks/token/ERC1363SpenderMock.solcontracts/mocks/token/ERC721ReceiverMock.solcontracts/utils/cryptography/ECDSA.solcontracts/utils/structs/Checkpoints.solcontracts/utils/structs/DoubleEndedQueue.solcontracts/utils/structs/EnumerableMap.solcontracts/utils/structs/EnumerableSet.solhardhat.config.jsscripts/generate/templates/Checkpoints.jsscripts/generate/templates/EnumerableMap.jsscripts/generate/templates/EnumerableSet.js
erroras a variable nameatposfunctionposfunctions whereveratwas previously calledhardhat.config.jsatfunctions.PR Checklist
npx changeset add)