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

Add support for agave validator 2.0.15 #1

Open
wants to merge 3 commits into
base: master
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
26 changes: 13 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ authors = ["Solana Maintainers <[email protected]>"]
edition = "2021"
name = "solana-geyser-plugin-postgres"
description = "The Solana AccountsDb plugin for PostgreSQL database."
version = "1.17.3"
version = "2.0.15"
repository = "https://github.com/solana-labs/solana-accountsdb-plugin-postgres"
license = "Apache-2.0"
homepage = "https://solana.com/"
Expand All @@ -25,13 +25,13 @@ postgres-openssl = { version = "0.5.0"}
serde = "1.0.145"
serde_derive = "1.0.145"
serde_json = "1.0.85"
solana-geyser-plugin-interface = { version = "=1.17.3" }
solana-logger = { version = "1.17.3" }
solana-measure = { version = "1.17.3" }
solana-metrics = { version = "1.17.3" }
solana-runtime = { version = "1.17.3" }
solana-sdk = { version = "1.17.3" }
solana-transaction-status = { version = "1.17.3" }
agave-geyser-plugin-interface = { version = "=2.0.15" }
solana-logger = { version = "2.0.15" }
solana-measure = { version = "2.0.15" }
solana-metrics = { version = "2.0.15" }
solana-runtime = { version = "2.0.15" }
solana-sdk = { version = "2.0.15" }
solana-transaction-status = { version = "2.0.15" }
thiserror = "1.0.37"
tokio-postgres = "0.7.7"

Expand All @@ -41,11 +41,11 @@ libloading = "0.7.3"
serial_test = "0.9.0"
socket2 = { version = "0.4.7", features = ["all"] }

solana-account-decoder = { version = "1.17.3" }
solana-core = { version = "1.17.3" }
solana-local-cluster = { version = "1.17.3" }
solana-net-utils = { version = "1.17.3" }
solana-streamer = { version = "1.17.3" }
solana-account-decoder = { version = "2.0.15" }
solana-core = { version = "2.0.15" }
solana-local-cluster = { version = "2.0.15" }
solana-net-utils = { version = "2.0.15" }
solana-streamer = { version = "2.0.15" }
tempfile = "3.3.0"

