-
Notifications
You must be signed in to change notification settings - Fork 5
xiaoming90 - Hardcode Chain ID #73
Comments
This was commented on in Discord, the Deployments.sol file contains various chain id specific deployment constants. The hardcoding is used to check that the correct Deployments library is used per chain. |
Hi @jeffywu in the contest READ.ME, it is said that the contracts will be supported on Arbitrum, mainnet and optimism, so I think it is fair that watsons bring this up as an issue, unless I am missing something since I don't see |
Sounds good, your call. |
@nevillehuang Technically i don't think that this contract will fail to deploy on Mainnet or Optimism because of the condition in the require statement because it is always true - Deployments.CHAIN_ID = Constants.CHAIN_ID_ARBITRUM = 42161 = chainId . Deployments.sol
Constants.sol
|
Escalate
I did not receive a response or additional information regarding my previous comment. I am escalating the report for reconsideration. In the current codebase, the statement made in the report in its current form is not true. |
You've created a valid escalation! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
This is debatable, because based on this line of code here, the As per the comment of sponsor, the hardcoding is used to check that the correct Deployments library is used per chain, so if you maintain as a hardcoded arbitrum chain Id to avoid deployment failure when on mainnet, it defeats the purpose of this check. |
@nevillehuang Regarding the sponsor's comment, it's difficult for me to make conclusions about intentions from one sentence. Is it possible for this hardcoded value to be a kind of precautionary measure related to their specific deployment process? Let's not forget that the sponsor challenges the validity of this report. Let's set aside the above arguments for a moment and assume that this is a valid bug. What is the impact in this case? This is a quote from Sherlock's issue validity criteria.
In my opinion, the described issue does not fall into any of the categories; therefore, it may be at most Low/Informational. |
Fair point, I agree with you this should be a low/info issue based on sherlock rules. |
That was my first thought, but I needed to also check duplicates, because they may have presented a more severe impact. Anyway, none of the duplicate reports present any loss of funds scenario. Opportunity loss (no protocol revenue) is not a loss of funds, hence I don't think this is a valid finding. Secondarily, I think it is also clear that the sponsor intended to change the code for every deployment. We will work to have this communicated in the future. Planning to accept the escalation and make this issue and duplicates invalid. |
Result: |
Escalations have been resolved successfully! Escalation status:
|
xiaoming90
medium
Hardcode Chain ID
Summary
Leverage vault will not be able to deploy on Ethereum and Optimism due to hardcoded Chain ID.
Vulnerability Detail
Per the contest's README, the contracts are intended to be deployed on Optimism sidechain and Ethereum Mainnet If a contract or protocol cannot be deployed on any of the mentioned chains in the README, it will be considered a valid issue in the context of this audit.
https://github.com/sherlock-audit/2023-10-notional-xiaoming9090#q-on-what-chains-are-the-smart-contracts-going-to-be-deployed
However, with the current implementation based on the in-scope codebase, the contracts will not be able to deploy due to the hardcoded chain ID of 42161 (Arbitrum) at Line 59. As a result, the deployment of existing in-scope contracts will revert and fail.
https://github.com/sherlock-audit/2023-10-notional/blob/main/leveraged-vaults/contracts/vaults/common/BaseStrategyVault.sol#L59
Impact
Leverage Vault will not be able to deploy on Ethereum and Optimism. In addition, if the affected vaults cannot be used, it leads to a loss of revenue for the protocol.
Code Snippet
https://github.com/sherlock-audit/2023-10-notional/blob/main/leveraged-vaults/contracts/vaults/common/BaseStrategyVault.sol#L59
Tool used
Manual Review
Recommendation
Update the codebase to work with Optimism sidechain and Ethereum Mainnet
The text was updated successfully, but these errors were encountered: