arise-sigil · challenge
Source declarations, signatures and documentation for challenge.
Source: sigil/node/../arise-bridge/arise-sigil/src/challenge.rs. SHA-256: 789d87374b6d2f626e4a30f7cf6eec2c969fca147a14ccf079cfe71e41d20ac4.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
challenge::ChallengeOutcome
The outcome of a resolved challenge.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum ChallengeOutcome {
/// Challenger wins: 40% to challenger, 30% to arbitrators, 30% to treasury.
ChallengerWins,
/// Provider wins: 50% to provider from challenger deposit, 50% returned.
ProviderWins,
}Source line: 19.
challenge::ChallengeState
States in the challenge lifecycle.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum ChallengeState {
/// Challenge has been submitted, waiting for reproduction window.
Submitted,
/// Provider has 1 epoch to respond with reproduction evidence.
ReproductionWindow,
/// Three arbitrator providers are voting.
Arbitration,
/// Challenge has been resolved with a final outcome.
Resolved(ChallengeOutcome),
}Source line: 28.
challenge::REQUIRED_ARBITRATORS
The number of arbitrators required for a challenge.
pub const REQUIRED_ARBITRATORS: usize;Source line: 40.
challenge::REPRODUCTION_WINDOW_EPOCHS
The number of epochs for the reproduction window.
pub const REPRODUCTION_WINDOW_EPOCHS: u64;Source line: 43.
challenge::ARBITRATION_WINDOW_EPOCHS
The number of epochs for arbitration after the reproduction window.
pub const ARBITRATION_WINDOW_EPOCHS: u64;Source line: 46.
challenge::Challenge
A dispute against a compute receipt.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Challenge {
/// Unique challenge identifier.
pub challenge_id: String,
/// DID of the entity that raised the challenge.
pub challenger_did: String,
/// DID of the provider being challenged.
pub provider_did: String,
/// Receipt being disputed.
pub receipt_id: String,
/// Current state in the challenge lifecycle.
pub state: ChallengeState,
/// Epoch when the challenge was submitted.
pub submitted_epoch: u64,
/// Hash of the evidence submitted by the challenger.
pub evidence_hash: SigilHash,
/// DIDs of the three selected arbitrators.
pub arbitrator_dids: Vec<String>,
/// Votes cast by arbitrators: `(did, agrees_with_challenger)`.
pub arbitrator_votes: Vec<(String, bool)>
}Source line: 50.
challenge::Challenge::new
Creates a new challenge in the Submitted state.
pub fn new(
challenge_id: String,
challenger_did: String,
provider_did: String,
receipt_id: String,
submitted_epoch: u64,
evidence_hash: SigilHash,
) -> Self;Source line: 73.
challenge::Challenge::advance
Advance the challenge state machine based on the current epoch.
Submitted->ReproductionWindow(immediately).ReproductionWindow->Arbitration(after 1 epoch).Arbitrationdoes not auto-advance; use [resolve] once votes are in.
pub fn advance(&mut self, current_epoch: u64) -> Result<(), AriseError>;Source line: 99.
challenge::Challenge::add_arbitrator
Adds an arbitrator to the challenge. Must be called before transitioning
to Arbitration.
pub fn add_arbitrator(&mut self, did: String) -> Result<(), AriseError>;Source line: 134.
challenge::Challenge::add_arbitrator_vote
Records an arbitrator's vote.
agrees is true if the arbitrator agrees with the challenger.
pub fn add_arbitrator_vote(&mut self, did: &str, agrees: bool) -> Result<(), AriseError>;Source line: 152.
challenge::Challenge::resolve
Resolves the challenge once all arbitrators have voted.
Majority vote determines the outcome.
pub fn resolve(&mut self) -> Result<ChallengeOutcome, AriseError>;Source line: 175.