-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Mark ERC721Holder and ERC1155Holder as stateless #5942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
WalkthroughThe change adds a NatSpec tag "@Custom:stateless" to the docblocks of ERC721Holder and ERC1155Holder contracts. The CHANGELOG notes a breaking change: these holders are marked stateless and are no longer transpiled, requiring projects that used upgradeable variants to update imports to the equivalents in @openzeppelin/contracts. No contract logic, interfaces, or public signatures were modified. Functions onERC721Received, onERC1155Received, onERC1155BatchReceived, and supportsInterface remain unchanged. Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
contracts/token/ERC721/utils/ERC721Holder.sol (1)
14-16: LGTM; consider a brief inline explanation for the tag.Add one sentence explaining that “stateless” means no storage/initializers and safe use in upgradeable contexts without a dedicated variant.
/** * @dev Implementation of the {IERC721Receiver} interface. * * Accepts all token transfers. * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or * {IERC721-setApprovalForAll}. + + * @dev This contract is stateless (no storage / no initializer) and can be used in upgradeable deployments + * without a specialized upgradeable variant. * * @custom:stateless */contracts/token/ERC1155/utils/ERC1155Holder.sol (1)
14-16: LGTM; mirror the brief “stateless” explanation for consistency.Same one-liner as in ERC721Holder to aid readers scanning the docs.
/** * @dev Simple implementation of `IERC1155Receiver` that will allow a contract to hold ERC-1155 tokens. * * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be * stuck. + + * @dev This contract is stateless (no storage / no initializer) and can be used in upgradeable deployments + * without a specialized upgradeable variant. * * @custom:stateless */
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
CHANGELOG.md(1 hunks)contracts/token/ERC1155/utils/ERC1155Holder.sol(1 hunks)contracts/token/ERC721/utils/ERC721Holder.sol(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: slither
- GitHub Check: tests-foundry
- GitHub Check: coverage
- GitHub Check: tests
- GitHub Check: tests-upgradeable
- GitHub Check: halmos
🔇 Additional comments (1)
CHANGELOG.md (1)
10-10: Clarify CHANGELOG migration and confirm aliasingAdd the explicit import-migration example to CHANGELOG; repository contains no local
ERC721HolderUpgradeable/ERC1155HolderUpgradeablereferences and docs already import the non-upgradeable holders (docs/modules/ROOT/pages/multisig.adoc:39-40, 83-84, 150-151). Verify whether@openzeppelin/contracts-upgradeablestill exposes temporary aliases/stubs and include their deprecation window if present.- `ERC721Holder` and `ERC1155Holder` are flagged as stateless and are no longer transpiled. Developers that use the upgradeable version of these contracts must update their imports to use the equivalent version available in `@openzeppelin/contracts`. + `ERC721Holder` and `ERC1155Holder` are flagged as stateless and are no longer transpiled. + Migration: update imports to the non-upgradeable equivalents in `@openzeppelin/contracts`: + + ```diff + - import { ERC721HolderUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol"; + + import { ERC721Holder } from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; + + - import { ERC1155HolderUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC1155/utils/ERC1155HolderUpgradeable.sol"; + + import { ERC1155Holder } from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; + ``` + + Rationale: these holders are stateless (no storage), so upgradeable variants are unnecessary. If aliases or stubs are provided in `@openzeppelin/contracts-upgradeable`, note their deprecation window here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be in favor of these changes, considering we're changing the transpilation process and there's another rename in 5.5 (SIgnerERC7702 -> SignerEIP7702)
Co-authored-by: Ernesto García <[email protected]>
PR Checklist
npx changeset add)