Skip to content

Commit 082f7e8

Browse files
committed
Cargo.toml: fix bin path
Signed-off-by: Gyuho Lee <[email protected]>
1 parent 583ba59 commit 082f7e8

File tree

7 files changed

+288
-0
lines changed

7 files changed

+288
-0
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "client_model"]
2+
path = client_model
3+
url = https://github.com/prometheus/client_model

Cargo.toml

+11
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@ homepage = "https://avax.network"
1010
repository = "https://github.com/ava-labs/mini-kvvm-rs"
1111
readme = "README.md"
1212

13+
[[bin]]
14+
name = "mini-kvvm-rs"
15+
path = "src/bin/mini-kvvm-rs/main.rs"
16+
1317
[dependencies]
1418
clap = { version = "3.1.8", features = ["cargo", "derive"] }
1519
env_logger = "0.9.0"
1620
log = "0.4.16"
21+
prost = "0.10.0"
22+
tokio = { version = "1.17.0", features = ["rt-multi-thread"] }
23+
tonic = "0.7.1"
24+
25+
[build-dependencies]
26+
# ref. https://github.com/hyperium/tonic/tree/master/tonic-build
27+
tonic-build = "0.7.0"

build.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/// ref. https://github.com/hyperium/tonic/tree/master/tonic-build
2+
fn main() {
3+
tonic_build::configure()
4+
.build_server(true)
5+
.build_client(false)
6+
.compile(
7+
&[
8+
// e.g.,
9+
// git submodule add https://github.com/prometheus/client_model
10+
// git submodule update --remote
11+
"client_model/io/prometheus/client/metrics.proto",
12+
"proto/vm.proto",
13+
],
14+
&["client_model", "proto"],
15+
)
16+
.unwrap();
17+
}

client_model

Submodule client_model added at 6dc836e

proto/vm.proto

