Skip to content
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

Zellic remediation #66

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft

Zellic remediation #66

wants to merge 8 commits into from

Conversation

snissn
Copy link
Collaborator

@snissn snissn commented Jan 13, 2025

wip

….sol

Switched back to using deserializeBigInt for balance, locked, storage_price_per_epoch,
provider_collateral, and client_collateral fields to fix deserialization issues
and pass all tests.
- Replaced uint256 with uint64 for consistent buffer allocation in capacity calculation and initialization.
- Added safety check to prevent array length overflow beyond uint64 limits.
- Ensured proper serialization of new_control_addresses without potential truncation.

Addresses buffer allocation type mismatch warning.
- Replaced all `assert` statements with `if` checks followed by `revert` and custom errors from `Errors.sol`
- Implemented specific custom errors:
  - `InvalidArrayLength(uint256 expected, uint256 actual)`
  - `InvalidBooleanType()`
  - `ExpectedMajorByteString()`
  - `ExpectedNegativeBigNumTag()`
  - `ExpectedLowValue27()`
- Ensured proper import of `Errors.sol` across relevant CBOR modules
- Preserved original indentation and code formatting for readability
- Improves error handling consistency and prevents `Panic` exceptions

This change aligns with Solidity best practices by using custom errors for more efficient and descriptive error handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant