diff --git a/Cargo.toml b/Cargo.toml index 018e7f6..c50c239 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.15.2" +version = "1.16.0" repository = "https://github.com/solana-labs/solana-accountsdb-plugin-postgres" license = "Apache-2.0" homepage = "https://solana.com/" diff --git a/scripts/create_schema.sql b/scripts/create_schema.sql index d55cf07..1525fce 100644 --- a/scripts/create_schema.sql +++ b/scripts/create_schema.sql @@ -67,7 +67,9 @@ Create TYPE "TransactionErrorCode" AS ENUM ( 'InsufficientFundsForRent', 'MaxLoadedAccountsDataSizeExceeded', 'InvalidLoadedAccountsDataSizeLimit', - 'ResanitizationNeeded' + 'ResanitizationNeeded', + 'ProgramExecutionTemporarilyRestricted', + 'UnbalancedTransaction' ); CREATE TYPE "TransactionError" AS ( diff --git a/src/geyser_plugin_postgres.rs b/src/geyser_plugin_postgres.rs index 5a558b6..a6ec71e 100644 --- a/src/geyser_plugin_postgres.rs +++ b/src/geyser_plugin_postgres.rs @@ -414,7 +414,7 @@ impl GeyserPlugin for GeyserPluginPostgres { ))); } Some(client) => match block_info { - ReplicaBlockInfoVersions::V0_0_2(block_info) => { + ReplicaBlockInfoVersions::V0_0_3(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_2(_block_info) => { + return Err(GeyserPluginError::SlotStatusUpdateError{ + msg: "Failed to persist the transaction info to the PostgreSQL database. Unsupported format.".to_string() + }); + } ReplicaBlockInfoVersions::V0_0_1(_) => { 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 b535aee..43f1e50 100644 --- a/src/postgres_client.rs +++ b/src/postgres_client.rs @@ -19,7 +19,7 @@ use { postgres_client_transaction::LogTransactionRequest, postgres_openssl::MakeTlsConnector, solana_geyser_plugin_interface::geyser_plugin_interface::{ - GeyserPluginError, ReplicaAccountInfoV3, ReplicaBlockInfoV2, SlotStatus, + GeyserPluginError, ReplicaAccountInfoV3, ReplicaBlockInfoV3, SlotStatus, }, solana_measure::measure::Measure, solana_metrics::*, @@ -1232,7 +1232,7 @@ impl ParallelPostgresClient { pub fn update_block_metadata( &self, - block_info: &ReplicaBlockInfoV2, + block_info: &ReplicaBlockInfoV3, ) -> Result<(), GeyserPluginError> { if let Err(err) = self.sender.send(DbWorkItem::UpdateBlockMetadata(Box::new( UpdateBlockMetadataRequest { diff --git a/src/postgres_client/postgres_client_block_metadata.rs b/src/postgres_client/postgres_client_block_metadata.rs index b3117be..7ea4bab 100644 --- a/src/postgres_client/postgres_client_block_metadata.rs +++ b/src/postgres_client/postgres_client_block_metadata.rs @@ -9,7 +9,7 @@ use { log::*, postgres::{Client, Statement}, solana_geyser_plugin_interface::geyser_plugin_interface::{ - GeyserPluginError, ReplicaBlockInfoV2, + GeyserPluginError, ReplicaBlockInfoV3, }, }; @@ -22,8 +22,8 @@ pub struct DbBlockInfo { pub block_height: Option, } -impl<'a> From<&ReplicaBlockInfoV2<'a>> for DbBlockInfo { - fn from(block_info: &ReplicaBlockInfoV2) -> Self { +impl<'a> From<&ReplicaBlockInfoV3<'a>> for DbBlockInfo { + fn from(block_info: &ReplicaBlockInfoV3) -> Self { Self { slot: block_info.slot as i64, blockhash: block_info.blockhash.to_string(), diff --git a/src/postgres_client/postgres_client_transaction.rs b/src/postgres_client/postgres_client_transaction.rs index 3668095..eb52983 100644 --- a/src/postgres_client/postgres_client_transaction.rs +++ b/src/postgres_client/postgres_client_transaction.rs @@ -351,6 +351,8 @@ pub enum DbTransactionErrorCode { MaxLoadedAccountsDataSizeExceeded, InvalidLoadedAccountsDataSizeLimit, ResanitizationNeeded, + ProgramExecutionTemporarilyRestricted, + UnbalancedTransaction, } impl From<&TransactionError> for DbTransactionErrorCode { @@ -407,6 +409,8 @@ impl From<&TransactionError> for DbTransactionErrorCode { Self::InvalidLoadedAccountsDataSizeLimit } TransactionError::ResanitizationNeeded => Self::ResanitizationNeeded, + TransactionError::ProgramExecutionTemporarilyRestricted {account_index: _} => Self::ProgramExecutionTemporarilyRestricted, + TransactionError::UnbalancedTransaction => Self::UnbalancedTransaction, } } }