f1r3fly-models 0.1.0

Common data model types for the F1r3fly blockchain, including protobuf definitions and Rust implementations
Documentation
syntax = "proto3";
package routing;

// If you are building for other languages "scalapb.proto"
// can be manually obtained here:
// https://raw.githubusercontent.com/scalapb/ScalaPB/master/protobuf/scalapb/scalapb.proto
// make a scalapb directory in this file's location and place it inside

import "scalapb/scalapb.proto";

option (scalapb.options) = {
  package_name: "coop.rchain.comm.protocol.routing"
  flat_package: true
  preserve_unknown_fields: false
};

message Node {
    bytes  id       = 1;
    bytes  host     = 2;
    uint32 tcp_port = 3;
    uint32 udp_port = 4;
}

message Header {
  Node   sender         = 1 [(scalapb.field).no_box = true];
  string networkId      = 2;
}

message Heartbeat {
}

message HeartbeatResponse {
}

message ProtocolHandshake {
  bytes nonce       = 1;
}

message ProtocolHandshakeResponse {
  bytes nonce       = 1;
}

message Packet {
  string typeId  = 1;
  bytes  content = 2;
}

message Disconnect {
}

message Protocol {
    Header header                                                 = 1 [(scalapb.field).no_box = true];
    oneof message {
        Heartbeat                   heartbeat                     = 2;
        ProtocolHandshake           protocol_handshake            = 3;
        ProtocolHandshakeResponse   protocol_handshake_response   = 4;
        Packet                      packet                        = 5;
        Disconnect                  disconnect                    = 6;
    }
}

service TransportLayer {
  rpc Send (TLRequest) returns (TLResponse) {}
  rpc Stream (stream Chunk) returns (TLResponse) {}
}

message TLRequest {
  Protocol protocol = 1 [(scalapb.field).no_box = true];
}

message InternalServerError {
  bytes error = 1;
}

message Ack {
    Header header = 1 [(scalapb.field).no_box = true];
}

message TLResponse {
  oneof payload {
    Ack ack                                 = 1;
    InternalServerError internalServerError = 2;
  }
}

message ChunkHeader {
  Node   sender             = 1 [(scalapb.field).no_box = true];
  string typeId             = 2;
  bool   compressed         = 3;
  int32  contentLength      = 4;
  string networkId          = 5;
}

message ChunkData {
  bytes contentData = 1;
}

message Chunk {
  oneof content {
    ChunkHeader header = 1;
    ChunkData   data   = 2;
  }
}