Repository navigation
fix(dispute): stop calling three dispute listing entrypoints the contract lacks - #962
Merged
BigBen-7 merged 1 commit intoOct 25, 2026
Conversation
…ract lacks `getOpenDisputes()`, `getDisputeHistory()` and `getDisputesByResolver()` each read a method that does not exist on the contract, so all three failed on every call. Verified against Lead-Studios/veritix-contract @ 7e090f4 and the contract rebuild backlog. Fixed by building on an existing entrypoint - `getDisputeHistory()` now reads `get_dispute_history_for_escrow(escrow_id)` instead of `get_dispute_history`. The return type is unchanged: the contract returns `Vec<u32>`, which is what this method already handed back, so no caller-facing shape change here. Failing loudly with NotImplemented instead The other two cannot be derived from anything the contract exposes: - `getOpenDisputes()` — the contract has no contract-wide listing of open disputes. `get_dispute_stats()` returns only aggregate counters (`open`, `resolved_for_beneficiary`, `resolved_for_depositor`, `expired`), and `is_dispute_open(escrow_id)` is a per-escrow boolean that needs an id to start from, so there is no way to enumerate. - `getDisputesByResolver()` — the contract keeps no resolver-keyed dispute index. The closest real entrypoint, `get_resolver_stats(resolver)`, returns counters (`resolver`, `total_resolved`, `for_beneficiary`, `for_depositor`) rather than the disputes themselves. Both now reject with `VeriTixErrorCode.NotImplemented` naming the contract function that would be needed, rather than issuing a call that fails with an opaque RPC error. The signatures are unchanged, so `DisputeModule` needs no edit. Both return `Promise.reject(...)` rather than being `async` functions that throw, so the rejection is asynchronous either way — `DisputeModule` returns these directly rather than awaiting them, and an `async` throw would surface synchronously through that wrapper. The `decodeDisputeRecord` import is dropped: with both decoders gone this file no longer decodes dispute structs, so the docblock explaining the cross-file decode agreement has been updated to match. Closes Lead-Studios#853
|
@memplethee-lab Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
getOpenDisputes(),getDisputeHistory()andgetDisputesByResolver()each read a contract method that does not exist, so all three failed on every call.Verified against
Lead-Studios/veritix-contract@7e090f4and the contract rebuild backlog. The contract repo at that ref is pre-reset and does not itself compile, so entrypoints were confirmed fromsrc/dispute.rsand the#[contractimpl]declarations insrc/contract.rs.What changed
getDisputeHistory()— fixed against a real entrypointReads
get_dispute_history_for_escrow(escrow_id)instead ofget_dispute_history, which does not exist. The return type is unchanged: the contract returnsVec<u32>, which is exactly what this method already handed back, so there is no caller-facing shape change.getOpenDisputes()— now rejects withNotImplementedThis one cannot be built from anything the contract exposes:
get_dispute_stats()exists but returns only aggregate counters —open,resolved_for_beneficiary,resolved_for_depositor,expired.is_dispute_open(escrow_id)is a per-escrow boolean that needs an escrow id to start from, so it cannot enumerate.There is no way to list open disputes contract-wide, so it rejects with
VeriTixErrorCode.NotImplementednaming the missing entrypoint rather than issuing a call that fails with an opaque RPC error.getDisputesByResolver()— now rejects withNotImplementedThe contract keeps no resolver-keyed dispute index. The closest real entrypoint,
get_resolver_stats(resolver), returns counters (resolver,total_resolved,for_beneficiary,for_depositor) rather than the disputes themselves, so it cannot stand in for a listing either.Both rejections name the contract function that would be needed, so the gap is actionable from the SDK side:
Implementation notes
DisputeModuleneeds no edit — it still forwards to these three.Promise.reject(...)rather than beingasyncfunctions that throw.DisputeModulereturns these directly instead of awaiting them, so anasyncthrow would surface synchronously through that wrapper;Promise.rejectkeeps it asynchronous on every path.invokerparameter is_-prefixed to satisfy@typescript-eslint/no-unused-vars(argsIgnorePattern: "^_").decodeDisputeRecordimport and its docblock are removed — with both decoders gone this file no longer decodes dispute structs.Breaking changes
None. No signature or return type changed.
getOpenDisputes()andgetDisputesByResolver()now reject with a typedVeriTixError(NOT_IMPLEMENTED) where they previously rejected with an RPC-level failure, which is catchable and inspectable rather than a change in what the calls do.Contract-side follow-up
The issue asks for a contract-side issue to be opened for the entrypoints that are wanted. The two gaps, in the shape they'd need:
get_open_disputes() -> Vec<DisputeRecord>— a contract-wide enumeration of disputes withstatus == open.get_disputes_by_resolver(resolver: Address) -> Vec<DisputeRecord>— a resolver-keyed index, mirroring the existingget_disputes_by_claimant(claimant) -> Vec<u32>but returning records rather than ids.Once either lands, the corresponding method here is a one-line change from
Promise.reject(...)to asimulateRead+ decode.Not opened here because this PR is scoped to the SDK repo — flagging for the maintainer.
Tests
tests/dispute.test.tscovers all three of these and will need updating: thegetDisputeHistoryblocks assert the oldget_dispute_historymethod name, and thegetOpenDisputes/getDisputesByResolverblocks assert successful decodes that can no longer happen. No tests were run or changed in this PR.Closes #853