-
Notifications
You must be signed in to change notification settings - Fork 62
/
SmartRollupRefute.ts
139 lines (115 loc) · 3.77 KB
/
SmartRollupRefute.ts
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import { TezosOperationType } from '../OperationTypes'
import { TezosBaseOperation } from '../TezosBaseOperation'
export interface TezosSmartRollupRefuteOperation extends TezosBaseOperation {
kind: TezosOperationType.SMART_ROLLUP_REFUTE
source: string
fee: string
counter: string
gas_limit: string
storage_limit: string
rollup: string
opponent: string
refutation: SmartRollupRefutation
}
export type SmartRollupRefutation = SmartRollupRefutationStart | SmartRollupRefutationMove
export interface SmartRollupRefutationStart {
refutation_kind: SmartRollupRefutationOptions.START
player_commitment_hash: string
opponent_commitment_hash: string
}
export interface SmartRollupRefutationMove {
refutation_kind: SmartRollupRefutationOptions.MOVE
choice: string
step: SmartRollupRefutationMoveStep
}
export enum SmartRollupRefutationOptions {
START = 'start',
MOVE = 'move'
}
export type SmartRollupRefutationMoveStep =
| SmartRollupRefutationMoveStepDissection[]
| SmartRollupRefutationMoveStepProof
export type SmartRollupGameStatus =
| SmartRollupRefuteGameStatusOptions.ONGOING
| SmartRollupRefuteGameStatusEnded
export interface SmartRollupRefutationMoveStepDissection {
state?: string
tick: number
}
export interface SmartRollupRefutationMoveStepProof {
pvm_step: string
input_proof?: SmartRollupRefutationMoveInputProof
}
export enum SmartRollupRefuteGameStatusOptions {
ONGOING = 'ongoing',
ENDED = 'ended'
}
export interface SmartRollupRefuteGameStatusEnded {
result: SmartRollupRefuteGameStatusResult
}
export type SmartRollupRefutationMoveInputProof =
| SmartRollupRefutationMoveInputProofInbox
| SmartRollupRefutationMoveInputProofReveal
| SmartRollupRefutationMoveInputProofFirstInput
export type SmartRollupRefuteGameStatusResult =
| SmartRollupRefuteGameEndedResultLoser
| SmartRollupRefuteGameEndedResultDraw
export interface SmartRollupRefutationMoveInputProofInbox {
input_proof_kind: SmartRollupInputProofKind.INBOX_PROOF
level: number
message_counter: string
serialized_proof: string
}
export interface SmartRollupRefutationMoveInputProofReveal {
input_proof_kind: SmartRollupInputProofKind.REVEAL_PROOF
reveal_proof: SmartRollupRefuteRevealProofOptions
}
export interface SmartRollupRefutationMoveInputProofFirstInput {
input_proof_kind: SmartRollupInputProofKind.FIRST_INPUT
}
export interface SmartRollupRefuteGameEndedResultLoser {
kind: SmartRollupRefuteGameEndedPlayerOutcomes.LOSER
reason: SmartRollupRefuteGameEndedReason
player: string
}
export interface SmartRollupRefuteGameEndedResultDraw {
kind: SmartRollupRefuteGameEndedPlayerOutcomes.DRAW
}
export enum SmartRollupInputProofKind {
INBOX_PROOF = 'inbox_proof',
REVEAL_PROOF = 'reveal_proof',
FIRST_INPUT = 'first_input'
}
export type SmartRollupRefuteRevealProofOptions =
| SmartRollupRefuteRevealProofRaw
| SmartRollupRefuteRevealProofMetadata
| SmartRollupRefuteRevealProofDalPage
export enum SmartRollupRefuteGameEndedPlayerOutcomes {
LOSER = 'loser',
DRAW = 'draw'
}
export enum SmartRollupRefuteGameEndedReason {
CONFLICT_RESOLVED = 'conflict_resolved',
TIMEOUT = 'timeout'
}
export enum SmartRollupRefuteRevealProofKind {
RAW_DATA_PROOF = 'raw_data_proof',
METADATA_PROOF = 'metadata_proof',
DAL_PAGE_PROOF = 'dal_page_proof'
}
export interface SmartRollupRefuteRevealProofRaw {
reveal_proof_kind: SmartRollupRefuteRevealProofKind.RAW_DATA_PROOF
raw_data: string
}
export interface SmartRollupRefuteRevealProofMetadata {
reveal_proof_kind: SmartRollupRefuteRevealProofKind.METADATA_PROOF
}
export interface SmartRollupRefuteRevealProofDalPage {
reveal_proof_kind: SmartRollupRefuteRevealProofKind.DAL_PAGE_PROOF
dal_page_id: {
published_level: number
slot_index: number
page_index: number
}
dal_proof: string
}