Skip to main content

bulk_client/msgs/
meta.rs

1use crate::msgs::sig_bytes;
2use crate::transaction::ActionMeta;
3use serde::{Deserialize, Serialize};
4use solana_keypair::Pubkey;
5use std::sync::Arc;
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/// WarmJoin protocol: a validator announces it has caught up and is ready to vote.
39///
40/// System-internal transaction (like Beacon). Not a user order.
41/// Authentication is via the BulkTransaction signer — verified against the
42/// preconfigured validator pubkey map before consensus processes the join.
43///
44/// `committed_round` is the node's last committed round at emission time.
45/// Re-emitted join TXs naturally hash differently, preventing dedup stalls.
46#[derive(Clone, Debug, Serialize, Deserialize)]
47pub struct Join {
48    pub node_id: u16,
49    pub committed_round: u64,
50
51    #[serde(skip)]
52    pub meta: ActionMeta,
53}
54
55/// Add new market tx
56#[derive(Clone, Debug, Serialize, Deserialize)]
57pub struct AddMarket {
58    #[serde(rename = "c")]
59    pub symbol: Arc<str>,
60
61    #[serde(skip)]
62    pub meta: ActionMeta,
63}
64
65/// Opaque wrapper for special tx
66#[derive(Clone, Debug, Serialize, Deserialize)]
67pub struct OpaqueAction {
68    pub payload: Vec<u8>,
69
70    #[serde(skip)]
71    pub meta: ActionMeta,
72}
73
74/// A single admin's ed25519 signature over the `UpdateValidatorSet` message digest.
75#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
76pub struct AdminSignature {
77    pub admin_index: u8,
78    #[serde(with = "sig_bytes")]
79    pub signature: [u8; 64],
80}
81
82/// Delta-form admin-signed validator-set mutation.
83///
84/// Adds already in the set and removes not in the set are no-ops. A pubkey
85/// appearing in both `added` and `removed` rejects the tx. `version` must
86/// equal the current `ValidatorSet` version + 1.
87///
88/// Threshold-signed by `ADMIN_THRESHOLD` of `ADMIN_PUBKEYS`. Verification
89/// and activation live in `bulk_consensus_proto::admin_txn`.
90#[derive(Clone, Debug, Serialize, Deserialize)]
91pub struct UpdateValidatorSet {
92    pub added: Vec<Pubkey>,
93    pub removed: Vec<Pubkey>,
94    pub version: u64,
95    pub admin_sigs: Vec<AdminSignature>,
96
97    #[serde(skip)]
98    pub meta: ActionMeta,
99}