Skip to content

feat: add on-chain dispute resolution entrypoint - #827

Open
syed-ghufran-hassan wants to merge 1 commit into
RevoraOrg:masterfrom
syed-ghufran-hassan:feat/dispute-open
Open

feat: add on-chain dispute resolution entrypoint#827
syed-ghufran-hassan wants to merge 1 commit into
RevoraOrg:masterfrom
syed-ghufran-hassan:feat/dispute-open

Conversation

@syed-ghufran-hassan

Copy link
Copy Markdown

Adds open_dispute(holder, issuer, namespace, token, meta_hash) to allow eligible holders to open a formal dispute recorded on-chain.

The dispute ID is deterministically derived as
sha256(issuer || namespace || token || holder || meta_hash) to ensure uniqueness and replay protection. Persistent storage tracks each dispute with its status (Open, Resolved, Rejected) and timestamp.

Spam mitigation caps open disputes per (holder, offering) at MAX_OPEN_DISPUTES_PER_HOLDER (5). The call rejects holders with zero shares and prevents duplicate disputes for the same tuple.

A dispute_open event is emitted containing the dispute ID, offering ID, holder, and metadata hash. A read‑only get_dispute(dispute_id) query is provided for off‑chain indexers.

New types:

  • DisputeStatus (Open, Resolved, Rejected)
  • Dispute (id, holder, offering_id, opened_at, meta_hash, status)

Storage:

  • DataKey2::Dispute(BytesN<32>) – dispute record
  • DataKey2::DisputeCount(OfferingId, Address) – open‑dispute counter

Tests:

  • Success case with share set
  • Zero‑share rejection
  • Duplicate dispute rejection
  • Per‑holder cap enforcement (5 open disputes max)

All tests pass with >95% coverage.

Closes #796

Adds `open_dispute(holder, issuer, namespace, token, meta_hash)` to
allow eligible holders to open a formal dispute recorded on-chain.

The dispute ID is deterministically derived as
`sha256(issuer || namespace || token || holder || meta_hash)` to ensure
uniqueness and replay protection. Persistent storage tracks each
dispute with its status (`Open`, `Resolved`, `Rejected`) and timestamp.

Spam mitigation caps open disputes per (holder, offering) at
`MAX_OPEN_DISPUTES_PER_HOLDER` (5). The call rejects holders with zero
shares and prevents duplicate disputes for the same tuple.

A `dispute_open` event is emitted containing the dispute ID, offering ID,
holder, and metadata hash. A read‑only `get_dispute(dispute_id)` query
is provided for off‑chain indexers.

New types:
- `DisputeStatus` (Open, Resolved, Rejected)
- `Dispute` (id, holder, offering_id, opened_at, meta_hash, status)

Storage:
- `DataKey2::Dispute(BytesN<32>)` – dispute record
- `DataKey2::DisputeCount(OfferingId, Address)` – open‑dispute counter

Tests:
- Success case with share set
- Zero‑share rejection
- Duplicate dispute rejection
- Per‑holder cap enforcement (5 open disputes max)

All tests pass with >95% coverage.

Closes RevoraOrg#796
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add dispute-open entrypoint recording holder complaint with structured event

1 participant