Conversation
…_dispute Cap refunds in reclaim_stalled_dispute against tracked AssertionEscrow balance deltas, preventing contract traps or overpaying from pooled balances. Co-authored-by: gloskull <189399494+gloskull@users.noreply.github.com>
Collaborator
|
@gloskull This duplicates #211 (same fix, different branch). Also, #220 has no CI runs at all, which usually means Actions aren't enabled on this fork; the code here still has the unformatted multi-line transfer calls despite the PR description saying cargo fmt passed. Please consolidate into #211, close this one, and rebase. |
Collaborator
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.
Motivation
Ensure payouts never overpay or trap funds when tokens have transfer fees by recording the actual escrowed amounts rather than assuming full transfer success.
Expose the new AssertionEscrow storage type in the generated TypeScript SDK so the SDK drift check and consumers match the compiled contract spec.
Make small formatting tweaks to pass CI formatting checks.
Description
Add a AssertionEscrow contracttype and a new DataKey::AssertionEscrow(u64) storage key and implement get_assertion_escrow / set_assertion_escrow.
Record actual per-side escrow deltas by sampling token_client.balance(...) before/after transfers and store asserter_escrow / disputer_escrow, then use those escrowed amounts for refunds, rewards, and payouts (reclaim_stalled_dispute, finalize, resolve).
Regenerate the TypeScript SDK bindings: embed the updated contract spec entries and add AssertionEscrow to the SDK DataKey union and exported interfaces in packages/tholos-sdk/src/index.ts.
Apply formatting adjustments to token transfer call sites (compact single-line calls) to satisfy cargo fmt.
Testing
Ran cargo fmt --check (passed).
Ran cargo clippy --workspace --all-targets --locked -- -D warnings (passed).
Ran cargo test --workspace --locked (all unit tests passed).
Built the contract cargo build -p tholos --target wasm32v1-none --release --locked and verified the generated tholos.wasm was used to regenerate the SDK spec entries.
Ran pnpm --dir packages/tholos-sdk build and verified the SDK's embedded contract spec matches the compiled WASM (sdk drift check passed).
Closes #207