Skip to content

feat: add zero-divisor check — division by a parameter or storage value with no zero guard - #388

Merged
luhrhenz merged 2 commits into
Veritas-Vaults-Network:mainfrom
Sundriveauto:main
Jun 18, 2026
Merged

feat: add zero-divisor check — division by a parameter or storage value with no zero guard#388
luhrhenz merged 2 commits into
Veritas-Vaults-Network:mainfrom
Sundriveauto:main

Conversation

@Sundriveauto

Copy link
Copy Markdown
Contributor

Closes #381

Adds robust zero-guard validation prior to execution of division operations where the denominator is sourced dynamically from function parameters or contract storage.

Problem:
Performing division using dynamic values (such as user-supplied arguments or state-dependent storage variables) without a pre-flight zero check introduces a risk of runtime panics, arithmetic overflows, or transaction reversals.

Solution:
Enforce explicit checks to ensure denominators are strictly greater than zero before performing the operation. If a zero value is encountered, the transaction now gracefully fails with a clear, descriptive error code rather than triggering an unhandled panic.

Prevents edge-case runtime panics in arithmetic operations.

Improves error readability for client-side integration and debugging.

@luhrhenz
luhrhenz merged commit 3836bb3 into Veritas-Vaults-Network:main Jun 18, 2026
2 checks passed
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.

feat: add zero-divisor check — division by a parameter or storage value with no zero guard

2 participants