-
Notifications
You must be signed in to change notification settings - Fork 1
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
Inaccurate Batch Stored Hash Retrieval in Getters Contract #739
Comments
bytes032 marked the issue as sufficient quality report |
QA. |
miladpiri marked the issue as disagree with severity |
miladpiri (sponsor) confirmed |
GalloDaSballo changed the severity to QA (Quality Assurance) |
Agree with QA Refactoring |
@GalloDaSballo Thanks for your judgments. This problem demonstrates a discrepancy with the documentation and an inaccurate implementation. Therefore, I propose categorizing it as having a medium severity level. For better comprehension, let's examine a scenario involving two functions: getTotalBatchesCommitted and storedBatchHash: Case 1:
This aligns with the expected behavior outlined here. Case 2:
This deviates from the expected behavior documented here. The documentation asserts that for an uncommitted batch, Case 3:
This aligns with the anticipated behavior as detailed here, where the stored hash is expected to change for unexecuted batches. This issue can directly impact third parties relying on the state of batches. Furthermore, I contend that the impact of this problem is nearly equivalent to issue #782, which is classified as medium severity. Therefore, it is fair for this issue to be treated similarly. |
After discussing with another judge, I am downgrading this type of "view findings" as QA |
Lines of code
https://github.com/code-423n4/2023-10-zksync/blob/main/code/contracts/ethereum/contracts/zksync/facets/Getters.sol#L90
Vulnerability details
Impact
The
storedBatchHash
function's inability to distinguish between reverted and unreverted batches may mislead users and developers about batch statuses in zkSync.Proof of Concept
You can retrieve the stored batch hash by invoking the
storedBatchHash(uint256 _batchNumber)
function found within theGetters
contract.https://github.com/code-423n4/2023-10-zksync/blob/main/code/contracts/ethereum/contracts/zksync/facets/Getters.sol#L90
It returns zero for uncommitted batch numbers, but it lacks the capability to distinguish between a reverted and an unreverted batch. For example, if batch number 100 has been reverted, and a user queries
storedBatchHash(100)
, it returns a non-zero value, which may create the impression that the batch is unreverted. However, it should ideally return zero in such scenarios.Tools Used
Recommended Mitigation Steps
The function should be revised as:
Assessed type
Context
The text was updated successfully, but these errors were encountered: