1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//! Bond-escrow surface: tag enum, error enum, and `BondEscrow` trait.
//!
//! Traces to: [SPEC.md §12.3](../docs/resources/SPEC.md), catalogue rows
//! [DSL-121..126](../docs/requirements/domains/bonds/specs/).
//!
//! # Scope
//!
//! `dig-slashing` does NOT own escrow storage. The escrowed mojos live
//! in `dig-collateral` (or a dedicated bond-escrow crate) that
//! implements [`BondEscrow`]. This module defines the narrow trait
//! surface the slashing manager + appeal adjudicator call through.
//!
//! # Symmetry
//!
//! Reporter and appellant bonds share the same trait + error surface.
//! They are distinguished by the [`BondTag`] variant, which doubles as
//! the unique escrow key — two concurrent bonds on the same principal
//! cannot collide because the envelope/appeal hash is mixed in.
use Bytes32;
use ;
use Error;
/// Bond categorisation + escrow key.
///
/// Traces to [SPEC §12.3](../../docs/resources/SPEC.md).
///
/// # Why the hash is part of the tag
///
/// `BondEscrow` uses the tag as a lookup key — `(principal_idx, tag)`
/// is the uniquifier. Binding the evidence hash (resp. appeal hash)
/// into the tag means the same validator can hold multiple
/// concurrent bonds across independent evidences without collision.
/// DSL-166 verifies `Reporter(h) != Appellant(h)` for any shared `h`.
/// Failure modes for `BondEscrow` operations.
///
/// Traces to [SPEC §17.3](../../docs/resources/SPEC.md). The variants
/// are intentionally distinct so the slashing manager can attribute
/// rejections correctly — `InsufficientBalance` → reporter lacks
/// collateral; `DoubleLock` → state machine bug; `TagNotFound` →
/// release/forfeit on an uninitialised tag.
/// Bond-escrow storage interface consumed by the slashing manager +
/// appeal adjudicator.
///
/// Traces to [SPEC §12.3](../../docs/resources/SPEC.md). Concrete
/// impls live in `dig-collateral` (or equivalent). Every method is
/// `&mut self` except `escrowed` — mutating operations acquire
/// exclusive access to the underlying coin store.