Skip to content

fix(v1): reject resolve call from asserter or disputer (#165) - #170

Closed
s6pa1rta3n-lab wants to merge 1 commit into
drydocs:mainfrom
s6pa1rta3n-lab:fix-issue-165
Closed

fix(v1): reject resolve call from asserter or disputer (#165)#170
s6pa1rta3n-lab wants to merge 1 commit into
drydocs:mainfrom
s6pa1rta3n-lab:fix-issue-165

Conversation

@s6pa1rta3n-lab

Copy link
Copy Markdown

Summary

Fixes #165.

In Tholos v1, resolve checked if the caller was part of the snapshotted resolver committee (assertion.resolvers) and had not voted yet (assertion.voted), but did not verify whether the resolver was also a party to the dispute (assertion.asserter or assertion.disputer). A resolver who was also the asserter or disputer could vote on their own case, introducing an economic conflict of interest and allowing a party to sway the outcome to win both bonds.

Changes:

  • Added Error::ConflictOfInterest = 23 to the Error enum in contracts/tholos/src/lib.rs.
  • Added a guard in Tholos::resolve rejecting calls where resolver == assertion.asserter || assertion.disputer.as_ref() == Some(&resolver) with Error::ConflictOfInterest.
  • Added unit tests in contracts/tholos/src/test.rs covering:
    • Asserter attempting to resolve returns Err(Ok(Error::ConflictOfInterest)) and assertion state is unmodified.
    • Disputer attempting to resolve returns Err(Ok(Error::ConflictOfInterest)) and assertion state is unmodified.
    • Non-conflicted resolvers can still vote and resolve when one committee member is a conflicted party.
  • Updated docs/src/CONTRACT.md specification for resolve and error variants.
  • Updated packages/tholos-sdk/src/index.ts error mappings to include 23: {message:"ConflictOfInterest"}.

Test plan

  • cargo fmt --check, cargo clippy --workspace --all-targets --locked -- -D warnings, and cargo test --workspace --locked pass locally (181 passed tests)
  • CONTRACT.md updated with ConflictOfInterest on resolve
  • TypeScript SDK bindings built and verified in sync with contract wasm

Payout Routing

  • EVM (Base/Arbitrum/Polygon/ETH): 0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89
  • Stellar: GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC

@collinsezedike

Copy link
Copy Markdown
Collaborator

@s6pa1rta3n-lab Closing. #165 has no assignee. Comment on the issue and wait to be assigned before opening a PR.

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.

[Bug] resolve doesn't prevent a resolver from voting on their own case

2 participants