+252
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
// copied from https://github.com/ava-labs/avalanchego/blob/v1.7.10/proto/vm/vm.proto
2+
3+
syntax = "proto3";
4+
5+
package vm;
6+
7+
import "google/protobuf/empty.proto";
8+
import "io/prometheus/client/metrics.proto";
9+
10+
option go_package = "github.com/ava-labs/avalanchego/proto/pb/vm";
11+
12+
service VM {
13+
rpc Initialize(InitializeRequest) returns (InitializeResponse);
14+
rpc SetState(SetStateRequest) returns (google.protobuf.Empty);
15+
rpc Shutdown(google.protobuf.Empty) returns (google.protobuf.Empty);
16+
rpc CreateHandlers(google.protobuf.Empty) returns (CreateHandlersResponse);
17+
rpc CreateStaticHandlers(google.protobuf.Empty) returns (CreateStaticHandlersResponse);
18+
rpc Connected(ConnectedRequest) returns (google.protobuf.Empty);
19+
rpc Disconnected(DisconnectedRequest) returns (google.protobuf.Empty);
20+
rpc BuildBlock(google.protobuf.Empty) returns (BuildBlockResponse);
21+
rpc ParseBlock(ParseBlockRequest) returns (ParseBlockResponse);
22+
rpc GetBlock(GetBlockRequest) returns (GetBlockResponse);
23+
rpc SetPreference(SetPreferenceRequest) returns (google.protobuf.Empty);
24+
rpc Health(HealthRequest) returns (HealthResponse);
25+
rpc Version(google.protobuf.Empty) returns (VersionResponse);
26+
rpc AppRequest(AppRequestMsg) returns (google.protobuf.Empty);
27+
rpc AppRequestFailed(AppRequestFailedMsg) returns (google.protobuf.Empty);
28+
rpc AppResponse(AppResponseMsg) returns (google.protobuf.Empty);
29+
rpc AppGossip(AppGossipMsg) returns (google.protobuf.Empty);
30+
rpc Gather(google.protobuf.Empty) returns (GatherResponse);
31+
rpc BlockVerify(BlockVerifyRequest) returns (BlockVerifyResponse);
32+
rpc BlockAccept(BlockAcceptRequest) returns (google.protobuf.Empty);
33+
rpc BlockReject(BlockRejectRequest) returns (google.protobuf.Empty);
34+
rpc GetAncestors(GetAncestorsRequest) returns (GetAncestorsResponse);
35+
rpc BatchedParseBlock(BatchedParseBlockRequest) returns (BatchedParseBlockResponse);
36+
rpc VerifyHeightIndex(google.protobuf.Empty) returns (VerifyHeightIndexResponse);
37+
rpc GetBlockIDAtHeight(GetBlockIDAtHeightRequest) returns (GetBlockIDAtHeightResponse);
38+
}
39+
40+
message InitializeRequest {
41+
// reserved for backward compatibility
42+
// avalanchego <=v1.7.9 used the fields "11-19" as an id to
43+
// identify the gRPC server address which served the messenger,
44+
// keystore, shared memory, blockchain alias, subnet alias, and
45+
// appSender services via the now removed service broker
46+
reserved 11 to 19;
47+
uint32 network_id = 1;
48+
bytes subnet_id = 2;
49+
bytes chain_id = 3;
50+
bytes node_id = 4;
51+
bytes x_chain_id = 5;
52+
bytes avax_asset_id = 6;
53+
bytes genesis_bytes = 7;
54+
bytes upgrade_bytes = 8;
55+
bytes config_bytes = 9;
56+
repeated VersionedDBServer db_servers = 10;
57+
// server_addr is the address of the gRPC server which serves
58+
// the messenger, keystore, shared memory, blockchain alias,
59+
// subnet alias, and appSender services
60+
string server_addr = 20;
61+
}
62+
63+
message SetStateRequest {
64+
uint32 state = 1;
65+
}
66+
67+
message InitializeResponse {
68+
bytes last_accepted_id = 1;
69+
bytes last_accepted_parent_id = 2;
70+
uint32 status = 3;
71+
uint64 height = 4;
72+
bytes bytes = 5;
73+
bytes timestamp = 6;
74+
}
75+
76+
message VersionedDBServer {
77+
// reserved for backward compatibility
78+
// avalanchego <=v1.7.9 used the field "1" as an id to identify the gRPC server
79+
// address which served the Database service via the now removed service broker
80+
reserved 1;
81+
string version = 2;
82+
// server_addr is the address of the gRPC server which serves the
83+
// Database service
84+
string server_addr = 3;
85+
}
86+
87+
message CreateHandlersResponse {
88+
repeated Handler handlers = 1;
89+
}
90+
91+
message CreateStaticHandlersResponse {
92+
repeated Handler handlers = 1;
93+
}
94+
95+
message Handler {
96+
// reserved for backward compatibility
97+
// avalanchego <=v1.7.9 used the field "3" as an id to identify the gRPC server
98+
// address which served the HTTP service via the now removed service broker
99+
reserved 3;
100+
string prefix = 1;
101+
uint32 lock_options = 2;
102+
// server_addr is the address of the gRPC server which serves the
103+
// HTTP service
104+
string server_addr = 4;
105+
}
106+
107+
message BuildBlockResponse {
108+
bytes id = 1;
109+
bytes parent_id = 2;
110+
bytes bytes = 3;
111+
uint64 height = 4;
112+
bytes timestamp = 5;
113+
// status is always processing
114+
}
115+
116+
message ParseBlockRequest {
117+
bytes bytes = 1;
118+
}
119+
120+
message ParseBlockResponse {
121+
bytes id = 1;
122+
bytes parent_id = 2;
123+
uint32 status = 3;
124+
uint64 height = 4;
125+
bytes timestamp = 5;
126+
}
127+
128+
message GetBlockRequest {
129+
bytes id = 1;
130+
}
131+
132+
message GetBlockResponse {
133+
bytes parent_id = 1;
134+
bytes bytes = 2;
135+
uint32 status = 3;
136+
uint64 height = 4;
137+
bytes timestamp = 5;
138+
}
139+
140+
message SetPreferenceRequest {
141+
bytes id = 1;
142+
}
143+
144+
message BlockVerifyRequest {
145+
bytes bytes = 1;
146+
}
147+
148+
message BlockVerifyResponse {
149+
bytes timestamp = 1;
150+
}
151+
152+
message BlockAcceptRequest {
153+
bytes id = 1;
154+
}
155+
156+
message BlockRejectRequest {
157+
bytes id = 1;
158+
}
159+
160+
message HealthRequest {
161+
// grpc_checks is a map [name]=address of the gRPC servers to perform the
162+
// health check agaist.
163+
map<string, string> grpc_checks = 1;
164+
}
165+
166+
message HealthResponse {
167+
string details = 1;
168+
}
169+
170+
message VersionResponse {
171+
string version = 1;
172+
}
173+
174+
message AppRequestMsg {
175+
// The node that sent us this request
176+
bytes node_id = 1;
177+
// The ID of this request
178+
uint32 request_id = 2;
179+
// deadline for this request
180+
bytes deadline = 3;
181+
// The request body
182+
bytes request = 4;
183+
}
184+
185+
message AppRequestFailedMsg {
186+
// The node that we failed to get a response from
187+
bytes node_id = 1;
188+
// The ID of the request we sent and didn't get a response to
189+
uint32 request_id = 2;
190+
}
191+
192+
message AppResponseMsg {
193+
// The node that we got a response from
194+
bytes node_id = 1;
195+
// Request ID of request that this is in response to
196+
uint32 request_id = 2;
197+
// The response body
198+
bytes response = 3;
199+
}
200+
201+
message AppGossipMsg {
202+
// The node that sent us a gossip message
203+
bytes node_id = 1;
204+
// The message body
205+
bytes msg = 2;
206+
}
207+
208+
message ConnectedRequest {
209+
bytes node_id = 1;
210+
string version = 2;
211+
}
212+
213+
message DisconnectedRequest {
214+
bytes node_id = 1;
215+
}
216+
217+
message GetAncestorsRequest {
218+
bytes blk_id = 1;
219+
int32 max_blocks_num = 2;
220+
int32 max_blocks_size = 3;
221+
int64 max_blocks_retrival_time = 4;
222+
}
223+
224+
message GetAncestorsResponse {
225+
repeated bytes blks_bytes = 1;
226+
}
227+
228+
message BatchedParseBlockRequest {
229+
repeated bytes request = 1;
230+
}
231+
232+
message BatchedParseBlockResponse {
233+
repeated ParseBlockResponse response = 1;
234+
}
235+
236+
// HeightIndexedVM related messages
237+
message VerifyHeightIndexResponse {
238+
uint32 err = 1;
239+
}
240+
241+
message GetBlockIDAtHeightRequest {
242+
uint64 height = 1;
243+
}
244+
245+
message GetBlockIDAtHeightResponse {
246+
bytes blk_id = 1;
247+
uint32 err = 2;
248+
}
249+
250+
message GatherResponse {
251+
repeated io.prometheus.client.MetricFamily metric_families = 1;
252+
}

src/genesis.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub struct Genesis {
2+
pub data: String,
3+
}

src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod genesis;

0 commit comments

Comments
 (0)