decdn_incentive/slash_judge.rs
1//! `SlashJudge` contract ABI bindings (ADR 014 ยง Slashing & Disputes).
2//!
3//! Generated by the `alloy::sol!` macro from the Solidity surface in
4//! `contracts/src/SlashJudge.sol`. Two consumers:
5//!
6//! - The daemon slash watcher demuxes the `Slashed` event (filtered to its own
7//! operator) to surface a slash over the admin RPC.
8//! - The cross-layer e2e drives a real commit-reveal challenge
9//! (`commitChallenge` โ `submitRateChallenge`) to land a slash on-chain.
10//!
11//! The `ProbeMsg` / `StreamMsg` evidence structs mirror the on-chain layout;
12//! the EIP-712 signatures over them are built by [`crate::probe_sig`] /
13//! [`crate::stream_sig`] against [`crate::slash_judge_domain`].
14
15// The `sol!`-generated bindings include macro-emitted code that uses
16// patterns workspace clippy denies (raw indexing into ABI fixed-size
17// byte arrays, `unwrap` on infallible conversions). These allows scope
18// the relaxation to this module only.
19#[allow(
20 clippy::expect_used,
21 clippy::indexing_slicing,
22 clippy::panic,
23 clippy::unwrap_used,
24 clippy::pub_underscore_fields,
25 clippy::missing_docs_in_private_items,
26 clippy::too_many_arguments,
27 missing_debug_implementations,
28 missing_docs,
29 non_snake_case,
30 non_camel_case_types
31)]
32mod sol_types {
33 alloy::sol! {
34 #[sol(rpc)]
35 contract SlashJudge {
36 /// Offense taxonomy. Ordering is contract-canonical (ADR 014);
37 /// mirrors `ISlashJudge.OffenseType`.
38 enum OffenseType {
39 RateManipulation,
40 Blacklist
41 }
42
43 /// Signed probe response โ evidence a node announced a blob.
44 /// Field order is part of the EIP-712 struct + ABI.
45 struct ProbeMsg {
46 bytes32 hash;
47 bool hasBlob;
48 uint64 ratePerMb;
49 uint64 timestampUs;
50 }
51
52 /// Signed stream response โ evidence of a node's delivery outcome.
53 /// Field order is part of the EIP-712 struct + ABI.
54 struct StreamMsg {
55 bytes32 hash;
56 bool ok;
57 uint64 ratePerMb;
58 uint64 totalBytes;
59 bytes32 poolId;
60 uint64 timestampUs;
61 }
62
63 /// Governable challenger bond (base units), refunded on a valid slash.
64 function challengeBond() external view returns (uint256);
65
66 /// Phase 1 of a challenge: register the opaque commitment
67 /// `keccak256(abi.encode(evidenceHash, salt, msg.sender))`.
68 function commitChallenge(bytes32 commitment) external;
69
70 /// Emitted on every slash that reduces operator bond. `slashId` is
71 /// minted by `CapacityBond.slash`; consumed by
72 /// `SlashAppeal.openSlashAppeal(slashId, evidenceBundleHash)`.
73 event Slashed(
74 uint256 indexed slashId,
75 address indexed operator,
76 OffenseType offenseType,
77 uint256 amount,
78 bytes32 evidenceHash
79 );
80
81 /// A commit-reveal commitment was registered (#854).
82 event ChallengeCommitted(bytes32 indexed commitment);
83 }
84 }
85}
86
87pub use sol_types::SlashJudge;