fix(ConfidentialETH): use safe staticcall in _cappedDecimals to avoid revert on non-standard WETH#52
Open
amathxbt wants to merge 1 commit intoFhenixProtocol:masterfrom
Conversation
ConfidentialETH._cappedDecimals called IERC20Metadata(token).decimals() directly. If the WETH contract does not implement decimals() or reverts (e.g., non-standard or mis-deployed WETH), the entire ConfidentialETH initialise call reverts with no meaningful error, permanently bricking the proxy since UUPS initializers cannot be retried. ConfidentialERC20._cappedDecimals already uses a safe staticcall with an 18-decimal fallback. Apply the same pattern here for consistency and robustness.
Contributor
|
@amathxbt is attempting to deploy a commit to the Fhenix Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ConfidentialETH._cappedDecimalscallsIERC20Metadata(token).decimals()directly. If the WETH contract does not implementdecimals()or reverts (e.g., a non-standard or incorrectly deployed WETH), the entireConfidentialETH.initializecall reverts with no meaningful error.Inconsistency
The sibling contract
ConfidentialERC20already handles this correctly with a safe staticcall + fallback:Impact
Since
ConfidentialETHis deployed behind a UUPS proxy viainitialize, if initialization reverts the proxy is permanently bricked —_disableInitializers()in the constructor means the implementation cannot be re-initialized, and a new proxy would need to be deployed. Deploying with a non-standard WETH or a network where WETH hasn't been fully set up yet would silently fail in a non-recoverable way.Fix
Apply the same safe staticcall pattern as
ConfidentialERC20._cappedDecimals, falling back to 18 decimals on failure.