Repository navigation
fix(dispute): validate evidence and reasoning CIDs before sending - #9
Merged
Merged
Conversation
BondEscalation rejects evidence and reasoning references that are not a bare CID. The SDK forwarded both strings unchecked, so a malformed value only failed on-chain, and in UMAHelper.requester_force_dvm only after the USDC approval had already been sent. - validate_cid matches the whole string (re.fullmatch), so a trailing newline is no longer accepted, enforces MAX_CID_LENGTH (256, the contract limit) and returns False for non-string input. Existing callers keep the boolean contract. - Add ensure_valid_cid, which raises InvalidCIDError with the field name (InvalidCIDError gains an optional field argument, reported in details). - BondEscalationClient.submit_ai_ruling and escalate_to_uma validate both CIDs before building or sending the transaction. - UMAHelper.requester_force_dvm validates both CIDs before any read, approve or bond transfer. - Add the shared CID acceptance vectors and a test that runs every accept and reject vector through all three calls for both fields, plus validate_cid directly. - Replace placeholder CIDs on these paths with well-formed ones and take the regenerated dispute golden vectors and UMA self-dispute vectors byte-for-byte from the TypeScript SDK (evidence: the CIDv1 accept vector, reasoning: the CIDv0 accept vector). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Validates
evidenceCIDandreasoningCIDon the dispute escalation path before any transaction is sent. A CID is accepted only if the whole string is a CIDv0 (Qm+ 44 base58btc) or a CIDv1 in base32 (b+ at least 58 of[a-z2-7]), at most 256 characters; anything else raisesInvalidCIDError.Shared acceptance vectors:
test-vectors/dispute/cid-validation-vectors.json(identical in the JavaScript and Python SDKs). The dispute fixtures now use valid CIDs.🤖 Generated with Claude Code