Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump enum-iterator from 0.8.1 to 1.4.0 #15

Open
wants to merge 2 commits into
base: v1.14-geyser-block-v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions core/src/replay_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2600,11 +2600,14 @@ impl ReplayStage {
if let Some(ref block_metadata_notifier) = block_metadata_notifier {
let block_metadata_notifier = block_metadata_notifier.read().unwrap();
block_metadata_notifier.notify_block_metadata(
bank.parent_slot(),
&bank.parent_hash().to_string(),
bank.slot(),
&bank.last_blockhash().to_string(),
&bank.rewards,
Some(bank.clock().unix_timestamp),
Some(bank.block_height()),
bank.executed_transaction_count(),
)
}
bank_complete_time.stop();
Expand Down
14 changes: 14 additions & 0 deletions geyser-plugin-interface/src/geyser_plugin_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,22 @@ pub struct ReplicaBlockInfo<'a> {
pub block_height: Option<u64>,
}

/// Extending ReplicaBlockInfo by sending the transaction_entries_count.
#[derive(Clone, Debug)]
pub struct ReplicaBlockInfoV2<'a> {
pub parent_slot: u64,
pub parent_blockhash: &'a str,
pub slot: u64,
pub blockhash: &'a str,
pub rewards: &'a [Reward],
pub block_time: Option<UnixTimestamp>,
pub block_height: Option<u64>,
pub executed_transaction_count: u64,
}

pub enum ReplicaBlockInfoVersions<'a> {
V0_0_1(&'a ReplicaBlockInfo<'a>),
V0_0_2(&'a ReplicaBlockInfoV2<'a>),
}

/// Errors returned by plugin calls
Expand Down
29 changes: 23 additions & 6 deletions geyser-plugin-manager/src/block_metadata_notifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use {
},
log::*,
solana_geyser_plugin_interface::geyser_plugin_interface::{
ReplicaBlockInfo, ReplicaBlockInfoVersions,
ReplicaBlockInfoV2, ReplicaBlockInfoVersions,
},
solana_measure::measure::Measure,
solana_metrics::*,
Expand All @@ -23,11 +23,14 @@ impl BlockMetadataNotifier for BlockMetadataNotifierImpl {
/// Notify the block metadata
fn notify_block_metadata(
&self,
parent_slot: u64,
parent_blockhash: &str,
slot: u64,
blockhash: &str,
rewards: &RwLock<Vec<(Pubkey, RewardInfo)>>,
block_time: Option<UnixTimestamp>,
block_height: Option<u64>,
executed_transaction_count: u64,
) {
let mut plugin_manager = self.plugin_manager.write().unwrap();
if plugin_manager.plugins.is_empty() {
Expand All @@ -37,9 +40,17 @@ impl BlockMetadataNotifier for BlockMetadataNotifierImpl {

for plugin in plugin_manager.plugins.iter_mut() {
let mut measure = Measure::start("geyser-plugin-update-slot");
let block_info =
Self::build_replica_block_info(slot, blockhash, &rewards, block_time, block_height);
let block_info = ReplicaBlockInfoVersions::V0_0_1(&block_info);
let block_info = Self::build_replica_block_info(
parent_slot,
parent_blockhash,
slot,
blockhash,
&rewards,
block_time,
block_height,
executed_transaction_count,
);
let block_info = ReplicaBlockInfoVersions::V0_0_2(&block_info);
match plugin.notify_block_metadata(block_info) {
Err(err) => {
error!(
Expand Down Expand Up @@ -84,18 +95,24 @@ impl BlockMetadataNotifierImpl {
}

fn build_replica_block_info<'a>(
parent_slot: u64,
parent_blockhash: &'a str,
slot: u64,
blockhash: &'a str,
rewards: &'a [Reward],
block_time: Option<UnixTimestamp>,
block_height: Option<u64>,
) -> ReplicaBlockInfo<'a> {
ReplicaBlockInfo {
executed_transaction_count: u64,
) -> ReplicaBlockInfoV2<'a> {
ReplicaBlockInfoV2 {
parent_slot,
parent_blockhash,
slot,
blockhash,
rewards,
block_time,
block_height,
executed_transaction_count,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ pub trait BlockMetadataNotifier {
/// Notify the block metadata
fn notify_block_metadata(
&self,
parent_slot: u64,
parent_blockhash: &str,
slot: u64,
blockhash: &str,
rewards: &RwLock<Vec<(Pubkey, RewardInfo)>>,
block_time: Option<UnixTimestamp>,
block_height: Option<u64>,
executed_transaction_count: u64,
);
}

Expand Down
6 changes: 6 additions & 0 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6542,6 +6542,12 @@ impl Bank {
self.transaction_count.load(Relaxed)
}

/// Return the transaction count executed only in this bank
pub fn executed_transaction_count(&self) -> u64 {
self.transaction_count()
.saturating_sub(self.parent().map_or(0, |parent| parent.transaction_count()))
}

pub fn transaction_error_count(&self) -> u64 {
self.transaction_error_count.load(Relaxed)
}
Expand Down
2 changes: 1 addition & 1 deletion storage-bigtable/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ backoff = { version = "0.4.0", features = ["tokio"] }
bincode = "1.3.3"
bytes = "1.0"
bzip2 = "0.4.4"
enum-iterator = "0.8.1"
enum-iterator = "1.4.0"
flate2 = "1.0.24"
futures = "0.3.21"
goauth = "0.13.0"
Expand Down
2 changes: 1 addition & 1 deletion storage-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ solana-sdk = { path = "../sdk", version = "=1.14.15" }
solana-transaction-status = { path = "../transaction-status", version = "=1.14.15" }

[dev-dependencies]
enum-iterator = "0.8.1"
enum-iterator = "1.4.0"

[lib]
crate-type = ["lib"]
Expand Down