v0.2.5-pre.009
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
// file: crates/ksp-onchain-transport-lib/src/rpc_blocks.rs
|
||||
// version: 6
|
||||
// version: 7
|
||||
|
||||
const MAX_GET_BLOCKS_RANGE: u64 = 500_000;
|
||||
const MAX_GET_RECENT_PERFORMANCE_SAMPLES: u64 = 720;
|
||||
|
||||
/// Transaction detail level accepted by modern `getBlock` requests.
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
|
||||
@@ -828,8 +831,85 @@ impl crate::HttpTransportPool {
|
||||
}
|
||||
}
|
||||
|
||||
const MAX_GET_BLOCKS_RANGE: u64 = 500_000;
|
||||
const MAX_GET_RECENT_PERFORMANCE_SAMPLES: u64 = 720;
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct WireBlockCommitment {
|
||||
commitment: std::option::Option<std::vec::Vec<u64>>,
|
||||
total_stake: u64,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct WireBlockProductionRange {
|
||||
first_slot: u64,
|
||||
last_slot: u64,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct WireBlockProduction {
|
||||
by_identity: std::collections::BTreeMap<std::string::String, (usize, usize)>,
|
||||
range: WireBlockProductionRange,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
struct WireBlockProductionRpcResponse {
|
||||
context: serde_json::Value,
|
||||
value: serde_json::Value,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct WireBlockReward {
|
||||
pubkey: std::string::String,
|
||||
lamports: i64,
|
||||
post_balance: u64,
|
||||
#[serde(default)]
|
||||
reward_type: std::option::Option<std::string::String>,
|
||||
#[serde(default)]
|
||||
commission: std::option::Option<u8>,
|
||||
#[serde(default)]
|
||||
commission_bps: crate::SolanaWireField<u16>,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct WireBlockTransaction {
|
||||
transaction: serde_json::Value,
|
||||
#[serde(default)]
|
||||
meta: crate::SolanaWireField<serde_json::Value>,
|
||||
#[serde(default)]
|
||||
version: crate::SolanaWireField<serde_json::Value>,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct WireConfirmedBlock {
|
||||
previous_blockhash: std::string::String,
|
||||
blockhash: std::string::String,
|
||||
parent_slot: u64,
|
||||
#[serde(default)]
|
||||
transactions: crate::SolanaWireField<std::vec::Vec<serde_json::Value>>,
|
||||
#[serde(default)]
|
||||
signatures: crate::SolanaWireField<std::vec::Vec<std::string::String>>,
|
||||
#[serde(default)]
|
||||
rewards: crate::SolanaWireField<std::vec::Vec<serde_json::Value>>,
|
||||
#[serde(default)]
|
||||
num_reward_partitions: crate::SolanaWireField<u64>,
|
||||
block_time: std::option::Option<i64>,
|
||||
block_height: std::option::Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct WirePerformanceSample {
|
||||
slot: u64,
|
||||
num_transactions: u64,
|
||||
#[serde(default)]
|
||||
num_non_vote_transactions: std::option::Option<u64>,
|
||||
num_slots: u64,
|
||||
sample_period_secs: u16,
|
||||
}
|
||||
|
||||
fn validate_blocks_context_commitment(method: &'static str, config: std::option::Option<&crate::SolanaContextConfig>) -> ksp_core_lib::Result<()> {
|
||||
if let std::option::Option::Some(config) = config
|
||||
@@ -978,86 +1058,6 @@ fn decode_block_rewards(
|
||||
return std::result::Result::Ok(crate::SolanaWireField::Value(rewards));
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct WireBlockCommitment {
|
||||
commitment: std::option::Option<std::vec::Vec<u64>>,
|
||||
total_stake: u64,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct WireBlockProductionRange {
|
||||
first_slot: u64,
|
||||
last_slot: u64,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct WireBlockProduction {
|
||||
by_identity: std::collections::BTreeMap<std::string::String, (usize, usize)>,
|
||||
range: WireBlockProductionRange,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
struct WireBlockProductionRpcResponse {
|
||||
context: serde_json::Value,
|
||||
value: serde_json::Value,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct WireBlockReward {
|
||||
pubkey: std::string::String,
|
||||
lamports: i64,
|
||||
post_balance: u64,
|
||||
#[serde(default)]
|
||||
reward_type: std::option::Option<std::string::String>,
|
||||
#[serde(default)]
|
||||
commission: std::option::Option<u8>,
|
||||
#[serde(default)]
|
||||
commission_bps: crate::SolanaWireField<u16>,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct WireBlockTransaction {
|
||||
transaction: serde_json::Value,
|
||||
#[serde(default)]
|
||||
meta: crate::SolanaWireField<serde_json::Value>,
|
||||
#[serde(default)]
|
||||
version: crate::SolanaWireField<serde_json::Value>,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct WireConfirmedBlock {
|
||||
previous_blockhash: std::string::String,
|
||||
blockhash: std::string::String,
|
||||
parent_slot: u64,
|
||||
#[serde(default)]
|
||||
transactions: crate::SolanaWireField<std::vec::Vec<serde_json::Value>>,
|
||||
#[serde(default)]
|
||||
signatures: crate::SolanaWireField<std::vec::Vec<std::string::String>>,
|
||||
#[serde(default)]
|
||||
rewards: crate::SolanaWireField<std::vec::Vec<serde_json::Value>>,
|
||||
#[serde(default)]
|
||||
num_reward_partitions: crate::SolanaWireField<u64>,
|
||||
block_time: std::option::Option<i64>,
|
||||
block_height: std::option::Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct WirePerformanceSample {
|
||||
slot: u64,
|
||||
num_transactions: u64,
|
||||
#[serde(default)]
|
||||
num_non_vote_transactions: std::option::Option<u64>,
|
||||
num_slots: u64,
|
||||
sample_period_secs: u16,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "../unit_tests/rpc_blocks.rs"]
|
||||
mod tests;
|
||||
|
||||
Reference in New Issue
Block a user