Category: Coding Mistakes
Redundant check on prevSyncCommitteeHash
Informational Impact
Informational Severity
N/A Likelihood
Description
In the update function, both currentSyncCommitteeHash and po.prevSyncCommitteeHash are derived from syncCommittees[getSyncCommitteePeriod(head)]. Therefore, the check [D] is redundant in the current implementation.
ProofOutputs memory po = ProofOutputs({
prevHeader: headers[head],
prevHead: head,
prevSyncCommitteeHash: syncCommittees[getSyncCommitteePeriod(head)], // ------------- [A]
[...]
});
[...]
// The sync committee for the current head should always be set.
uint256 currentPeriod = getSyncCommitteePeriod(head); // ------------- [B]
bytes32 currentSyncCommitteeHash = syncCommittees[currentPeriod]; // ------------- [C]
[...]
// The sync committee hash used in the proof should match the current sync committee.
if (currentSyncCommitteeHash != po.prevSyncCommitteeHash) { // ------------- [D]
revert SyncCommitteeStartMismatch(po.prevSyncCommitteeHash, currentSyncCommitteeHash);
}Impact
This redundant check unnecessarily increases gas usage and adds complexity to the code, which may make it harder for users to understand.
Recommendations
Remove the following check from the update function.
if (currentSyncCommitteeHash != po.prevSyncCommitteeHash) {
revert SyncCommitteeStartMismatch(po.prevSyncCommitteeHash, currentSyncCommitteeHash);
}Remediation
This issue has been acknowledged by Succinct Labs, and a fix was implemented in commit 9a91a3be↗.