Skip to main content

bulk_client/msgs/
meta.rs

1use crate::msgs::sig_bytes;
2use std::sync::Arc;
3use serde::{Deserialize, Serialize};
4use solana_keypair::Pubkey;
5use crate::transaction::ActionMeta;
6
7/// Per-market configuration returned by the exchange.
8#[derive(Debug, Clone, Deserialize)]
9#[serde(rename_all = "camelCase")]
10#[allow(unused)]
11pub struct MarketInfo {
12    pub symbol: String,
13    pub base_asset: String,
14    pub quote_asset: String,
15    pub status: String,
16    pub price_precision: u32,
17    pub size_precision: u32,
18    pub tick_size: f64,
19    pub lot_size: f64,
20    pub min_notional: f64,
21    pub max_leverage: f64,
22    pub order_types: Vec<String>,
23    pub time_in_forces: Vec<String>,
24}
25
26/// Beacon tx
27#[derive(Clone, Debug, Deserialize, Serialize)]
28pub struct Beacon {
29    pub epoch: u32,
30    pub node_id: u16,
31    pub wall_clock_ns: u64,
32    pub since_commit_us: u64,
33
34    #[serde(skip)]
35    pub meta: ActionMeta,
36}
37
38
39/// WarmJoin protocol: a validator announces it has caught up and is ready to vote.
40///
41/// System-internal transaction (like Beacon). Not a user order.
42/// Authentication is via the BulkTransaction signer — verified against the
43/// preconfigured validator pubkey map before consensus processes the join.
44///
45/// `committed_round` is the node's last committed round at emission time.
46/// Re-emitted join TXs naturally hash differently, preventing dedup stalls.
47#[derive(Clone, Debug, Serialize, Deserialize)]
48pub struct Join {
49    pub node_id: u16,
50    pub committed_round: u64,
51
52    #[serde(skip)]
53    pub meta: ActionMeta,
54}
55
56
57/// Add new market tx
58#[derive(Clone, Debug, Serialize, Deserialize)]
59pub struct AddMarket {
60    #[serde(rename = "c")]
61    pub symbol: Arc<str>,
62
63    #[serde(skip)]
64    pub meta: ActionMeta,
65}
66
67/// Opaque wrapper for special tx
68#[derive(Clone, Debug, Serialize, Deserialize)]
69pub struct OpaqueAction {
70    pub payload: Vec<u8>,
71
72    #[serde(skip)]
73    pub meta: ActionMeta,
74}
75
76/// A single admin's ed25519 signature over the `UpdateValidatorSet` message digest.
77#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
78pub struct AdminSignature {
79    pub admin_index: u8,
80    #[serde(with = "sig_bytes")]
81    pub signature: [u8; 64],
82}
83
84/// Delta-form admin-signed validator-set mutation.
85///
86/// Adds already in the set and removes not in the set are no-ops. A pubkey
87/// appearing in both `added` and `removed` rejects the tx. `version` must
88/// equal the current `ValidatorSet` version + 1.
89///
90/// Threshold-signed by `ADMIN_THRESHOLD` of `ADMIN_PUBKEYS`. Verification
91/// and activation live in `bulk_consensus_proto::admin_txn`.
92#[derive(Clone, Debug, Serialize, Deserialize)]
93pub struct UpdateValidatorSet {
94    pub added: Vec<Pubkey>,
95    pub removed: Vec<Pubkey>,
96    pub version: u64,
97    pub admin_sigs: Vec<AdminSignature>,
98
99    #[serde(skip)]
100    pub meta: ActionMeta,
101}