diff --git a/Cargo.toml b/Cargo.toml index b1ea949..27c2e55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Solana Maintainers "] 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/" @@ -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" @@ -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] diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..371758d --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "1.78.0" \ No newline at end of file diff --git a/src/geyser_plugin_postgres.rs b/src/geyser_plugin_postgres.rs index a6ec71e..da85457 100644 --- a/src/geyser_plugin_postgres.rs +++ b/src/geyser_plugin_postgres.rs @@ -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, }, @@ -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 {:?}", @@ -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 { @@ -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() diff --git a/src/postgres_client.rs b/src/postgres_client.rs index c529631..7f50603 100644 --- a/src/postgres_client.rs +++ b/src/postgres_client.rs @@ -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::*, @@ -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 { diff --git a/src/postgres_client/postgres_client_account_index.rs b/src/postgres_client/postgres_client_account_index.rs index 92359b7..b4d2af2 100644 --- a/src/postgres_client/postgres_client_account_index.rs +++ b/src/postgres_client/postgres_client_account_index.rs @@ -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, diff --git a/src/postgres_client/postgres_client_block_metadata.rs b/src/postgres_client/postgres_client_block_metadata.rs index 7ea4bab..cc00796 100644 --- a/src/postgres_client/postgres_client_block_metadata.rs +++ b/src/postgres_client/postgres_client_block_metadata.rs @@ -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, }, }; @@ -22,12 +22,12 @@ pub struct DbBlockInfo { pub block_height: Option, } -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 diff --git a/src/postgres_client/postgres_client_transaction.rs b/src/postgres_client/postgres_client_transaction.rs index 7d6020b..9cd23a6 100644 --- a/src/postgres_client/postgres_client_transaction.rs +++ b/src/postgres_client/postgres_client_transaction.rs @@ -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, @@ -353,6 +353,7 @@ pub enum DbTransactionErrorCode { ResanitizationNeeded, UnbalancedTransaction, ProgramExecutionTemporarilyRestricted, + ProgramCacheHitMaxLimit } impl From<&TransactionError> for DbTransactionErrorCode { @@ -413,6 +414,7 @@ impl From<&TransactionError> for DbTransactionErrorCode { TransactionError::ProgramExecutionTemporarilyRestricted { account_index: _ } => { Self::ProgramExecutionTemporarilyRestricted } + TransactionError::ProgramCacheHitMaxLimit => Self::ProgramCacheHitMaxLimit } } }