Collapse the triplicated DisputeResolution, raise_dispute, and resolve_dispute definitions#666
Merged
Merged
Conversation
…resolve_dispute definitions (Talenttrust#655) - Remove duplicate `mod amount_validation` declaration in lib.rs - Remove duplicate `safe_add_amounts` function definition in lib.rs - Remove duplicate re-exports (`DisputeResolution` from both `dispute` and `types`) - Remove duplicate `EscrowError` contracterror enum (replaced by `pub type EscrowError = Error`) - Remove duplicate `#[contractimpl] impl Escrow` block from dispute.rs (raise_dispute and resolve_dispute now defined exactly once, in lib.rs) - Remove duplicate `DataKey` enum from types.rs (second definition was identical) - Remove duplicate `Error` enum from types.rs; merge missing `EscrowCapExceeded = 51` into the canonical first definition (avoids discriminant collision with AlreadyCancelled = 50) - Add `DisputeResolution::code()` method to types.rs (used in resolve_dispute event) - Rewrite test/dispute.rs with focused, self-contained tests covering all four resolution variants, raise/resolve security gates, and the conservation invariant Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
appreciate this — thanks for picking it up 🙌 |
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.
Closes #655
Summary
mod amount_validationdeclaration and duplicatesafe_add_amountsfunction fromlib.rsDisputeResolutionre-export (was exported from bothdisputeandtypes; now only fromtypes)EscrowErrorcontracterror enum inlib.rs; replaced bypub type EscrowError = Erroraliasing the canonicalErrorfromtypes.rs#[contractimpl] impl Escrowblock fromdispute.rs:raise_disputeandresolve_disputeare now defined exactly once, inlib.rsDataKeyenum fromtypes.rs(second definition was byte-for-byte identical)Errorenum fromtypes.rs; merge missingEscrowCapExceededinto canonical first definition with a non-colliding discriminant (51instead of50which is taken byAlreadyCancelled)DisputeResolution::code()method on the canonical type intypes.rs(used by theresolve_disputeevent payload)test/dispute.rswith focused, self-contained tests covering all four resolution variants (FullRefund,FullPayout,PartialRefund,Split), security gates (non-party caller, no arbiter, non-disputed state, double resolve), and the conservation invariantSecurity notes
All security invariants are preserved on the single code path:
Disputedcontractsreleased_amount + refunded_amount == funded_amountis asserted after every resolution🤖 Generated with Claude Code