Revert "fix(scout_access): replace expect("overflow") with ScoutAccessError::Overflow" - #3
Closed
gracious01-tech wants to merge 1 commit into
Closed
Revert "fix(scout_access): replace expect("overflow") with ScoutAccessError::Overflow"#3gracious01-tech wants to merge 1 commit into
gracious01-tech wants to merge 1 commit into
Conversation
…sError::Overflow"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Replaced panic-based overflow handling in
log_trial_offerwith a typed contract error.Previously, the contract used
.expect("overflow")onchecked_add, which caused execution to panic instead of returning a predictable contract error.This update now safely returns
ScoutAccessError::Overflowwhen the counter exceeds the maximumu32limit.Related Issue
Closes scout-off#109
Type of Change
Changes Included
.expect("overflow")fromscout_access/src/lib.rsScoutAccessError::OverflowSecurity Impact
Improves contract stability and prevents panic-based execution failures.
No authorization or payment logic changed.
Testing
u32::MAXScoutAccessError::Overflowis returned correctlyManual Testing Steps
TrialCountertou32::MAXlog_trial_offerScoutAccessError::OverflowAcceptance Criteria Coverage
.expect("overflow")remains inscout_access/src/lib.rsu32::MAXBreaking Changes
No breaking changes.
This change only replaces panic behavior with typed error handling.
Checklist
Additional Context
Using typed errors instead of panics improves predictability for integrators and aligns with recommended Soroban smart contract error-handling practices.
Reviewer Notes
Please focus on:
ScoutAccessError::Overflow