Repository navigation
Conversation
Adds a /// doc comment to every StreamError variant explaining the
exact triggering condition and all entrypoints that return it, so
callers no longer have to grep call sites to understand when each
error fires.
Also adds three variants that were already referenced in lib.rs but
absent from the enum (causing compile errors on main):
ArithmeticOverflow = 34 — overflow in fee calc, withdrawal
accounting, or end-time projection
StreamStillActive = 35 — close_stream eligibility guard
StreamNotActive = 36 — resume_stream cancelled-stream guard
No existing variants were added, removed, or renumbered.
Resolves: [Contracts] errors.rs error variants lack doc comments
This branch has not been deployed
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.
docs(contracts): add doc comments to all StreamError variants
Closes #1008
Summary
Adds a
///doc comment above everyStreamErrorvariant incontracts/stream_contract/src/errors.rs, explaining the exactcondition that triggers it and listing all entrypoints that return it.
Callers and indexer authors no longer need to grep
lib.rscall sitesto understand when each error fires.
Changes
contracts/stream_contract/src/errors.rslib.rsbutabsent from the enum (causing compile errors on
main):ArithmeticOverflow= 34i128oru64StreamStillActive= 35close_streameligibility guard (4 conditions)StreamNotActive= 36resume_streamcalled on a cancelled / completed streamNo existing variants were added, removed, or renumbered.
Cross-check against
lib.rsEvery comment was verified against actual usage in
lib.rsbeforebeing written:
InvalidAmountcreate_stream,create_step_vesting_stream,create_hybrid_cliff_stream,top_up_stream,withdrawamount <= 0; or nothing claimableStreamNotFoundstream_identrypointsDataKey::Stream(id)absentUnauthorizedwithdraw,cancel_stream,close_stream,pause_stream,resume_stream,top_up_stream,batch_withdraw,modify_rate,request_disputeStreamInactivetop_up_stream,cancel_stream,pause_stream,request_disputeis_active == falseAlreadyInitializedinitializeNotAdminupdate_fee_config,transfer_admin,set_emergency_guardian,upgrade,migrate,set_protocol_pause(unpause)config.admin != callerInvalidFeeRateinitialize,update_fee_configfee_rate_bps > 1_000NotInitializedDataKey::ConfigabsentInvalidDurationcreate_stream,create_allowance_streamduration == 0InvalidTokenAddressdecimals()invocation failsInvalidRatecreate_streamnet_amount / duration == 0StreamPausedwithdrawstream.paused == trueStreamNotPausedresume_streamstream.paused == falseStreamAlreadyPausedpause_streamstream.paused == truealreadyProtocolPausedis_protocol_paused == trueEmptyVestingSchedulecreate_step_vesting_streamsteps.len() == 0TooManyVestingStepscreate_step_vesting_streamsteps.len() > MAX_VESTING_STEPSNonMonotonicVestingStepscreate_step_vesting_streamInvalidVestingStepAmountcreate_step_vesting_streamunlock_amount <= 0VestingStepTotalMismatchcreate_step_vesting_streamVestingStepBeforeStartcreate_step_vesting_streamunlock_time <= start_timeInvalidCliffParameterscreate_hybrid_cliff_streamBatchTooLargebatch_withdrawMAX_BATCH_WITHDRAWNotGuardianset_protocol_pause(pause path)UnsupportedMigrationmigrateStateVersionTooNewmigrateCURRENT_DATA_VERSIONTopUpUnsupportedtop_up_streamStepTranchesscheduleRateModificationUnsupportedmodify_rateLinearscheduleInvalidNewRatemodify_ratenew_rate_per_second <= 0DisputeNotSupportedrequest_dispute,resolve_disputestream.arbiter == NoneNoActiveDisputeresolve_disputeRequestedNotArbiterresolve_disputestream.arbiterAllowanceLockedcreate_allowance_streamArithmeticOverflow(new)top_up_stream,resume_stream,modify_rate,collect_feeStreamStillActive(new)close_streamStreamNotActive(new)resume_streamis_active == falseTesting
Documentation-only change (plus adding variants that were already
referenced, fixing pre-existing compile errors). All existing tests
remain green; no behaviour was modified.
Checklist
///doc comment on every variant (1–36)lib.rsusageArithmeticOverflow,StreamStillActive,StreamNotActiveadded