[package.metadata.docs.rs]
Expand Down
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "1.78.0"
11 changes: 8 additions & 3 deletions src/geyser_plugin_postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use {
log::*,
serde_derive::{Deserialize, Serialize},
serde_json,
solana_geyser_plugin_interface::geyser_plugin_interface::{
agave_geyser_plugin_interface::geyser_plugin_interface::{
GeyserPlugin, GeyserPluginError, ReplicaAccountInfoVersions, ReplicaBlockInfoVersions,
ReplicaTransactionInfoVersions, Result, SlotStatus,
},
Expand Down Expand Up @@ -168,7 +168,7 @@ impl GeyserPlugin for GeyserPluginPostgres {
/// }
/// }

fn on_load(&mut self, config_file: &str) -> Result<()> {
fn on_load(&mut self, config_file: &str, _is_reload: bool) -> Result<()> {
solana_logger::setup_with_default("info");
info!(
"Loading plugin {:?} from config_file {:?}",
Expand Down Expand Up @@ -414,7 +414,7 @@ impl GeyserPlugin for GeyserPluginPostgres {
)));
}
Some(client) => match block_info {
ReplicaBlockInfoVersions::V0_0_3(block_info) => {
ReplicaBlockInfoVersions::V0_0_4(block_info) => {
let result = client.update_block_metadata(block_info);

if let Err(err) = result {
Expand All @@ -423,6 +423,11 @@ impl GeyserPlugin for GeyserPluginPostgres {
});
}
}
ReplicaBlockInfoVersions::V0_0_3(_block_info) => {
return Err(GeyserPluginError::SlotStatusUpdateError{
msg: "Failed to persist the transaction info to the PostgreSQL database. Unsupported format.".to_string()
});
}
ReplicaBlockInfoVersions::V0_0_2(_block_info) => {
return Err(GeyserPluginError::SlotStatusUpdateError{
msg: "Failed to persist the transaction info to the PostgreSQL database. Unsupported format.".to_string()
Expand Down
6 changes: 3 additions & 3 deletions src/postgres_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use {
postgres_client_block_metadata::DbBlockInfo,
postgres_client_transaction::LogTransactionRequest,
postgres_openssl::MakeTlsConnector,
solana_geyser_plugin_interface::geyser_plugin_interface::{
GeyserPluginError, ReplicaAccountInfoV3, ReplicaBlockInfoV3, SlotStatus,
agave_geyser_plugin_interface::geyser_plugin_interface::{
GeyserPluginError, ReplicaAccountInfoV3, ReplicaBlockInfoV4, SlotStatus,
},
solana_measure::measure::Measure,
solana_metrics::*,
Expand Down Expand Up @@ -1232,7 +1232,7 @@ impl ParallelPostgresClient {

pub fn update_block_metadata(
&self,
block_info: &ReplicaBlockInfoV3,
block_info: &ReplicaBlockInfoV4,
) -> Result<(), GeyserPluginError> {
if let Err(err) = self.sender.send(DbWorkItem::UpdateBlockMetadata(Box::new(
UpdateBlockMetadataRequest {
Expand Down
2 changes: 1 addition & 1 deletion src/postgres_client/postgres_client_account_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use {
},
log::*,
postgres::{Client, Statement},
solana_geyser_plugin_interface::geyser_plugin_interface::GeyserPluginError,
agave_geyser_plugin_interface::geyser_plugin_interface::GeyserPluginError,
solana_measure::measure::Measure,
solana_metrics::*,
solana_sdk::pubkey::Pubkey,
Expand Down
10 changes: 5 additions & 5 deletions src/postgres_client/postgres_client_block_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use {
chrono::Utc,
log::*,
postgres::{Client, Statement},
solana_geyser_plugin_interface::geyser_plugin_interface::{
GeyserPluginError, ReplicaBlockInfoV3,
agave_geyser_plugin_interface::geyser_plugin_interface::{
GeyserPluginError, ReplicaBlockInfoV4,
},
};

Expand All @@ -22,12 +22,12 @@ pub struct DbBlockInfo {
pub block_height: Option<i64>,
}

impl<'a> From<&ReplicaBlockInfoV3<'a>> for DbBlockInfo {
fn from(block_info: &ReplicaBlockInfoV3) -> Self {
impl<'a> From<&ReplicaBlockInfoV4<'a>> for DbBlockInfo {
fn from(block_info: &ReplicaBlockInfoV4) -> Self {
Self {
slot: block_info.slot as i64,
blockhash: block_info.blockhash.to_string(),
rewards: block_info.rewards.iter().map(DbReward::from).collect(),
rewards: block_info.rewards.rewards.iter().map(DbReward::from).collect(),
block_time: block_info.block_time,
block_height: block_info
.block_height
Expand Down
4 changes: 3 additions & 1 deletion src/postgres_client/postgres_client_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use {
log::*,
postgres::{Client, Statement},
postgres_types::{FromSql, ToSql},
solana_geyser_plugin_interface::geyser_plugin_interface::{
agave_geyser_plugin_interface::geyser_plugin_interface::{
GeyserPluginError, ReplicaTransactionInfoV2,
},
solana_runtime::bank::RewardType,
Expand Down Expand Up @@ -353,6 +353,7 @@ pub enum DbTransactionErrorCode {
ResanitizationNeeded,
UnbalancedTransaction,
ProgramExecutionTemporarilyRestricted,
ProgramCacheHitMaxLimit
}

impl From<&TransactionError> for DbTransactionErrorCode {
Expand Down Expand Up @@ -413,6 +414,7 @@ impl From<&TransactionError> for DbTransactionErrorCode {
TransactionError::ProgramExecutionTemporarilyRestricted { account_index: _ } => {
Self::ProgramExecutionTemporarilyRestricted
}
TransactionError::ProgramCacheHitMaxLimit => Self::ProgramCacheHitMaxLimit
}
}
}
Expand Down