@consensus-tools/consensus-tools 0.1.0 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export type ConsensusPolicyType =
2
- | 'SINGLE_WINNER'
2
+ | 'FIRST_SUBMISSION_WINS'
3
3
  | 'HIGHEST_CONFIDENCE_SINGLE'
4
+ | 'APPROVAL_VOTE'
4
5
  | 'OWNER_PICK'
5
6
  | 'TOP_K_SPLIT'
6
7
  | 'MAJORITY_VOTE'
@@ -24,10 +25,27 @@ export type VoteTargetType = 'SUBMISSION' | 'CHOICE';
24
25
  export interface ConsensusPolicyConfig {
25
26
  type: ConsensusPolicyType;
26
27
  trustedArbiterAgentId?: string;
28
+
29
+ // confidence-based policies
27
30
  minConfidence?: number;
31
+
32
+ // top-k policies
28
33
  topK?: number;
29
34
  ordering?: 'confidence' | 'score';
35
+
36
+ // vote-based policies
30
37
  quorum?: number;
38
+ minScore?: number;
39
+ minMargin?: number;
40
+ tieBreak?: 'earliest' | 'confidence' | 'arbiter';
41
+
42
+ // approval-vote specific
43
+ approvalVote?: {
44
+ weightMode?: 'equal' | 'explicit' | 'reputation';
45
+ settlement?: 'immediate' | 'staked' | 'oracle';
46
+ oracle?: 'trusted_arbiter';
47
+ voteSlashPercent?: number; // 0-1 (only for settlement=staked)
48
+ };
31
49
  }
32
50
 
33
51
  export interface SlashingPolicy {
@@ -162,7 +180,14 @@ export interface DiagnosticEntry {
162
180
  context?: Record<string, unknown>;
163
181
  }
164
182
 
165
- export type LedgerEntryType = 'FAUCET' | 'STAKE' | 'UNSTAKE' | 'PAYOUT' | 'SLASH' | 'ADJUST' | 'ESCROW_MINT';
183
+ export type LedgerEntryType =
184
+ | 'FAUCET'
185
+ | 'STAKE'
186
+ | 'UNSTAKE'
187
+ | 'PAYOUT'
188
+ | 'SLASH'
189
+ | 'ADJUST'
190
+ | 'ESCROW_MINT';
166
191
 
167
192
  export interface LedgerEntry {
168
193
  id: string;
File without changes