github.com/ava-labs/avalanchego@v1.11.11/proto/vm/vm.proto (about) 1 syntax = "proto3"; 2 3 package vm; 4 5 import "google/protobuf/empty.proto"; 6 import "google/protobuf/timestamp.proto"; 7 import "io/prometheus/client/metrics.proto"; 8 9 option go_package = "github.com/ava-labs/avalanchego/proto/pb/vm"; 10 11 // ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/snow/engine/snowman/block 12 // ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/snow/consensus/snowman#Block 13 service VM { 14 // ChainVM 15 // 16 // Initialize this VM. 17 rpc Initialize(InitializeRequest) returns (InitializeResponse); 18 // SetState communicates to VM its next state it starts 19 rpc SetState(SetStateRequest) returns (SetStateResponse); 20 // Shutdown is called when the node is shutting down. 21 rpc Shutdown(google.protobuf.Empty) returns (google.protobuf.Empty); 22 // Creates the HTTP handlers for custom chain network calls. 23 rpc CreateHandlers(google.protobuf.Empty) returns (CreateHandlersResponse); 24 rpc Connected(ConnectedRequest) returns (google.protobuf.Empty); 25 rpc Disconnected(DisconnectedRequest) returns (google.protobuf.Empty); 26 // Attempt to create a new block from data contained in the VM. 27 rpc BuildBlock(BuildBlockRequest) returns (BuildBlockResponse); 28 // Attempt to create a block from a stream of bytes. 29 rpc ParseBlock(ParseBlockRequest) returns (ParseBlockResponse); 30 // Attempt to load a block. 31 rpc GetBlock(GetBlockRequest) returns (GetBlockResponse); 32 // Notify the VM of the currently preferred block. 33 rpc SetPreference(SetPreferenceRequest) returns (google.protobuf.Empty); 34 // Attempt to verify the health of the VM. 35 rpc Health(google.protobuf.Empty) returns (HealthResponse); 36 // Version returns the version of the VM. 37 rpc Version(google.protobuf.Empty) returns (VersionResponse); 38 // Notify this engine of a request for data from [nodeID]. 39 rpc AppRequest(AppRequestMsg) returns (google.protobuf.Empty); 40 // Notify this engine that an AppRequest message it sent to [nodeID] with 41 // request ID [requestID] failed. 42 rpc AppRequestFailed(AppRequestFailedMsg) returns (google.protobuf.Empty); 43 // Notify this engine of a response to the AppRequest message it sent to 44 // [nodeID] with request ID [requestID]. 45 rpc AppResponse(AppResponseMsg) returns (google.protobuf.Empty); 46 // Notify this engine of a gossip message from [nodeID]. 47 rpc AppGossip(AppGossipMsg) returns (google.protobuf.Empty); 48 // Attempts to gather metrics from a VM. 49 rpc Gather(google.protobuf.Empty) returns (GatherResponse); 50 // BatchedChainVM 51 rpc GetAncestors(GetAncestorsRequest) returns (GetAncestorsResponse); 52 rpc BatchedParseBlock(BatchedParseBlockRequest) returns (BatchedParseBlockResponse); 53 54 // HeightIndexedChainVM 55 rpc GetBlockIDAtHeight(GetBlockIDAtHeightRequest) returns (GetBlockIDAtHeightResponse); 56 57 // StateSyncableVM 58 // 59 // StateSyncEnabled indicates whether the state sync is enabled for this VM. 60 rpc StateSyncEnabled(google.protobuf.Empty) returns (StateSyncEnabledResponse); 61 // GetOngoingSyncStateSummary returns an in-progress state summary if it exists. 62 rpc GetOngoingSyncStateSummary(google.protobuf.Empty) returns (GetOngoingSyncStateSummaryResponse); 63 // GetLastStateSummary returns the latest state summary. 64 rpc GetLastStateSummary(google.protobuf.Empty) returns (GetLastStateSummaryResponse); 65 // ParseStateSummary parses a state summary out of [summaryBytes]. 66 rpc ParseStateSummary(ParseStateSummaryRequest) returns (ParseStateSummaryResponse); 67 // GetStateSummary retrieves the state summary that was generated at height 68 // [summaryHeight]. 69 rpc GetStateSummary(GetStateSummaryRequest) returns (GetStateSummaryResponse); 70 71 // Block 72 rpc BlockVerify(BlockVerifyRequest) returns (BlockVerifyResponse); 73 rpc BlockAccept(BlockAcceptRequest) returns (google.protobuf.Empty); 74 rpc BlockReject(BlockRejectRequest) returns (google.protobuf.Empty); 75 76 // StateSummary 77 rpc StateSummaryAccept(StateSummaryAcceptRequest) returns (StateSummaryAcceptResponse); 78 } 79 80 enum State { 81 STATE_UNSPECIFIED = 0; 82 STATE_STATE_SYNCING = 1; 83 STATE_BOOTSTRAPPING = 2; 84 STATE_NORMAL_OP = 3; 85 } 86 87 enum Error { 88 // ERROR_UNSPECIFIED is used to indicate that no error occurred. 89 ERROR_UNSPECIFIED = 0; 90 ERROR_CLOSED = 1; 91 ERROR_NOT_FOUND = 2; 92 ERROR_STATE_SYNC_NOT_IMPLEMENTED = 3; 93 } 94 95 message InitializeRequest { 96 uint32 network_id = 1; 97 bytes subnet_id = 2; 98 bytes chain_id = 3; 99 bytes node_id = 4; 100 // public_key is the BLS public key that would correspond with any signatures 101 // produced by the warp messaging signer 102 bytes public_key = 5; 103 bytes x_chain_id = 6; 104 bytes c_chain_id = 7; 105 bytes avax_asset_id = 8; 106 string chain_data_dir = 9; 107 bytes genesis_bytes = 10; 108 bytes upgrade_bytes = 11; 109 bytes config_bytes = 12; 110 string db_server_addr = 13; 111 // server_addr is the address of the gRPC server which serves 112 // the messenger, keystore, shared memory, blockchain alias, 113 // subnet alias, and appSender services 114 string server_addr = 14; 115 // network_upgrades_bytes is the json encoded network upgrades 116 NetworkUpgrades network_upgrades = 15; 117 } 118 119 message NetworkUpgrades { 120 google.protobuf.Timestamp apricot_phase_1_time = 1; 121 google.protobuf.Timestamp apricot_phase_2_time = 2; 122 google.protobuf.Timestamp apricot_phase_3_time = 3; 123 google.protobuf.Timestamp apricot_phase_4_time = 4; 124 uint64 apricot_phase_4_min_p_chain_height = 5; 125 google.protobuf.Timestamp apricot_phase_5_time = 6; 126 google.protobuf.Timestamp apricot_phase_pre_6_time = 7; 127 google.protobuf.Timestamp apricot_phase_6_time = 8; 128 google.protobuf.Timestamp apricot_phase_post_6_time = 9; 129 google.protobuf.Timestamp banff_time = 10; 130 google.protobuf.Timestamp cortina_time = 11; 131 bytes cortina_x_chain_stop_vertex_id = 12; 132 google.protobuf.Timestamp durango_time = 13; 133 google.protobuf.Timestamp etna_time = 14; 134 } 135 136 message InitializeResponse { 137 bytes last_accepted_id = 1; 138 bytes last_accepted_parent_id = 2; 139 uint64 height = 3; 140 bytes bytes = 4; 141 google.protobuf.Timestamp timestamp = 5; 142 } 143 144 message SetStateRequest { 145 State state = 1; 146 } 147 148 message SetStateResponse { 149 bytes last_accepted_id = 1; 150 bytes last_accepted_parent_id = 2; 151 uint64 height = 3; 152 bytes bytes = 4; 153 google.protobuf.Timestamp timestamp = 5; 154 } 155 156 message CreateHandlersResponse { 157 repeated Handler handlers = 1; 158 } 159 160 message Handler { 161 string prefix = 1; 162 // server_addr is the address of the gRPC server which serves the 163 // HTTP service 164 string server_addr = 2; 165 } 166 167 message BuildBlockRequest { 168 optional uint64 p_chain_height = 1; 169 } 170 171 // Note: The status of a freshly built block is assumed to be Processing. 172 message BuildBlockResponse { 173 bytes id = 1; 174 bytes parent_id = 2; 175 bytes bytes = 3; 176 uint64 height = 4; 177 google.protobuf.Timestamp timestamp = 5; 178 bool verify_with_context = 6; 179 } 180 181 message ParseBlockRequest { 182 bytes bytes = 1; 183 } 184 185 message ParseBlockResponse { 186 bytes id = 1; 187 bytes parent_id = 2; 188 uint64 height = 4; 189 google.protobuf.Timestamp timestamp = 5; 190 bool verify_with_context = 6; 191 } 192 193 message GetBlockRequest { 194 bytes id = 1; 195 } 196 197 message GetBlockResponse { 198 bytes parent_id = 1; 199 bytes bytes = 2; 200 uint64 height = 4; 201 google.protobuf.Timestamp timestamp = 5; 202 // used to propagate database.ErrNotFound through RPC 203 Error err = 6; 204 bool verify_with_context = 7; 205 } 206 207 message SetPreferenceRequest { 208 bytes id = 1; 209 } 210 211 message BlockVerifyRequest { 212 bytes bytes = 1; 213 214 // If set, the VM server casts the block to a [block.WithVerifyContext] and 215 // calls [VerifyWithContext] instead of [Verify]. 216 optional uint64 p_chain_height = 2; 217 } 218 219 message BlockVerifyResponse { 220 google.protobuf.Timestamp timestamp = 1; 221 } 222 223 message BlockAcceptRequest { 224 bytes id = 1; 225 } 226 227 message BlockRejectRequest { 228 bytes id = 1; 229 } 230 231 message HealthResponse { 232 bytes details = 1; 233 } 234 235 message VersionResponse { 236 string version = 1; 237 } 238 239 message AppRequestMsg { 240 // The node that sent us this request 241 bytes node_id = 1; 242 // The ID of this request 243 uint32 request_id = 2; 244 // deadline for this request 245 google.protobuf.Timestamp deadline = 3; 246 // The request body 247 bytes request = 4; 248 } 249 250 message AppRequestFailedMsg { 251 // The node that we failed to get a response from 252 bytes node_id = 1; 253 // The ID of the request we sent and didn't get a response to 254 uint32 request_id = 2; 255 // Application-defined error code 256 sint32 error_code = 3; 257 // Application-defined error message 258 string error_message = 4; 259 } 260 261 message AppResponseMsg { 262 // The node that we got a response from 263 bytes node_id = 1; 264 // Request ID of request that this is in response to 265 uint32 request_id = 2; 266 // The response body 267 bytes response = 3; 268 } 269 270 message AppGossipMsg { 271 // The node that sent us a gossip message 272 bytes node_id = 1; 273 // The message body 274 bytes msg = 2; 275 } 276 277 message ConnectedRequest { 278 bytes node_id = 1; 279 // Client name (e.g avalanchego) 280 string name = 2; 281 // Client semantic version 282 uint32 major = 3; 283 uint32 minor = 4; 284 uint32 patch = 5; 285 } 286 287 message DisconnectedRequest { 288 bytes node_id = 1; 289 } 290 291 message GetAncestorsRequest { 292 bytes blk_id = 1; 293 int32 max_blocks_num = 2; 294 int32 max_blocks_size = 3; 295 int64 max_blocks_retrival_time = 4; 296 } 297 298 message GetAncestorsResponse { 299 repeated bytes blks_bytes = 1; 300 } 301 302 message BatchedParseBlockRequest { 303 repeated bytes request = 1; 304 } 305 306 message BatchedParseBlockResponse { 307 repeated ParseBlockResponse response = 1; 308 } 309 310 message GetBlockIDAtHeightRequest { 311 uint64 height = 1; 312 } 313 314 message GetBlockIDAtHeightResponse { 315 bytes blk_id = 1; 316 Error err = 2; 317 } 318 319 message GatherResponse { 320 repeated io.prometheus.client.MetricFamily metric_families = 1; 321 } 322 323 message StateSyncEnabledResponse { 324 bool enabled = 1; 325 Error err = 2; 326 } 327 328 message GetOngoingSyncStateSummaryResponse { 329 bytes id = 1; 330 uint64 height = 2; 331 bytes bytes = 3; 332 Error err = 4; 333 } 334 335 message GetLastStateSummaryResponse { 336 bytes id = 1; 337 uint64 height = 2; 338 bytes bytes = 3; 339 Error err = 4; 340 } 341 342 message ParseStateSummaryRequest { 343 bytes bytes = 1; 344 } 345 346 message ParseStateSummaryResponse { 347 bytes id = 1; 348 uint64 height = 2; 349 Error err = 3; 350 } 351 352 message GetStateSummaryRequest { 353 uint64 height = 1; 354 } 355 356 message GetStateSummaryResponse { 357 bytes id = 1; 358 bytes bytes = 2; 359 Error err = 3; 360 } 361 362 message StateSummaryAcceptRequest { 363 bytes bytes = 1; 364 } 365 366 message StateSummaryAcceptResponse { 367 enum Mode { 368 MODE_UNSPECIFIED = 0; 369 MODE_SKIPPED = 1; 370 MODE_STATIC = 2; 371 MODE_DYNAMIC = 3; 372 } 373 Mode mode = 1; 374 Error err = 2; 375 }