-
Notifications
You must be signed in to change notification settings - Fork 1
Problem: erc 1967 proxy is not tested #82
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
WalkthroughReplaces the OpenZeppelin submodule with the Upgradeable variant, updates remappings and import paths, adds upgradeable token contracts (MyToken, MyToken2), updates build utilities to use remappings and a dir parameter, adjusts gas expectations in tests, and adds an ERC1967 proxy upgrade test. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Tester
participant Utils
participant Solc
participant AsyncW3 as AsyncWeb3
participant Impl1 as MyToken (impl)
participant Proxy as ERC1967Proxy
participant Impl2 as MyToken2 (impl)
Tester->>Utils: build_and_deploy_contract_async("MyToken", dir="contracts")
Utils->>Solc: compile with remappings (read from remappings.txt)
Solc-->>Utils: ABI + bytecode
Utils->>AsyncW3: deploy MyToken -> Impl1 address
AsyncW3-->>Tester: Impl1
Tester->>Utils: prepare proxy init data (initialize(owner))
Utils->>AsyncW3: deploy ERC1967Proxy pointing to Impl1 with init data
AsyncW3-->>Tester: Proxy address
Tester->>Utils: build_and_deploy_contract_async("MyToken2")
Utils->>Solc: compile MyToken2
Utils->>AsyncW3: deploy MyToken2 -> Impl2 address
AsyncW3-->>Tester: Impl2
Tester->>AsyncW3: call Proxy.upgradeToAndCall(Impl2, initData)
AsyncW3-->>Tester: tx receipt (status: success)
Note right of Proxy: Proxy now references Impl2 ABI
Tester->>AsyncW3: call Proxy.newFeature()
AsyncW3-->>Tester: "Upgraded!"
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
integration_tests/contracts/contracts/CounterWithCallbacks.sol (1)
45-47
: Use SafeERC20 to handle non-standard ERC20 return values and avoid false-positives in accounting.Directly calling
transferFrom
and ignoring the return value can desync balances when tokens returnfalse
instead of reverting. Use SafeERC20’ssafeTransferFrom
and only update state after a successful call.Apply within this function:
- IERC20(token).transferFrom(msg.sender, address(this), amount); + IERC20(token).safeTransferFrom(msg.sender, address(this), amount);Additionally required outside this hunk:
// imports (consistent with upgradeable stack) import { SafeERC20Upgradeable as SafeERC20 } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; // attach the library (place near contract declaration) using SafeERC20 for IERC20;Also applies to: 52-57
🧹 Nitpick comments (8)
integration_tests/contracts/contracts/CounterWithCallbacks.sol (2)
42-57
: Optional hardening: add basic input validation.Prevent accidental misuse with zero address or zero amount.
function add(address token, uint256 amount) external { + require(token != address(0), "token=0"); + require(amount > 0, "amount=0");
8-15
: Optional hardening: protect against reentrancy.A malicious token could attempt callback-based reentrancy. While low-risk here, consider ReentrancyGuard for consistency with OZ patterns:
- Import:
import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
(or upgradeable variant if aligned)- Inherit:
contract CounterWithCallbacks is ICallbacks, ReentrancyGuard {
- Add modifier:
function add(...) external nonReentrant { ... }
integration_tests/utils.py (1)
392-395
: Consider adding error handling for remappings file.The code assumes
contracts/remappings.txt
always exists. Consider adding error handling for cases where the file might be missing or malformed.- with open("contracts/remappings.txt", "r") as f: - remappings = f.read().strip().split() - - cmd.extend(remappings) + remappings_path = Path("contracts/remappings.txt") + if remappings_path.exists(): + with open(remappings_path, "r") as f: + remappings = f.read().strip().split() + cmd.extend(remappings) + else: + print(f"Warning: {remappings_path} not found, proceeding without remappings")integration_tests/expected_constants.py (1)
22-23
: Remove unusednoqa
directivesThe static analysis tool correctly identifies that the
noqa
directives for E501 (line too long) are unnecessary since this rule is not enabled in your configuration.- "input": "0x6080346200037d576040906001600160401b03908083018281118282101762000288578352600b81526020906a084d2e8c6ded2dc409a82b60ab1b82820152835192848401848110828211176200028857855260038085526209a82b60eb1b84860152825182811162000288578154906001948583811c9316801562000372575b878410146200035e578190601f938481116200030b575b508790848311600114620002a8575f926200029c575b50505f1982851b1c191690851b1782555b8551928311620002885760049586548581811c911680156200027d575b878210146200026a5782811162000222575b5085918411600114620001bb579383949184925f95620001af575b50501b925f19911b1c19161782555b331562000199576002546a52b7d2dcc80cd2e4000000928382018092116200018657505f917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9160025533835282815284832084815401905584519384523393a351610bc49081620003828239f35b601190634e487b7160e01b5f525260245ffd5b505f602492519163ec442f0560e01b8352820152fd5b015193505f8062000108565b9190601f19841692875f5284875f20945f5b89898383106200020a5750505010620001f0575b50505050811b01825562000117565b01519060f8845f19921b161c191690555f808080620001e1565b868601518955909701969485019488935001620001cd565b875f52865f208380870160051c82019289881062000260575b0160051c019086905b82811062000254575050620000ed565b5f815501869062000244565b925081926200023b565b602288634e487b7160e01b5f525260245ffd5b90607f1690620000db565b634e487b7160e01b5f52604160045260245ffd5b015190505f80620000ad565b90879350601f19831691865f52895f20925f5b8b828210620002f45750508411620002dc575b505050811b018255620000be565b01515f1983871b60f8161c191690555f8080620002ce565b8385015186558b97909501949384019301620002bb565b909150845f52875f208480850160051c8201928a861062000354575b918991869594930160051c01915b8281106200034557505062000097565b5f815585945089910162000335565b9250819262000327565b634e487b7160e01b5f52602260045260245ffd5b92607f169262000080565b5f80fdfe60806040526004361015610011575f80fd5b5f803560e01c90816306fdde03146100b757508063095ea7b3146100b257806318160ddd146100ad57806323b872dd146100a8578063313ce567146100a357806370a082311461009e5780637e497d801461009957806395d89b4114610094578063a9059cbb1461008f5763dd62ed3e1461008a575f80fd5b61088f565b610840565b610715565b6106bd565b61065b565b610622565b6104fb565b6104c0565b61037a565b3461026657807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102665760035460018082169180821c9184841561025c575b602092838510861461022f576101128560805260a090565b959081156101d3575060011461015f575b61014e7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808701610920565b6040518061015b81610269565b0390f35b60035f529394507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8385106101c257505050910190507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8061014e838080610123565b805486860152938201938101610188565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016865250505050151560051b0190507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8061014e838080610123565b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526022600452fd5b92607f16926100fa565b80fd5b906020918281526080519283818301525f5b8481106102b95750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f845f6040809697860101520116010190565b60a081015183820160400152810161027b565b6020808252825181830181905293925f5b85811061031c575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f845f6040809697860101520116010190565b8181018301518482016040015282016102dd565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361035357565b5f80fd5b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361035357565b346103535760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610353576103b1610330565b60243533156104905773ffffffffffffffffffffffffffffffffffffffff82169182156104605761042882916104053373ffffffffffffffffffffffffffffffffffffffff165f52600160205260405f2090565b9073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f35b60246040517f94280d620000000000000000000000000000000000000000000000000000000081525f6004820152fd5b60246040517fe602df050000000000000000000000000000000000000000000000000000000081525f6004820152fd5b34610353575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610353576020600254604051908152f35b346103535760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261035357610532610330565b61053a610357565b6044359073ffffffffffffffffffffffffffffffffffffffff83165f5260016020526105873360405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b54927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84036105c7575b6105bb93506109d0565b60405160018152602090f35b8284106105e3576105de836105bb95033383610b71565b6105b1565b6040517ffb8f41b20000000000000000000000000000000000000000000000000000000081523360048201526024810185905260448101849052606490fd5b34610353575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261035357602060405160128152f35b346103535760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103535773ffffffffffffffffffffffffffffffffffffffff6106a7610330565b165f525f602052602060405f2054604051908152f35b34610353575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261035357602080517f68656c6c6f20776f726c640000000000000000000000000000000000000000008152a0005b34610353575f807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102665760405190806004549060019180831c92808216928315610836575b602092838610851461022f5785885260208801949081156107f7575060011461079f575b61015b876107938189038261098f565b604051918291826102cc565b60045f5294509192917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b8386106107e657505050910190506107938261015b5f80610783565b8054858701529482019481016107ca565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685525050505090151560051b0190506107938261015b5f80610783565b93607f169361075f565b346103535760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103535761088461087a610330565b60243590336109d0565b602060405160018152f35b346103535760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103535760206109176108cb610330565b73ffffffffffffffffffffffffffffffffffffffff6108e8610357565b91165f526001835260405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b54604051908152f35b601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09101166080016080811067ffffffffffffffff82111761096257604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761096257604052565b9173ffffffffffffffffffffffffffffffffffffffff91828416928315610b41578116938415610b1157610a218173ffffffffffffffffffffffffffffffffffffffff165f525f60205260405f2090565b54838110610abc57610ab7928492610a7d7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef96610aa194039173ffffffffffffffffffffffffffffffffffffffff165f525f60205260405f2090565b5573ffffffffffffffffffffffffffffffffffffffff165f525f60205260405f2090565b8054820190556040519081529081906020820190565b0390a3565b6040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff929092166004830152602482015260448101839052606490fd5b60246040517fec442f050000000000000000000000000000000000000000000000000000000081525f6004820152fd5b60246040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081525f6004820152fd5b9073ffffffffffffffffffffffffffffffffffffffff808316156104905781161561046057610405610bc19273ffffffffffffffffffffffffffffffffffffffff165f52600160205260405f2090565b5556", # noqa: E501 - "output": "0x60806040526004361015610011575f80fd5b5f803560e01c90816306fdde03146100b757508063095ea7b3146100b257806318160ddd146100ad57806323b872dd146100a8578063313ce567146100a357806370a082311461009e5780637e497d801461009957806395d89b4114610094578063a9059cbb1461008f5763dd62ed3e1461008a575f80fd5b61088f565b610840565b610715565b6106bd565b61065b565b610622565b6104fb565b6104c0565b61037a565b3461026657807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102665760035460018082169180821c9184841561025c575b602092838510861461022f576101128560805260a090565b959081156101d3575060011461015f575b61014e7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808701610920565b6040518061015b81610269565b0390f35b60035f529394507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8385106101c257505050910190507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8061014e838080610123565b805486860152938201938101610188565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016865250505050151560051b0190507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8061014e838080610123565b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526022600452fd5b92607f16926100fa565b80fd5b906020918281526080519283818301525f5b8481106102b95750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f845f6040809697860101520116010190565b60a081015183820160400152810161027b565b6020808252825181830181905293925f5b85811061031c575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f845f6040809697860101520116010190565b8181018301518482016040015282016102dd565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361035357565b5f80fd5b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361035357565b346103535760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610353576103b1610330565b60243533156104905773ffffffffffffffffffffffffffffffffffffffff82169182156104605761042882916104053373ffffffffffffffffffffffffffffffffffffffff165f52600160205260405f2090565b9073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f35b60246040517f94280d620000000000000000000000000000000000000000000000000000000081525f6004820152fd5b60246040517fe602df050000000000000000000000000000000000000000000000000000000081525f6004820152fd5b34610353575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610353576020600254604051908152f35b346103535760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261035357610532610330565b61053a610357565b6044359073ffffffffffffffffffffffffffffffffffffffff83165f5260016020526105873360405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b54927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84036105c7575b6105bb93506109d0565b60405160018152602090f35b8284106105e3576105de836105bb95033383610b71565b6105b1565b6040517ffb8f41b20000000000000000000000000000000000000000000000000000000081523360048201526024810185905260448101849052606490fd5b34610353575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261035357602060405160128152f35b346103535760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103535773ffffffffffffffffffffffffffffffffffffffff6106a7610330565b165f525f602052602060405f2054604051908152f35b34610353575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261035357602080517f68656c6c6f20776f726c640000000000000000000000000000000000000000008152a0005b34610353575f807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102665760405190806004549060019180831c92808216928315610836575b602092838610851461022f5785885260208801949081156107f7575060011461079f575b61015b876107938189038261098f565b604051918291826102cc565b60045f5294509192917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b8386106107e657505050910190506107938261015b5f80610783565b8054858701529482019481016107ca565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685525050505090151560051b0190506107938261015b5f80610783565b93607f169361075f565b346103535760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103535761088461087a610330565b60243590336109d0565b602060405160018152f35b346103535760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103535760206109176108cb610330565b73ffffffffffffffffffffffffffffffffffffffff6108e8610357565b91165f526001835260405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b54604051908152f35b601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09101166080016080811067ffffffffffffffff82111761096257604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761096257604052565b9173ffffffffffffffffffffffffffffffffffffffff91828416928315610b41578116938415610b1157610a218173ffffffffffffffffffffffffffffffffffffffff165f525f60205260405f2090565b54838110610abc57610ab7928492610a7d7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef96610aa194039173ffffffffffffffffffffffffffffffffffffffff165f525f60205260405f2090565b5573ffffffffffffffffffffffffffffffffffffffff165f525f60205260405f2090565b8054820190556040519081529081906020820190565b0390a3565b6040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff929092166004830152602482015260448101839052606490fd5b60246040517fec442f050000000000000000000000000000000000000000000000000000000081525f6004820152fd5b60246040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081525f6004820152fd5b9073ffffffffffffffffffffffffffffffffffffffff808316156104905781161561046057610405610bc19273ffffffffffffffffffffffffffffffffffffffff165f52600160205260405f2090565b5556", # noqa: E501 + "input": "0x6080346200037d576040906001600160401b03908083018281118282101762000288578352600b81526020906a084d2e8c6ded2dc409a82b60ab1b82820152835192848401848110828211176200028857855260038085526209a82b60eb1b84860152825182811162000288578154906001948583811c9316801562000372575b878410146200035e578190601f938481116200030b575b508790848311600114620002a8575f926200029c575b50505f1982851b1c191690851b1782555b8551928311620002885760049586548581811c911680156200027d575b878210146200026a5782811162000222575b5085918411600114620001bb579383949184925f95620001af575b50501b925f19911b1c19161782555b331562000199576002546a52b7d2dcc80cd2e4000000928382018092116200018657505f917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9160025533835282815284832084815401905584519384523393a351610bc49081620003828239f35b601190634e487b7160e01b5f525260245ffd5b505f602492519163ec442f0560e01b8352820152fd5b015193505f8062000108565b9190601f19841692875f5284875f20945f5b89898383106200020a5750505010620001f0575b50505050811b01825562000117565b01519060f8845f19921b161c191690555f808080620001e1565b868601518955909701969485019488935001620001cd565b875f52865f208380870160051c82019289881062000260575b0160051c019086905b82811062000254575050620000ed575b5f815501869062000244565b925081926200023b565b602288634e487b7160e01b5f525260245ffd5b90607f1690620000db565b634e487b7160e01b5f52604160045260245ffd5b015190505f80620000ad565b90879350601f19831691865f52895f20925f5b8b828210620002f45750508411620002dc575b505050811b018255620000be565b01515f1983871b60f8161c191690555f8080620002ce565b8385015186558b97909501949384019301620002bb565b909150845f52875f208480850160051c8201928a861062000354575b918991869594930160051c01915b8281106200034557505062000097575b5f815585945089910162000335565b9250819262000327565b634e487b7160e01b5f52602260045260245ffd5b92607f169262000080575b5f80fdfe60806040526004361015610011575f80fd5b5f803560e01c90816306fdde03146100b757508063095ea7b3146100b257806318160ddd146100ad57806323b872dd146100a8578063313ce567146100a357806370a082311461009e5780637e497d801461009957806395d89b4114610094578063a9059cbb1461008f5763dd62ed3e1461008a575f80fd5b61088f565b610840565b610715565b6106bd565b61065b565b610622565b6104fb565b6104c0565b61037a565b3461026657807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102665760035460018082169180821c9184841561025c575b602092838510861461022f576101128560805260a090575b959081156101d3575060011461015f575b61014e7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808701610920565b6040518061015b81610269575b0390f35b60035f529394507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8385106101c257505050910190507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8061014e838080610123575b805486860152938201938101610188575b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016865250505050151560051b0190507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8061014e838080610123575b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526022600452fd5b92607f16926100fa575b80fd5b906020918281526080519283818301525f5b8481106102b95750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f845f6040809697860101520116010190575b60a081015183820160400152810161027b575b6020808252825181830181905293925f5b85811061031c575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f845f6040809697860101520116010190575b8181018301518482016040015282016102dd575b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361035357575b5f80fd5b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361035357575b346103535760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610353576103b1610330575b60243533156104905773ffffffffffffffffffffffffffffffffffffffff82169182156104605761042882916104053373ffffffffffffffffffffffffffffffffffffffff165f52600160205260405f2090575b9073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090575b556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f35b60246040517f94280d620000000000000000000000000000000000000000000000000000000081525f6004820152fd5b60246040517fe602df050000000000000000000000000000000000000000000000000000000081525f6004820152fd5b34610353575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610353576020600254604051908152f35b346103535760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261035357610532610330575b61053a610357575b6044359073ffffffffffffffffffffffffffffffffffffffff83165f5260016020526105873360405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090575b54927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84036105c7575b6105bb93506109d0575b60405160018152602090f35b8284106105e3576105de836105bb95033383610b71575b6105b1575b6040517ffb8f41b20000000000000000000000000000000000000000000000000000000081523360048201526024810185905260448101849052606490fd5b34610353575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261035357602060405160128152f35b346103535760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103535773ffffffffffffffffffffffffffffffffffffffff6106a7610330575b165f525f602052602060405f2054604051908152f35b34610353575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261035357602080517f68656c6c6f20776f726c640000000000000000000000000000000000000000008152a0005b34610353575f807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102665760405190806004549060019180831c92808216928315610836575b602092838610851461022f5785885260208801949081156107f7575060011461079f575b61015b876107938189038261098f575b604051918291826102cc575b60045f5294509192917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b8386106107e657505050910190506107938261015b5f80610783575b8054858701529482019481016107ca575b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685525050505090151560051b0190506107938261015b5f80610783575b93607f169361075f575b346103535760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103535761088461087a610330575b60243590336109d0575b602060405160018152f35b346103535760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103535760206109176108cb610330575b73ffffffffffffffffffffffffffffffffffffffff6108e8610357575b91165f526001835260405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090575b54604051908152f35b601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09101166080016080811067ffffffffffffffff82111761096257604052575b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761096257604052575b9173ffffffffffffffffffffffffffffffffffffffff91828416928315610b41578116938415610b1157610a218173ffffffffffffffffffffffffffffffffffffffff165f525f60205260405f2090575b54838110610abc57610ab7928492610a7d7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef96610aa194039173ffffffffffffffffffffffffffffffffffffffff165f525f60205260405f2090575b5573ffffffffffffffffffffffffffffffffffffffff165f525f60205260405f2090575b8054820190556040519081529081906020820190575b0390a3575b6040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff929092166004830152602482015260448101839052606490fd5b60246040517fec442f050000000000000000000000000000000000000000000000000000000081525f6004820152fd5b60246040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081525f6004820152fd5b9073ffffffffffffffffffffffffffffffffffffffff808316156104905781161561046057610405610bc19273ffffffffffffffffffffffffffffffffffffffff165f52600160205260405f2090575b5556", + "output": "0x60806040526004361015610011575f80fd5b5f803560e01c90816306fdde03146100b757508063095ea7b3146100b257806318160ddd146100ad57806323b872dd146100a8578063313ce567146100a357806370a082311461009e5780637e497d801461009957806395d89b4114610094578063a9059cbb1461008f5763dd62ed3e1461008a575f80fd5b61088f565b610840565b610715565b6106bd575b61065b575b610622575b6104fb575b6104c0575b61037a575b3461026657807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102665760035460018082169180821c9184841561025c575b602092838510861461022f576101128560805260a090575b959081156101d3575060011461015f575b61014e7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808701610920575b6040518061015b81610269575b0390f575b60035f529394507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8385106101c257505050910190507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8061014e838080610123575b805486860152938201938101610188575b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016865250505050151560051b0190507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8061014e838080610123575b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526022600452fd5b92607f16926100fa575b80fd5b906020918281526080519283818301525f5b8481106102b95750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f845f6040809697860101520116010190575b60a081015183820160400152810161027b575b6020808252825181830181905293925f5b85811061031c575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f845f6040809697860101520116010190575b8181018301518482016040015282016102dd575b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361035357575b5f80fd5b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361035357575b346103535760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610353576103b1610330575b60243533156104905773ffffffffffffffffffffffffffffffffffffffff82169182156104605761042882916104053373ffffffffffffffffffffffffffffffffffffffff165f52600160205260405f2090575b9073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090575b556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f575b60246040517f94280d620000000000000000000000000000000000000000000000000000000081525f6004820152fd5b60246040517fe602df050000000000000000000000000000000000000000000000000000000081525f6004820152fd5b34610353575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610353576020600254604051908152f575b346103535760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261035357610532610330575b61053a610357575b6044359073ffffffffffffffffffffffffffffffffffffffff83165f5260016020526105873360405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090575b54927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84036105c7575b6105bb93506109d0575b60405160018152602090f575b8284106105e3576105de836105bb95033383610b71575b6105b1575b6040517ffb8f41b20000000000000000000000000000000000000000000000000000000081523360048201526024810185905260448101849052606490fd5b34610353575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261035357602060405160128152f575b346103535760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103535773ffffffffffffffffffffffffffffffffffffffff6106a7610330575b165f525f602052602060405f2054604051908152f575b34610353575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261035357602080517f68656c6c6f20776f726c640000000000000000000000000000000000000000008152a0005b34610353575f807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102665760405190806004549060019180831c92808216928315610836575b602092838610851461022f5785885260208801949081156107f7575060011461079f575b61015b876107938189038261098f575b604051918291826102cc575b60045f5294509192917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b8386106107e657505050910190506107938261015b5f80610783575b8054858701529482019481016107ca575b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685525050505090151560051b0190506107938261015b5f80610783575b93607f169361075f575b346103535760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103535761088461087a610330575b60243590336109d0575b602060405160018152f575b346103535760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103535760206109176108cb610330575b73ffffffffffffffffffffffffffffffffffffffff6108e8610357575b91165f526001835260405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090575b54604051908152f575b601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09101166080016080811067ffffffffffffffff82111761096257604052575b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761096257604052575b9173ffffffffffffffffffffffffffffffffffffffff91828416928315610b41578116938415610b1157610a218173ffffffffffffffffffffffffffffffffffffffff165f525f60205260405f2090575b54838110610abc57610ab7928492610a7d7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef96610aa194039173ffffffffffffffffffffffffffffffffffffffff165f525f60205260405f2090575b5573ffffffffffffffffffffffffffffffffffffffff165f525f60205260405f2090575b8054820190556040519081529081906020820190575b0390a3575b6040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff929092166004830152602482015260448101839052606490fd5b60246040517fec442f050000000000000000000000000000000000000000000000000000000081525f6004820152fd5b60246040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081525f6004820152fd5b9073ffffffffffffffffffffffffffffffffffffffff808316156104905781161561046057610405610bc19273ffffffffffffffffffffffffffffffffffffffff165f52600160205260405f2090575b5556",integration_tests/test_basic.py (1)
91-91
: Remove unused function argumentThe static analysis correctly identifies that the
mantra
argument is not used in the function body. Consider removing it if not required for test fixture compatibility.-def test_events(mantra, connect_mantra, exp_gas_used=806200): +def test_events(connect_mantra, exp_gas_used=806200):However, if this parameter is required for consistency with other test signatures or fixture injection, you may keep it and suppress the warning with
# noqa: ARG001
.integration_tests/contracts/contracts/MyToken.sol (2)
15-22
: Potential ownership mismatch in initialize functionThe
initialize
function sets the owner toinitialOwner
but mints tokens tomsg.sender
. This could lead to a situation where the owner and the initial token holder are different entities, which might not be the intended behavior.Consider aligning the token minting with ownership:
function initialize(address initialOwner) initializer public { __ERC20_init("MyToken", "MTK"); __Ownable_init(initialOwner); __ERC20Permit_init("MyToken"); __UUPSUpgradeable_init(); - _mint(msg.sender, 1000000 * 10 ** decimals()); + _mint(initialOwner, 1000000 * 10 ** decimals()); }Or if the current behavior is intentional, consider adding a comment to clarify the design decision.
28-32
: Empty _authorizeUpgrade implementationThe
_authorizeUpgrade
function is correctly restricted withonlyOwner
modifier but has an empty implementation. While this is sufficient for basic upgrade authorization, consider documenting this design choice.Add a comment to clarify the intentionally empty implementation:
function _authorizeUpgrade(address newImplementation) internal onlyOwner override -{} +{ + // No additional checks required - ownership validation is sufficient +}integration_tests/test_contract.py (1)
388-388
: Remove unusednoqa
directiveThe static analysis correctly identifies an unused
noqa
directive for E501 (line too long). The line is actually 141 characters, which may exceed your line length limit.Either remove the
noqa
directive if E501 is not enforced, or break the line:- dir="openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/ERC1967", # noqa: E501 + dir="openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/" + "contracts/proxy/ERC1967",
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base
setting
📒 Files selected for processing (14)
.gitmodules
(1 hunks)integration_tests/contracts/contracts/CounterWithCallbacks.sol
(1 hunks)integration_tests/contracts/contracts/ERC20MinterBurnerDecimals.sol
(3 hunks)integration_tests/contracts/contracts/MyToken.sol
(1 hunks)integration_tests/contracts/contracts/MyToken2.sol
(1 hunks)integration_tests/contracts/contracts/TestERC20A.sol
(1 hunks)integration_tests/contracts/openzeppelin
(0 hunks)integration_tests/contracts/openzeppelin-contracts-upgradeable
(1 hunks)integration_tests/contracts/remappings.txt
(1 hunks)integration_tests/expected_constants.py
(1 hunks)integration_tests/test_basic.py
(1 hunks)integration_tests/test_contract.py
(3 hunks)integration_tests/test_pruned_node.py
(1 hunks)integration_tests/utils.py
(3 hunks)
💤 Files with no reviewable changes (1)
- integration_tests/contracts/openzeppelin
🧰 Additional context used
🪛 Ruff (0.12.2)
integration_tests/test_basic.py
91-91: Unused function argument: mantra
(ARG001)
integration_tests/test_contract.py
388-388: Unused noqa
directive (non-enabled: E501
)
Remove unused noqa
directive
(RUF100)
integration_tests/expected_constants.py
22-22: Unused noqa
directive (non-enabled: E501
)
Remove unused noqa
directive
(RUF100)
23-23: Unused noqa
directive (non-enabled: E501
)
Remove unused noqa
directive
(RUF100)
⏰ 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). (4)
- GitHub Check: integration_tests (unmarked)
- GitHub Check: integration_tests (all)
- GitHub Check: integration_tests (asyncio)
- GitHub Check: integration_tests (slow)
🔇 Additional comments (12)
integration_tests/contracts/contracts/CounterWithCallbacks.sol (1)
5-6
: No change required — imports resolve via remappingsremappings.txt maps @openzeppelin/contracts/ → openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/, so the imports in CounterWithCallbacks.sol (ECDSA.sol and IERC20.sol) resolve to the non-upgradeable files bundled in the upgradeable package. If you intended to use upgradeable variants, switch to ECDSAUpgradeable/IERC20Upgradeable from @openzeppelin/contracts-upgradeable or update remappings.
Likely an incorrect or invalid review comment.
integration_tests/contracts/contracts/TestERC20A.sol (1)
3-3
: Import path alignment confirmed.The updated import path
@openzeppelin/contracts/token/ERC20/ERC20.sol
correctly aligns with the remappings configuration that now points to the upgradeable library structure.integration_tests/contracts/contracts/ERC20MinterBurnerDecimals.sol (3)
6-10
: Import paths correctly updated.The import statements have been properly updated to use the
@openzeppelin/
prefix, which aligns with the new remappings configuration.
40-44
: Role grants updated to use _grantRole method.The migration from
_setupRole
to_grantRole
is correct and aligns with newer OpenZeppelin AccessControl patterns. All four roles (DEFAULT_ADMIN_ROLE, MINTER_ROLE, PAUSER_ROLE, BURNER_ROLE) are properly granted to the deployer.
118-124
: Hook migration appears correct — upstream verification missingintegration_tests/contracts/contracts/ERC20MinterBurnerDecimals.sol (118–124) overrides _update and includes ERC20 and ERC20Pausable; repository lacks the OpenZeppelin ERC20 sources (integration_tests/contracts/openzeppelin-contracts-upgradeable/... not found), so confirm the project uses OpenZeppelin v5 or provide the dependency sources to validate the _update hook.
integration_tests/utils.py (2)
369-406
: Build configuration properly updated for upgradeable contracts.The
build_contract
function correctly:
- Accepts a new
dir
parameter (defaulting to "contracts") for flexible directory selection- Updates the Solidity input path to use the parameterized directory
- Reads and applies remappings from
contracts/remappings.txt
- Sets the base path to
./contracts
for proper import resolutionThese changes properly support the new upgradeable contract structure.
409-427
: Async build and deploy function properly updated.The
build_and_deploy_contract_async
function correctly propagates the newdir
parameter tobuild_contract
, maintaining consistency with the synchronous version.integration_tests/test_pruned_node.py (1)
50-50
: Updated gas usage expectation aligns with upgradeable contract changesThe reduction in gas usage from 51437 to 51289 is consistent with the other gas-related adjustments across the PR, likely due to the switch to OpenZeppelin upgradeable contracts.
integration_tests/expected_constants.py (1)
20-22
: Gas and input data updates reflect upgradeable contract deploymentThe changes to
gas
andgasUsed
values (from 0xe0893 to 0xc4d38) along with the modified input data are consistent with the deployment of upgradeable contracts, which typically have different initialization patterns and gas requirements.integration_tests/contracts/contracts/MyToken2.sol (1)
1-10
: LGTM! Clean upgrade implementationThe contract correctly extends
MyToken
and adds thenewFeature
function, providing a clear way to verify successful upgrades in tests. The stateless implementation is appropriate for testing purposes.integration_tests/test_contract.py (2)
375-398
: Comprehensive ERC1967 proxy upgrade test implementationThe test effectively validates the upgrade process by deploying MyToken, wrapping it in an ERC1967Proxy, upgrading to MyToken2, and verifying the new functionality. This addresses the PR objective of testing ERC1967 proxy upgrades.
379-389
: Confirm ERC1967Proxy path & submodule presenceThe test passes dir="openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/ERC1967" but the openzeppelin-contracts-upgradeable submodule under integration_tests/contracts is not populated in this checkout; remappings point to the same path — ensure the submodule is initialized/updated in CI or change the dir/remapping to a path that exists in the repo.
- Action locations: integration_tests/test_contract.py (test_upgrade), .gitmodules, integration_tests/contracts/remappings.txt, integration_tests/contracts/openzeppelin-contracts-upgradeable
[submodule "integration_tests/contracts/openzeppelin-contracts-upgradeable"] | ||
path = integration_tests/contracts/openzeppelin-contracts-upgradeable | ||
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable.git |
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.
🧩 Analysis chain
Submodule migration to OpenZeppelin Contracts Upgradeable completed.
The .gitmodules
file correctly defines the new upgradeable OpenZeppelin submodule. This change is essential for implementing the ERC1967 proxy pattern testing mentioned in the PR objectives.
🏁 Script executed:
#!/bin/bash
# Verify the submodule configuration and initialization
echo "Checking submodule configuration..."
# Check if the old non-upgradeable submodule has been removed
if [ -d "integration_tests/contracts/openzeppelin" ]; then
echo "⚠️ Warning: Old openzeppelin directory still exists"
ls -la integration_tests/contracts/openzeppelin/
else
echo "✓ Old openzeppelin directory has been removed"
fi
# Verify the new submodule is properly configured
echo -e "\nVerifying upgradeable submodule..."
git submodule status | grep openzeppelin-contracts-upgradeable
# Check the remote URL
echo -e "\nVerifying submodule remote URL..."
cd integration_tests/contracts/openzeppelin-contracts-upgradeable 2>/dev/null && git remote get-url origin || echo "Submodule not initialized"
Length of output: 309
Submodule remote misconfigured — origin points to MANTRA-Chain repo, not OpenZeppelin
.gitmodules lists OpenZeppelin, but the initialized submodule integration_tests/contracts/openzeppelin-contracts-upgradeable has origin https://github.com/MANTRA-Chain/mantrachain-e2e.git (verified). Update the submodule to the correct OpenZeppelin URL and re-sync/init.
Suggested fix:
git submodule sync -- integration_tests/contracts/openzeppelin-contracts-upgradeable
git -C integration_tests/contracts/openzeppelin-contracts-upgradeable remote set-url origin https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable.git
git submodule update --init --force integration_tests/contracts/openzeppelin-contracts-upgradeable
🤖 Prompt for AI Agents
.gitmodules lines 1-3: the submodule URL is declared as OpenZeppelin but the
initialized submodule's origin is pointing to the MANTRA-Chain repo; update the
submodule URL in .gitmodules to the correct
https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable.git, then
re-sync the submodule configuration, set the submodule's origin remote to the
OpenZeppelin URL, and re-init/update the submodule to force fetching the correct
repository so the checked-out submodule matches .gitmodules.
@@ -0,0 +1 @@ | |||
Subproject commit 625fb3c2b2696f1747ba2e72d1e1113066e6c177 |
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.
🧩 Analysis chain
Submodule pointer change looks fine; verify CI submodule init and remappings to avoid breakage
This is a metadata-only update. Ensure the SHA exists upstream, CI initializes submodules, and remappings don’t leave stale imports to the old OpenZeppelin path.
Run this script to verify:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "1) Confirm .gitmodules entry points to the upgradeable repo and path"
if [[ -f .gitmodules ]]; then
echo "--- .gitmodules ---"
cat .gitmodules
echo "--- Expected entries ---"
rg -n -C2 -P '(?i)path\s*=\s*integration_tests/contracts/openzeppelin-contracts-upgradeable|url\s*=\s*https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable\.git' .gitmodules || {
echo "Missing expected .gitmodules path/url for upgradeable submodule"; exit 1;
}
else
echo ".gitmodules not found"; exit 1
fi
echo
echo "2) Verify the submodule commit exists upstream"
gh api -H "Accept: application/vnd.github+json" \
/repos/OpenZeppelin/openzeppelin-contracts-upgradeable/commits/625fb3c2b2696f1747ba2e72d1e1113066e6c177 \
-q '.sha' | sed -n '1p' || { echo "Commit not found upstream"; exit 1; }
echo
echo "3) Check CI workflows for submodule initialization"
fd -t f ".github/workflows" -e yml -e yaml -0 2>/dev/null | xargs -0 -r rg -n -C2 -P '(submodules:\s*(true|recursive)|git submodule update --init --recursive|actions/checkout@v[0-9].*\n.*submodules:\s*true)' || {
echo "No explicit submodule init found in workflows. Ensure actions/checkout uses submodules: true or run git submodule update --init --recursive."; :
}
echo
echo "4) Validate remappings are updated"
if [[ -f integration_tests/remappings.txt ]]; then
echo "--- integration_tests/remappings.txt ---"
cat integration_tests/remappings.txt
echo "--- Expect upgradeable remappings ---"
rg -n -F '@openzeppelin/contracts/=openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/' integration_tests/remappings.txt || echo "Expected @openzeppelin/contracts remap not found"
rg -n -F '@openzeppelin-contracts-upgradeable/contracts/=openzeppelin-contracts-upgradeable/contracts/' integration_tests/remappings.txt || echo "Expected @openzeppelin-contracts-upgradeable remap not found"
else
echo "integration_tests/remappings.txt not found"; :
fi
echo
echo "5) Detect stale imports to the old OZ path and mixed import usage"
rg -n -C1 -F 'integration_tests/contracts/openzeppelin' integration_tests || true
rg -n -C1 -P '@openzeppelin/contracts/(?!.*upgradeable)' --type=sol integration_tests || true
rg -n -C1 -F '@openzeppelin/contracts-upgradeable' --type=sol integration_tests || true
Length of output: 1111
Submodule pointer change OK — CI needs submodule init and remappings are missing
- .gitmodules contains integration_tests/contracts/openzeppelin-contracts-upgradeable and upstream commit 625fb3c2b2696f1747ba2e72d1e1113066e6c177 exists.
- .github/workflows: no explicit submodule init detected — add actions/checkout with submodules: true or run git submodule update --init --recursive in CI.
- integration_tests/remappings.txt not found — add/update remappings so imports point to openzeppelin-contracts-upgradeable (avoid stale @OpenZeppelin import paths).
🤖 Prompt for AI Agents
In integration_tests/contracts/openzeppelin-contracts-upgradeable around lines
1-1, CI and import remappings are missing for the added submodule: update your
GitHub Actions workflow to initialize submodules (use actions/checkout with
submodules: true or run git submodule update --init --recursive before build)
and add or update integration_tests/remappings.txt so Solidity imports resolve
to the new openzeppelin-contracts-upgradeable path (map any stale @openzeppelin
imports to the submodule location).
@openzeppelin/contracts/=openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/ | ||
@openzeppelin-contracts-upgradeable/contracts/=openzeppelin-contracts-upgradeable/contracts/ |
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.
🧩 Analysis chain
Verify the remapping paths exist and are correctly structured.
The remappings now point to the upgradeable OpenZeppelin contracts. The first mapping resolves standard imports through the upgradeable library's dependency, while the second provides direct access to upgradeable contracts.
🏁 Script executed:
#!/bin/bash
# Verify that the remapping paths exist in the repository
echo "Checking if the OpenZeppelin upgradeable submodule path exists..."
if [ -d "integration_tests/contracts/openzeppelin-contracts-upgradeable" ]; then
echo "✓ Upgradeable submodule directory exists"
# Check for the expected subdirectories
echo "Checking for expected subdirectories..."
if [ -d "integration_tests/contracts/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts" ]; then
echo "✓ Standard contracts path exists"
else
echo "✗ Standard contracts path not found"
fi
if [ -d "integration_tests/contracts/openzeppelin-contracts-upgradeable/contracts" ]; then
echo "✓ Upgradeable contracts path exists"
else
echo "✗ Upgradeable contracts path not found"
fi
else
echo "✗ Upgradeable submodule directory not found"
fi
# Verify the submodule is properly initialized
echo -e "\nChecking submodule status..."
git submodule status integration_tests/contracts/openzeppelin-contracts-upgradeable
Length of output: 356
Remappings point to missing/uninitialized OpenZeppelin upgradeable submodule — fix required
integration_tests/contracts/openzeppelin-contracts-upgradeable exists but does not contain lib/openzeppelin-contracts/contracts/ or contracts/; git submodule status shows "-" (not initialized, commit 625fb3c...). Remappings in integration_tests/contracts/remappings.txt (lines 1-2) therefore point to non-existent paths.
- Initialize/update the submodule so the expected paths are present:
git submodule update --init --recursive integration_tests/contracts/openzeppelin-contracts-upgradeable - Or update integration_tests/contracts/remappings.txt (lines 1-2) to point to correct, existing paths.
🤖 Prompt for AI Agents
In integration_tests/contracts/remappings.txt around lines 1 to 2, the
remappings reference paths inside the openzeppelin-contracts-upgradeable
submodule that are missing because the submodule is not initialized; either
initialize/update the submodule with git submodule update --init --recursive
integration_tests/contracts/openzeppelin-contracts-upgradeable so the
lib/openzeppelin-contracts/contracts/ and contracts/ directories exist, or edit
integration_tests/contracts/remappings.txt lines 1-2 to point to the correct
existing paths within your repository (ensure the updated paths are valid and
committed).
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 (3)
integration_tests/test_contract.py (3)
377-377
: Remove unused noqa (RUF100).Ruff reports this
# noqa: E501
as unused. Simply drop it.Apply this diff:
- dir="openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/ERC1967", # noqa: E501 + dir="openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/ERC1967",
381-384
: Renamehash
to avoid shadowing built-in.Use
tx_hash
for clarity and to avoid maskinghash()
.Apply this diff:
- hash = await proxy.functions.upgradeToAndCall(token2.address, b"").transact( + tx_hash = await proxy.functions.upgradeToAndCall(token2.address, b"").transact( {"from": owner} ) - assert (await w3.eth.wait_for_transaction_receipt(hash)).status == 1 + assert (await w3.eth.wait_for_transaction_receipt(tx_hash)).status == 1
380-386
: Optional: avoid reusingproxy
for different ABIs.Consider
proxy_v1
andproxy_v2
for readability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base
setting
📒 Files selected for processing (1)
integration_tests/test_contract.py
(3 hunks)
🧰 Additional context used
🪛 Ruff (0.12.2)
integration_tests/test_contract.py
377-377: Unused noqa
directive (non-enabled: E501
)
Remove unused noqa
directive
(RUF100)
⏰ 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). (4)
- GitHub Check: integration_tests (all)
- GitHub Check: integration_tests (asyncio)
- GitHub Check: integration_tests (unmarked)
- GitHub Check: integration_tests (slow)
🔇 Additional comments (3)
integration_tests/test_contract.py (3)
48-48
: Good addition of async deploy helper import.This aligns with the new upgrade test flow.
364-386
: Solid ERC1967 UUPS upgrade test.Nice end-to-end: deploy impl → proxy with initialize → upgradeToAndCall → ABI rebind → assert new behavior.
36-36
: Avoid importing private Web3 internals (web3._utils.contracts)web3._utils.contracts is internal and can break across Web3 releases — use the public API or pin Web3 in your dependencies.
Location: integration_tests/test_contract.py:36
Use public API to build calldata, e.g.:
data = w3.eth.contract(abi=token.abi).functions.initialize(owner).build_transaction({"from": owner})["data"]
Pass that data instead of using encode_transaction_data.I couldn't find requirements/pyproject/poetry.lock in the repo to confirm a Web3 pin — verify the dependency pin if you intend to rely on internals.
Closes #81
Summary by CodeRabbit