diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 43035bf..adfe1f0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: - if: runner.os == 'Linux' run: | sudo apt-get update - sudo apt-get install -y libudev-dev + sudo apt-get install -y libudev-dev protobuf-compiler libclang-dev - uses: actions-rs/toolchain@v1 with: @@ -58,4 +58,4 @@ jobs: args: --workspace --all-targets -- --deny=warnings - name: Build - run: ./ci/cargo-build-test.sh \ No newline at end of file + run: ./ci/cargo-build-test.sh diff --git a/Cargo.toml b/Cargo.toml index 362129c..24c656c 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.16.17" +version = "1.17.2" 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.16.17" } -solana-logger = { version = "1.16.17" } -solana-measure = { version = "1.16.17" } -solana-metrics = { version = "1.16.17" } -solana-runtime = { version = "1.16.17" } -solana-sdk = { version = "1.16.17" } -solana-transaction-status = { version = "1.16.17" } +solana-geyser-plugin-interface = { version = "=1.17.2" } +solana-logger = { version = "1.17.2" } +solana-measure = { version = "1.17.2" } +solana-metrics = { version = "1.17.2" } +solana-runtime = { version = "1.17.2" } +solana-sdk = { version = "1.17.2" } +solana-transaction-status = { version = "1.17.2" } 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.16.17" } -solana-core = { version = "1.16.17" } -solana-local-cluster = { version = "1.16.17" } -solana-net-utils = { version = "1.16.17" } -solana-streamer = { version = "1.16.17" } +solana-account-decoder = { version = "1.17.2" } +solana-core = { version = "1.17.2" } +solana-local-cluster = { version = "1.17.2" } +solana-net-utils = { version = "1.17.2" } +solana-streamer = { version = "1.17.2" } tempfile = "3.3.0" [package.metadata.docs.rs] diff --git a/ci/rust-version.sh b/ci/rust-version.sh index 88a5616..b8acf11 100644 --- a/ci/rust-version.sh +++ b/ci/rust-version.sh @@ -18,13 +18,13 @@ if [[ -n $RUST_STABLE_VERSION ]]; then stable_version="$RUST_STABLE_VERSION" else - stable_version=1.69.0 + stable_version=1.73.0 fi if [[ -n $RUST_NIGHTLY_VERSION ]]; then nightly_version="$RUST_NIGHTLY_VERSION" else - nightly_version=2023-04-19 + nightly_version=2023-10-05 fi diff --git a/scripts/create_schema.sql b/scripts/create_schema.sql index f531382..15c8129 100644 --- a/scripts/create_schema.sql +++ b/scripts/create_schema.sql @@ -68,7 +68,8 @@ Create TYPE "TransactionErrorCode" AS ENUM ( 'MaxLoadedAccountsDataSizeExceeded', 'InvalidLoadedAccountsDataSizeLimit', 'ResanitizationNeeded', - 'UnbalancedTransaction' + 'UnbalancedTransaction', + 'ProgramExecutionTemporarilyRestricted' ); 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..c529631 100644 --- a/src/postgres_client.rs +++ b/src/postgres_client.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] mod postgres_client_account_index; mod postgres_client_block_metadata; @@ -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 e71a588..7d6020b 100644 --- a/src/postgres_client/postgres_client_transaction.rs +++ b/src/postgres_client/postgres_client_transaction.rs @@ -352,6 +352,7 @@ pub enum DbTransactionErrorCode { InvalidLoadedAccountsDataSizeLimit, ResanitizationNeeded, UnbalancedTransaction, + ProgramExecutionTemporarilyRestricted, } impl From<&TransactionError> for DbTransactionErrorCode { @@ -409,6 +410,9 @@ impl From<&TransactionError> for DbTransactionErrorCode { } TransactionError::ResanitizationNeeded => Self::ResanitizationNeeded, TransactionError::UnbalancedTransaction => Self::UnbalancedTransaction, + TransactionError::ProgramExecutionTemporarilyRestricted { account_index: _ } => { + Self::ProgramExecutionTemporarilyRestricted + } } } } @@ -1388,7 +1392,6 @@ pub(crate) mod tests { message_hash, Some(true), SimpleAddressLoader::Disabled, - false, ) .unwrap(); @@ -1424,7 +1427,7 @@ pub(crate) mod tests { let message_hash = Hash::new_unique(); let transaction = build_test_transaction_v0(); - transaction.sanitize(false).unwrap(); + transaction.sanitize().unwrap(); let transaction = SanitizedTransaction::try_create( transaction, @@ -1434,7 +1437,6 @@ pub(crate) mod tests { writable: vec![Pubkey::new_unique(), Pubkey::new_unique()], readonly: vec![Pubkey::new_unique(), Pubkey::new_unique()], }), - false, ) .unwrap(); diff --git a/tests/test_postgres_plugin.rs b/tests/test_postgres_plugin.rs index ec6df01..f9c04a9 100644 --- a/tests/test_postgres_plugin.rs +++ b/tests/test_postgres_plugin.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use serde_json::json;