Skip to content

Commit 82a8588

Browse files
committed
dao-cacher stuff
1 parent 7cf1aa2 commit 82a8588

File tree

4 files changed

+1616
-4
lines changed

4 files changed

+1616
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,84 @@ interface binding-cacher {
7676
}
7777
}
7878

79+
interface dao-cacher {
80+
// Metadata associated with a batch of Ethereum logs.
81+
record dao-logs-metadata {
82+
chain-id: string,
83+
from-block: string,
84+
to-block: string,
85+
time-created: string,
86+
created-by: string,
87+
signature: string,
88+
}
89+
90+
// Represents an item in the manifest, detailing a single log cache file.
91+
record dao-manifest-item {
92+
metadata: dao-logs-metadata,
93+
is-empty: bool,
94+
file-hash: string,
95+
file-name: string,
96+
}
97+
98+
// The main manifest structure, listing all available log cache files.
99+
// WIT does not support direct map types, so a list of key-value tuples is used.
100+
record dao-manifest {
101+
// The key is the filename of the log cache.
102+
items: list<tuple<string, dao-manifest-item>>,
103+
manifest-filename: string,
104+
chain-id: string,
105+
protocol-version: string,
106+
}
107+
108+
record dao-get-logs-by-range-request {
109+
from-block: u64,
110+
to-block: option<u64>, // If None, signifies to the latest available/relevant cached block.
111+
}
112+
113+
variant dao-get-logs-by-range-ok-response {
114+
logs(tuple<u64, string>),
115+
latest(u64),
116+
}
117+
118+
// Defines the types of requests that can be sent to the Hypermap Cacher process.
119+
variant dao-cacher-request {
120+
get-manifest,
121+
get-log-cache-content(string),
122+
get-status,
123+
get-logs-by-range(dao-get-logs-by-range-request),
124+
reset(option<list<string>>),
125+
start-providing,
126+
stop-providing,
127+
set-nodes(list<string>),
128+
}
129+
130+
// Represents the operational status of the cacher.
131+
record dao-cacher-status {
132+
last-cached-block: u64,
133+
chain-id: string,
134+
protocol-version: string,
135+
next-cache-attempt-in-seconds: option<u64>,
136+
manifest-filename: string,
137+
log-files-count: u32,
138+
our-address: string,
139+
is-providing: bool,
140+
}
141+
142+
// Defines the types of responses the Hypermap Cacher process can send.
143+
variant dao-cacher-response {
144+
get-manifest(option<dao-manifest>),
145+
get-log-cache-content(result<option<string>, string>),
146+
get-status(dao-cacher-status),
147+
get-logs-by-range(result<dao-get-logs-by-range-ok-response, string>),
148+
start-providing(result<string, string>),
149+
stop-providing(result<string, string>),
150+
set-nodes(result<string, string>),
151+
reset(result<string, string>),
152+
rejected,
153+
is-starting,
154+
}
155+
}
156+
79157
interface hypermap-cacher {
80158
// Metadata associated with a batch of Ethereum logs.
81159
record logs-metadata {
@@ -154,9 +232,10 @@ interface hypermap-cacher {
154232
}
155233
}
156234

157-
world hypermap-cacher-sys-v1 {
235+
world hypermap-cacher-sys-v2 {
158236
import sign;
159237
import binding-cacher;
238+
import dao-cacher;
160239
import hypermap-cacher;
161240
include process-v1;
162241
}

hyperware-wit/process-lib.wit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ world process-lib {
22
import sign;
33
import hypermap-cacher;
44
import binding-cacher;
5+
import dao-cacher;
56
import hyperwallet;
67
include lib;
78
}

0 commit comments

Comments
 (0)