zksync_protobuf_config 0.1.0

Protobuf deserialization for ZKsync configs
Documentation
// For config readability and ease of use, some of the primitive types are
// encoded as strings. Fields of these types have a comment with the name of the type.
// Here is the list of string-encoded types and their corresponding string formats:
//
// IpAddr - TCP socket address, encoded as a string of the form "IP:port".
//   Both IPv4 and IPv6 are supported
//   (note that opening IPv6 ports may not work depending on the VM capabilities).
//   examples: "203.0.113.7:3456", "[2001:DB8::1]:4567"
//
// Host - network address in the `<domain/ip>:port` format.
// 
// ValidatorPublicKey - public key of the validator (consensus participant) of the form "validator:public:<signature scheme>:<hex encoded key material>"
//   Currently only bn254 signature scheme is supported for validators.
//   example: "validator:public:bn254:4b0c4697f0a35eab30f63684ae4611f3c1d631eecfd97237e2345a9b3d0c472dbb16c49b793beceaab0cdd89cda6ff1099bd1aaf1ad6cabde9a15793cc09b407"
//
// NodePublicKey - public key of the node (gossip network participant) of the form "node:public:<signature scheme>:<hex encoded key material>"
//   Currently only ed25519 signature scheme is supported for nodes.
//   example: "node:public:ed25519:d36607699a0a3fbe3de16947928cf299484219ff62ca20f387795b0859dbe501"
//
// ValidatorSecretKey - secret key of the validator (consensus participant) of the form "validator:secret:<signature scheme>:<hex encoded key material>"
//   Currently only bn254 signature scheme is supported for validators.
//   example: "validator:secret:bn254:1aaa9c2c5a4f0f75b79127a7207348e33df55869d79622eccf65c91c98861257"
//
// NodeSecretKey - secret key of the node (gossip network participant) of the form "node:secret:<signature scheme>:<hex encoded key material>"
//   Currently only ed25519 signature scheme is supported for nodes.
//   example: "node:secret:ed25519:4f761350f4b038f8052d17f0a02e18782be66f16d407e7a073c925d52dcc8f02"

syntax = "proto3";

package zksync.core.consensus;

import "zksync/std.proto";

// (public key, ip address) of a gossip network node.
message NodeAddr {
  optional string key = 1; // required; NodePublicKey
  optional string addr = 2; // required; IpAddr
}

// Weighted member of a validator committee. 
message WeightedValidator {
  optional string key = 1; // required; ValidatorPublicKey
  optional uint64 weight = 2; // required
}

// Weighted member of an attester committee. 
message WeightedAttester {
  optional string key = 1; // required; AttesterPublic
  optional uint64 weight = 2; // required
}

// Consensus genesis specification.
message GenesisSpec {
  optional uint64 chain_id = 1; // required; L2ChainId, should be the same as `l2_chain_id` in the `zksync.config.genesis.Genesis`.
  optional uint32 protocol_version = 2; // required; validator::ProtocolVersion
  repeated WeightedValidator validators = 3; // must be non-empty; validator committee.
  optional string leader = 4; // required; ValidatorPublicKey
  repeated WeightedAttester attesters = 5; // can be empty; attester committee.
}

// Per peer connection RPC rate limits.
message RpcConfig {
  optional std.RateLimit get_block_rate = 1; // optional; defaults to 10 blocks/s.
}

message Config {
  reserved 3;
  reserved "validators";

  // IP:port to listen on, for incoming TCP connections.
  // Use `0.0.0.0:<port>` to listen on all network interfaces (i.e. on all IPs exposed by this VM).
  optional string server_addr = 1; // required; IpAddr

  // Public IP:port to advertise, should forward to server_addr.
  // Can be `127.0.0.1:<port>` for local tests.
  optional string public_addr = 2; // required; Host

  // Maximal allowed size of the payload.
  optional uint64 max_payload_size = 4; // required; bytes

  // Maximal allowed size of the sync batches.
  optional uint64 max_batch_size = 10; // required; bytes

  // Inbound connections that should be unconditionally accepted on the gossip network.
  repeated string gossip_static_inbound = 5; // required; NodePublicKey

  // Limit on the number of gossip network inbound connections outside
  // of the `gossip_static_inbound` set.
  optional uint64 gossip_dynamic_inbound_limit = 6; // required

  // Outbound gossip network connections that the node should actively try to
  // establish and maintain.
  repeated NodeAddr gossip_static_outbound = 7;

  // MAIN NODE ONLY: consensus genesis specification.
  // Used to (re)initialize genesis if needed.
  // External nodes fetch the genesis from the main node.
  optional GenesisSpec genesis_spec = 8;

  // RPC rate limits configuration.
  // If missing, defaults are used.
  optional RpcConfig rpc_config = 9; // optional
}