-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_models.py
executable file
·168 lines (115 loc) · 3.04 KB
/
data_models.py
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import time
from enum import Enum
from typing import List
from typing import Optional
from pydantic import BaseModel
class RedisConfig(BaseModel):
host: str
port: int
db: int
password: Optional[str]
class PeerUUIDIncludedRequests(BaseModel):
instanceID: str
class PeerRegistrationRequest(PeerUUIDIncludedRequests):
projectID: str
class EpochBase(BaseModel):
begin: int
end: int
class SnapshotBase(PeerUUIDIncludedRequests):
epoch: EpochBase
projectID: str
class NodeConfig(BaseModel):
url: str
class RPCConfig(BaseModel):
nodes: List[NodeConfig]
retry: int
request_timeout: int
class RPCNodeConfig(BaseModel):
url: str
rate_limit: str
class ConnectionLimits(BaseModel):
max_connections: int = 100
max_keepalive_connections: int = 50
keepalive_expiry: int = 300
class RPCConfigBase(BaseModel):
full_nodes: List[RPCNodeConfig]
archive_nodes: Optional[List[RPCNodeConfig]]
force_archive_blocks: Optional[int]
retry: int
request_time_out: int
connection_limits: ConnectionLimits
class EpochConfig(BaseModel):
height: int
head_offset: int
block_time: int
history_length: int
class ChainConfig(BaseModel):
rpc: RPCConfigBase
chain_id: int
epoch: EpochConfig
class AnchorChainConfig(BaseModel):
rpc: RPCConfigBase
default_gas_in_gwei: float
block_time: int
max_block_buffer: int
chain_id: int
polling_interval: int
class RLimit(BaseModel):
file_descriptors: int
class ReportingConfig(BaseModel):
slack_url: str
service_url: str
class SettingsConf(BaseModel):
redis: RedisConfig
chain: ChainConfig
anchor_chain: AnchorChainConfig
rate_limit: str
reporting: ReportingConfig
rlimit: RLimit
ticker_begin_block: Optional[int]
protocol_state_address: str
validator_epoch_address: str
validator_epoch_private_key: str
force_consensus_address: str
force_consensus_private_key: str
class Epoch(BaseModel):
sourcechainEndheight: int
finalized: bool
class Message(BaseModel):
message: str
class SnapshotterIssue(BaseModel):
instanceID: str
issueType: str
projectID: str
epochId: str
timeOfReporting: str
extra: Optional[str] = ''
class SnapshotterPing(BaseModel):
instanceID: str
class SnapshotterPingResponse(BaseModel):
instanceID: str
timeOfReporting: int
class UserStatusEnum(str, Enum):
active = 'active'
inactive = 'inactive'
class SnapshotterMetadata(BaseModel):
rate_limit: str
active: UserStatusEnum
callsCount: int = 0
throttledCount: int = 0
next_reset_at: int = int(time.time()) + 86400
name: str
email: str
alias: str
uuid: Optional[str] = None
class GenericTxnIssue(BaseModel):
accountAddress: str
issueType: str
projectId: Optional[str]
epochBegin: Optional[str]
epochId: Optional[str]
extra: Optional[str] = ''
class SnapshotterIdentifier(BaseModel):
instanceId: str
class AccountIdentifier(BaseModel):
accountAddress: str