Category: Coding Mistakes
Unused errors in the SP1Helios contract
Informational Impact
Informational Severity
N/A Likelihood
Description
The SP1Helios contract defines error codes that represent various errors and constraint violations that may occur during operations. However, among them, PrevHeadMismatch, PrevHeaderMismatch, HeaderRootAlreadySet, SyncCommitteeAlreadySet, and StateRootAlreadySet are not used in the current implementation.
error PrevHeadMismatch(uint256 given, uint256 expected);
error PrevHeaderMismatch(bytes32 given, bytes32 expected);
error SlotBehindHead(uint256 slot);
error SyncCommitteeAlreadySet(uint256 period);
error HeaderRootAlreadySet(uint256 slot);
error StateRootAlreadySet(uint256 slot);
error SyncCommitteeStartMismatch(bytes32 given, bytes32 expected);
error SyncCommitteeNotSet(uint256 period);
error NextSyncCommitteeMismatch(bytes32 given, bytes32 expected);
error NonCheckpointSlot(uint256 slot);
error MissingStateRoot(uint256 blockNumber);Impact
If unused error codes remain in the source code, they can reduce code readability and maintainability, potentially causing confusion during future development.
Recommendations
Remove the unused error codes: PrevHeadMismatch, PrevHeaderMismatch, HeaderRootAlreadySet, SyncCommitteeAlreadySet, and StateRootAlreadySet.
Remediation
This issue has been acknowledged by Succinct Labs, and a fix was implemented in commit 477ed4af↗.