Repository navigation
feat(stream_contract): give disputes and yield an activation path - #1954
Closed
achiever2110 wants to merge 1 commit into
Closed
achiever2110 wants to merge 1 commit into
achiever2110 wants to merge 1 commit into
Conversation
Every stream constructor hardcoded `arbiter: None` and `yield_enabled: false`, and no entrypoint ever wrote either field, so `request_dispute` and `resolve_dispute` could only ever fail and the yield opt-in was permanently dead. Tests reached into storage to seed the arbiter, which proved the code worked but not that the feature was reachable. - add `set_stream_arbiter` (sender-only) so the dispute flow is reachable through the public API; a dispute freezes the slot, and neither party to the stream may arbitrate it - make `cancel_stream` reject streams with an arbiter configured, so the arbiter actually gates unilateral cancellation - add `set_stream_yield` (sender-only) so the yield opt-in can be turned on and off, with an event indexers can follow - configure the arbiter through the public entrypoint in the dispute tests instead of injecting it into storage
Contributor
Author
|
Closing as a duplicate of #1934, which already implements this issue from the same branch owner and is still open. This branch was a second implementation and would only compete with it. |
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 #1897
What changed
Every stream constructor hardcoded
arbiter: Noneandyield_enabled: false, and no entrypoint ever wrote either field.request_disputeandresolve_disputetherefore always failed withDisputeNotSupportedin production, the yield flag could never be turned on, and the tests could only exercise disputes by injectingarbiterstraight into storage.set_stream_arbiter(sender, stream_id, arbiter: Option<Address>)Sender-authorized, and the only way the arbiter slot is ever written:
arbiter_updatedwith the new value (Noneclears it)cancel_streamnow rejects streams that have an arbiter configured (ArbiterConfigured, code 50), so the arbiter actually gates unilateral cancellation instead of being a decorative field: the sender mustrequest_disputeand the arbiter must approve it.set_stream_yield(sender, stream_id, enabled: bool)Sender-authorized toggle for the per-stream yield opt-in, emitting
yield_preference_updated. It records the preference only and deliberately leaves escrow accounting untouched; theYieldStrategytrait remains the adapter surface for a concrete implementation.Tests
The dispute tests now configure the arbiter through the public entrypoint instead of storage injection, and three new tests cover the whole path end to end:
docs-site/docs/contracts/soroban-reference.mdgains the error-table rows for 49 and 50.Verification
cargo test -p stream_contract: 310 passed, 0 failed, 1 pre-existing ignoredcargo clippy -p stream_contract --all-targets -- -D warnings: cleanNote:
#[contracterror]enums cap out at 50 variants, so the "dispute already open" rejection reportsUnauthorizedwith the documented explanation rather than a 51st variant.