github.com/MetalBlockchain/metalgo@v1.11.9/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    rpc CrossChainAppRequest(CrossChainAppRequestMsg) returns (google.protobuf.Empty);
    51    rpc CrossChainAppRequestFailed(CrossChainAppRequestFailedMsg) returns (google.protobuf.Empty);
    52    rpc CrossChainAppResponse(CrossChainAppResponseMsg) returns (google.protobuf.Empty);
    53  
    54    // BatchedChainVM
    55    rpc GetAncestors(GetAncestorsRequest) returns (GetAncestorsResponse);
    56    rpc BatchedParseBlock(BatchedParseBlockRequest) returns (BatchedParseBlockResponse);
    57  
    58    // HeightIndexedChainVM
    59    rpc GetBlockIDAtHeight(GetBlockIDAtHeightRequest) returns (GetBlockIDAtHeightResponse);
    60  
    61    // StateSyncableVM
    62    //
    63    // StateSyncEnabled indicates whether the state sync is enabled for this VM.
    64    rpc StateSyncEnabled(google.protobuf.Empty) returns (StateSyncEnabledResponse);
    65    // GetOngoingSyncStateSummary returns an in-progress state summary if it exists.
    66    rpc GetOngoingSyncStateSummary(google.protobuf.Empty) returns (GetOngoingSyncStateSummaryResponse);
    67    // GetLastStateSummary returns the latest state summary.
    68    rpc GetLastStateSummary(google.protobuf.Empty) returns (GetLastStateSummaryResponse);
    69    // ParseStateSummary parses a state summary out of [summaryBytes].
    70    rpc ParseStateSummary(ParseStateSummaryRequest) returns (ParseStateSummaryResponse);
    71    // GetStateSummary retrieves the state summary that was generated at height
    72    // [summaryHeight].
    73    rpc GetStateSummary(GetStateSummaryRequest) returns (GetStateSummaryResponse);
    74  
    75    // Block
    76    rpc BlockVerify(BlockVerifyRequest) returns (BlockVerifyResponse);
    77    rpc BlockAccept(BlockAcceptRequest) returns (google.protobuf.Empty);
    78    rpc BlockReject(BlockRejectRequest) returns (google.protobuf.Empty);
    79  
    80    // StateSummary
    81    rpc StateSummaryAccept(StateSummaryAcceptRequest) returns (StateSummaryAcceptResponse);
    82  }
    83  
    84  enum State {
    85    STATE_UNSPECIFIED = 0;
    86    STATE_STATE_SYNCING = 1;
    87    STATE_BOOTSTRAPPING = 2;
    88    STATE_NORMAL_OP = 3;
    89  }
    90  
    91  enum Status {
    92    STATUS_UNSPECIFIED = 0;
    93    STATUS_PROCESSING = 1;
    94    STATUS_REJECTED = 2;
    95    STATUS_ACCEPTED = 3;
    96  }
    97  
    98  enum Error {
    99    // ERROR_UNSPECIFIED is used to indicate that no error occurred.
   100    ERROR_UNSPECIFIED = 0;
   101    ERROR_CLOSED = 1;
   102    ERROR_NOT_FOUND = 2;
   103    ERROR_STATE_SYNC_NOT_IMPLEMENTED = 3;
   104  }
   105  
   106  message InitializeRequest {
   107    uint32 network_id = 1;
   108    bytes subnet_id = 2;
   109    bytes chain_id = 3;
   110    bytes node_id = 4;
   111    // public_key is the BLS public key that would correspond with any signatures
   112    // produced by the warp messaging signer
   113    bytes public_key = 5;
   114    bytes x_chain_id = 6;
   115    bytes c_chain_id = 7;
   116    bytes avax_asset_id = 8;
   117    string chain_data_dir = 9;
   118    bytes genesis_bytes = 10;
   119    bytes upgrade_bytes = 11;
   120    bytes config_bytes = 12;
   121    string db_server_addr = 13;
   122    // server_addr is the address of the gRPC server which serves
   123    // the messenger, keystore, shared memory, blockchain alias,
   124    // subnet alias, and appSender services
   125    string server_addr = 14;
   126  }
   127  
   128  message InitializeResponse {
   129    bytes last_accepted_id = 1;
   130    bytes last_accepted_parent_id = 2;
   131    uint64 height = 3;
   132    bytes bytes = 4;
   133    google.protobuf.Timestamp timestamp = 5;
   134  }
   135  
   136  message SetStateRequest {
   137    State state = 1;
   138  }
   139  
   140  message SetStateResponse {
   141    bytes last_accepted_id = 1;
   142    bytes last_accepted_parent_id = 2;
   143    uint64 height = 3;
   144    bytes bytes = 4;
   145    google.protobuf.Timestamp timestamp = 5;
   146  }
   147  
   148  message CreateHandlersResponse {
   149    repeated Handler handlers = 1;
   150  }
   151  
   152  message Handler {
   153    string prefix = 1;
   154    // server_addr is the address of the gRPC server which serves the
   155    // HTTP service
   156    string server_addr = 2;
   157  }
   158  
   159  message BuildBlockRequest {
   160    optional uint64 p_chain_height = 1;
   161  }
   162  
   163  // Note: The status of a freshly built block is assumed to be Processing.
   164  message BuildBlockResponse {
   165    bytes id = 1;
   166    bytes parent_id = 2;
   167    bytes bytes = 3;
   168    uint64 height = 4;
   169    google.protobuf.Timestamp timestamp = 5;
   170    bool verify_with_context = 6;
   171  }
   172  
   173  message ParseBlockRequest {
   174    bytes bytes = 1;
   175  }
   176  
   177  message ParseBlockResponse {
   178    bytes id = 1;
   179    bytes parent_id = 2;
   180    Status status = 3;
   181    uint64 height = 4;
   182    google.protobuf.Timestamp timestamp = 5;
   183    bool verify_with_context = 6;
   184  }
   185  
   186  message GetBlockRequest {
   187    bytes id = 1;
   188  }
   189  
   190  message GetBlockResponse {
   191    bytes parent_id = 1;
   192    bytes bytes = 2;
   193    Status status = 3;
   194    uint64 height = 4;
   195    google.protobuf.Timestamp timestamp = 5;
   196    // used to propagate database.ErrNotFound through RPC
   197    Error err = 6;
   198    bool verify_with_context = 7;
   199  }
   200  
   201  message SetPreferenceRequest {
   202    bytes id = 1;
   203  }
   204  
   205  message BlockVerifyRequest {
   206    bytes bytes = 1;
   207  
   208    // If set, the VM server casts the block to a [block.WithVerifyContext] and
   209    // calls [VerifyWithContext] instead of [Verify].
   210    optional uint64 p_chain_height = 2;
   211  }
   212  
   213  message BlockVerifyResponse {
   214    google.protobuf.Timestamp timestamp = 1;
   215  }
   216  
   217  message BlockAcceptRequest {
   218    bytes id = 1;
   219  }
   220  
   221  message BlockRejectRequest {
   222    bytes id = 1;
   223  }
   224  
   225  message HealthResponse {
   226    bytes details = 1;
   227  }
   228  
   229  message VersionResponse {
   230    string version = 1;
   231  }
   232  
   233  message AppRequestMsg {
   234    // The node that sent us this request
   235    bytes node_id = 1;
   236    // The ID of this request
   237    uint32 request_id = 2;
   238    // deadline for this request
   239    google.protobuf.Timestamp deadline = 3;
   240    // The request body
   241    bytes request = 4;
   242  }
   243  
   244  message AppRequestFailedMsg {
   245    // The node that we failed to get a response from
   246    bytes node_id = 1;
   247    // The ID of the request we sent and didn't get a response to
   248    uint32 request_id = 2;
   249    // Application-defined error code
   250    sint32 error_code = 3;
   251    // Application-defined error message
   252    string error_message = 4;
   253  }
   254  
   255  message AppResponseMsg {
   256    // The node that we got a response from
   257    bytes node_id = 1;
   258    // Request ID of request that this is in response to
   259    uint32 request_id = 2;
   260    // The response body
   261    bytes response = 3;
   262  }
   263  
   264  message AppGossipMsg {
   265    // The node that sent us a gossip message
   266    bytes node_id = 1;
   267    // The message body
   268    bytes msg = 2;
   269  }
   270  
   271  message CrossChainAppRequestMsg {
   272    // The chain that sent us this request
   273    bytes chain_id = 1;
   274    // The ID of this request
   275    uint32 request_id = 2;
   276    // deadline for this request
   277    google.protobuf.Timestamp deadline = 3;
   278    // The request body
   279    bytes request = 4;
   280  }
   281  
   282  message CrossChainAppRequestFailedMsg {
   283    // The chain that we failed to get a response from
   284    bytes chain_id = 1;
   285    // The ID of the request we sent and didn't get a response to
   286    uint32 request_id = 2;
   287    // Application-defined error code
   288    sint32 error_code = 3;
   289    // Application-defined error message
   290    string error_message = 4;
   291  }
   292  
   293  message CrossChainAppResponseMsg {
   294    // The chain that we got a response from
   295    bytes chain_id = 1;
   296    // Request ID of request that this is in response to
   297    uint32 request_id = 2;
   298    // The response body
   299    bytes response = 3;
   300  }
   301  
   302  message ConnectedRequest {
   303    bytes node_id = 1;
   304    // Client name (e.g avalanchego)
   305    string name = 2;
   306    // Client semantic version
   307    uint32 major = 3;
   308    uint32 minor = 4;
   309    uint32 patch = 5;
   310  }
   311  
   312  message DisconnectedRequest {
   313    bytes node_id = 1;
   314  }
   315  
   316  message GetAncestorsRequest {
   317    bytes blk_id = 1;
   318    int32 max_blocks_num = 2;
   319    int32 max_blocks_size = 3;
   320    int64 max_blocks_retrival_time = 4;
   321  }
   322  
   323  message GetAncestorsResponse {
   324    repeated bytes blks_bytes = 1;
   325  }
   326  
   327  message BatchedParseBlockRequest {
   328    repeated bytes request = 1;
   329  }
   330  
   331  message BatchedParseBlockResponse {
   332    repeated ParseBlockResponse response = 1;
   333  }
   334  
   335  message GetBlockIDAtHeightRequest {
   336    uint64 height = 1;
   337  }
   338  
   339  message GetBlockIDAtHeightResponse {
   340    bytes blk_id = 1;
   341    Error err = 2;
   342  }
   343  
   344  message GatherResponse {
   345    repeated io.prometheus.client.MetricFamily metric_families = 1;
   346  }
   347  
   348  message StateSyncEnabledResponse {
   349    bool enabled = 1;
   350    Error err = 2;
   351  }
   352  
   353  message GetOngoingSyncStateSummaryResponse {
   354    bytes id = 1;
   355    uint64 height = 2;
   356    bytes bytes = 3;
   357    Error err = 4;
   358  }
   359  
   360  message GetLastStateSummaryResponse {
   361    bytes id = 1;
   362    uint64 height = 2;
   363    bytes bytes = 3;
   364    Error err = 4;
   365  }
   366  
   367  message ParseStateSummaryRequest {
   368    bytes bytes = 1;
   369  }
   370  
   371  message ParseStateSummaryResponse {
   372    bytes id = 1;
   373    uint64 height = 2;
   374    Error err = 3;
   375  }
   376  
   377  message GetStateSummaryRequest {
   378    uint64 height = 1;
   379  }
   380  
   381  message GetStateSummaryResponse {
   382    bytes id = 1;
   383    bytes bytes = 2;
   384    Error err = 3;
   385  }
   386  
   387  message StateSummaryAcceptRequest {
   388    bytes bytes = 1;
   389  }
   390  
   391  message StateSummaryAcceptResponse {
   392    enum Mode {
   393      MODE_UNSPECIFIED = 0;
   394      MODE_SKIPPED = 1;
   395      MODE_STATIC = 2;
   396      MODE_DYNAMIC = 3;
   397    }
   398    Mode mode = 1;
   399    Error err = 2;
   400  }