-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add proxy contract #97
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
Summary of ChangesHello @tac0turtle, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Claude finished @tac0turtle's task —— View job Code Review: AdminProxy Contract ImplementationI've completed a thorough review of the AdminProxy contract and associated files. Overall, this is a well-designed and implemented solution for the genesis admin bootstrap problem. Here's my detailed analysis: ✅ Strengths1. Solid Architecture & Problem Solution
2. Security Best Practices
3. Comprehensive Testing
4. Documentation Quality
|
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.
Code Review
This pull request introduces an AdminProxy contract, a utility script for genesis allocation, and a comprehensive test suite. The overall implementation is robust and well-tested. My feedback focuses on improving error clarity and maintainability in the AdminProxy contract and its associated script, and adhering to Solidity best practices.
contracts/src/AdminProxy.sol
Outdated
| /// @notice Claim ownership when owner is zero (genesis bootstrap) | ||
| /// @dev Can only be called once, when owner is address(0) | ||
| function claimOwnership() external { | ||
| if (owner != address(0)) revert NotOwner(); |
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.
The NotOwner error is misleading in this context. The function should fail because ownership has already been claimed, not because the caller isn't the owner. Using a more specific custom error would improve the contract's clarity. For example, you could add error OwnershipAlreadyClaimed(); with the other custom errors and use it here.
if (owner != address(0)) revert OwnershipAlreadyClaimed();
| emit OwnershipTransferred(owner, msg.sender); | ||
| owner = msg.sender; | ||
| pendingOwner = address(0); |
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.
To adhere to the Checks-Effects-Interactions (CEI) pattern, state modifications should occur before external interactions like emitting events. This is a security best practice that helps prevent reentrancy vulnerabilities, even if no direct exploit is apparent here.
address previousOwner = owner;
owner = msg.sender;
pendingOwner = address(0);
emit OwnershipTransferred(previousOwner, owner);
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.
would generally agree
damiannolan
left a 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.
Looks excellent, really nice! Just one thing in the markdown doc that jumps out as inconsistent, otherwise LGTM.
Should we update the example genesis to include the admin proxy alloc and set it as mint admin? https://github.com/evstack/ev-reth/blob/main/etc/ev-reth-genesis.json
I'm fine with it either way I think, but it might be useful.
I think it would be good to link the AdminProxy doc and reference it in both the contracts README.md (https://github.com/evstack/ev-reth/blob/main/contracts/README.md) and also in the precompiles readme where the mint admin is mentioned it could be useful to link it too.
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.
Fairly comprehensive, nice doc!
| _setOwnerViaStorage(alice); | ||
|
|
||
| // Alice initiates transfer to bob | ||
| vm.prank(alice); |
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.
TIL that vm.prank() changes msg.sender in sol tests
docs/contracts/admin_proxy.md
Outdated
| 3. **Check owner is zero** (ready for claiming): | ||
|
|
||
| ```bash | ||
| cast call 0x000000000000000000000000000000000000Ad00 "owner()" --rpc-url <YOUR_RPC> | ||
| # Should return 0x0000000000000000000000000000000000000000 | ||
| ``` |
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.
What is this? Is this a relic from previous iteration, it seems to not align with the implementation
Suggests to me that at some point you were considering a claim mechanism for the admin proxy after genesis if the owner is 0x00
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.
Ah, I see it was removed in 6947233, but this seems to have stuck around
randygrok
left a 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.
looks great! I think executeWithValue does not have error tests, with revert.
Description
Type of Change
Related Issues
Fixes #(issue)
Checklist
Testing
Additional Notes