diff --git a/.github/workflows/actions/setup-env/action.yml b/.github/workflows/actions/setup-env/action.yml index 75755771..b2f56589 100644 --- a/.github/workflows/actions/setup-env/action.yml +++ b/.github/workflows/actions/setup-env/action.yml @@ -98,9 +98,9 @@ runs: WORK_DIR="$LOCAL_DIR/tmp" mkdir -p "$WORK_DIR" && cd "$WORK_DIR" - # Download PostgreSQL 17 packages - wget -q "https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-17/libpq5_17.6-1.pgdg+1_${ARCH}.deb" - wget -q "https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-17/libpq-dev_17.6-1.pgdg+1_${ARCH}.deb" + # Download PostgreSQL 18 packages + wget -q "https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-18/libpq5_18.0-1.pgdg+3_${ARCH}.deb" + wget -q "https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-18/libpq-dev_18.0-1.pgdg+3_${ARCH}.deb" # Extract and install for pkg in *.deb; do diff --git a/operator/Cargo.lock b/operator/Cargo.lock index a04cec81..a5cf1593 100644 --- a/operator/Cargo.lock +++ b/operator/Cargo.lock @@ -1468,7 +1468,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4" dependencies = [ "memchr", - "regex-automata", + "regex-automata 0.4.10", "serde", ] @@ -2816,7 +2816,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d162beedaa69905488a8da94f5ac3edb4dd4788b732fadb7bd120b2625c1976" dependencies = [ "data-encoding", - "syn 2.0.106", + "syn 1.0.109", ] [[package]] @@ -7677,11 +7677,11 @@ dependencies = [ [[package]] name = "matchers" -version = "0.2.0" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] @@ -8273,11 +8273,12 @@ checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" [[package]] name = "nu-ansi-term" -version = "0.50.1" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" dependencies = [ - "windows-sys 0.52.0", + "overload", + "winapi", ] [[package]] @@ -8580,6 +8581,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "pallet-asset-conversion" version = "21.1.0" @@ -11833,7 +11840,7 @@ dependencies = [ "rand 0.9.2", "rand_chacha 0.9.0", "rand_xorshift", - "regex-syntax", + "regex-syntax 0.8.6", "rusty-fork", "tempfile", "unarray", @@ -12380,8 +12387,17 @@ checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" dependencies = [ "aho-corasick", "memchr", - "regex-automata", - "regex-syntax", + "regex-automata 0.4.10", + "regex-syntax 0.8.6", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", ] [[package]] @@ -12392,9 +12408,15 @@ checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.8.6", ] +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + [[package]] name = "regex-syntax" version = "0.8.6" @@ -18333,15 +18355,15 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.20" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", "once_cell", "parking_lot 0.12.4", - "regex-automata", + "regex", "sharded-slab", "smallvec", "thread_local", diff --git a/operator/Cargo.toml b/operator/Cargo.toml index 0726b6c1..665d1c54 100644 --- a/operator/Cargo.toml +++ b/operator/Cargo.toml @@ -83,7 +83,10 @@ ssz_rs_derive = { version = "0.9.0", default-features = false } static_assertions = { version = "1.1.0", default-features = false } strum = { version = "0.26.3", default-features = false, features = ["derive"] } strum_macros = "0.24" -tracing = { version = "0.1.37", default-features = false } +tracing = { version = "0.1.41", default-features = false } +tracing-subscriber = { version = "=0.3.19", features = [ + "env-filter", +] } # Dependency pinned because 0.3.20 messes up text formatting in substrate logs url = "2.2.2" # Polkadot SDK diff --git a/operator/node/src/eth.rs b/operator/node/src/eth.rs index dae254f0..126196d8 100644 --- a/operator/node/src/eth.rs +++ b/operator/node/src/eth.rs @@ -2,6 +2,7 @@ use crate::client::{FullBackend, FullClient}; use datahaven_runtime_common::Block; pub use fc_db::Backend as FrontierBackend; +use fc_rpc::EthConfig; use fc_rpc::EthTask; pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool}; pub use fc_storage::{StorageOverride, StorageOverrideHandler}; @@ -23,7 +24,7 @@ use std::{ /// Frontier DB backend type. pub struct DefaultEthConfig(std::marker::PhantomData<(C, BE)>); -impl fc_rpc::EthConfig for DefaultEthConfig +impl EthConfig for DefaultEthConfig where C: StorageProvider + Sync + Send + 'static, BE: Backend + 'static, diff --git a/operator/node/src/rpc.rs b/operator/node/src/rpc.rs index 1218bcd5..c49f364b 100644 --- a/operator/node/src/rpc.rs +++ b/operator/node/src/rpc.rs @@ -7,9 +7,7 @@ use crate::consensus::BabeConsensusDataProvider; use crate::eth::DefaultEthConfig; -use datahaven_runtime_common::{ - time::SLOT_DURATION, AccountId, Balance, Block, BlockNumber, Hash, Nonce, -}; +use datahaven_runtime_common::{time::SLOT_DURATION, Block, BlockNumber, Hash}; use fc_rpc::TxPool; use fc_rpc::{Eth, EthBlockDataCacheTask, EthFilter, Net, Web3}; use fc_rpc_core::types::{FeeHistoryCache, FilterPool}; @@ -17,7 +15,7 @@ use fc_rpc_core::{EthApiServer, EthFilterApiServer, NetApiServer, TxPoolApiServe use fc_storage::StorageOverride; use fp_rpc::EthereumRuntimeRPCApi; use jsonrpsee::RpcModule; -use sc_client_api::{AuxStore, Backend, StateBackend, StorageProvider}; +use sc_client_api::{Backend, StateBackend, StorageProvider}; use sc_consensus_beefy::communication::notification::{ BeefyBestBlockStream, BeefyVersionedFinalityProofStream, }; @@ -25,14 +23,19 @@ use sc_consensus_manual_seal::rpc::{EngineCommand, ManualSeal, ManualSealApiServ use sc_network_sync::SyncingService; use sc_transaction_pool::{ChainApi, Pool}; use sc_transaction_pool_api::TransactionPool; -use sp_api::{CallApiAt, ProvideRuntimeApi}; -use sp_block_builder::BlockBuilder; -use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; +use shc_client::types::FileStorageT; +use shc_common::traits::StorageEnableRuntime; +use shc_common::traits::StorageEnableRuntimeApi; +use shc_common::types::OpaqueBlock; +use shc_common::types::ParachainClient; +use shc_forest_manager::traits::ForestStorageHandler; +use shc_rpc::StorageHubClientApiServer; +use shc_rpc::StorageHubClientRpc; +use shc_rpc::StorageHubClientRpcConfig; use sp_consensus_babe::{BabeApi, SlotDuration}; use sp_consensus_beefy::AuthorityIdBound; use sp_core::H256; use sp_runtime::traits::BlakeTwo256; -use sp_runtime::OpaqueExtrinsic; use std::collections::BTreeMap; use std::sync::Arc; @@ -47,9 +50,12 @@ pub struct BeefyDeps { } /// Full client dependencies. -pub struct FullDeps { +pub struct FullDeps +where + Runtime: StorageEnableRuntime, +{ /// The client instance to use. - pub client: Arc, + pub client: Arc>, /// Transaction pool instance. pub pool: Arc

, /// BEEFY dependencies. @@ -82,32 +88,33 @@ pub struct FullDeps { pub command_sink: Option>>, /// Mandated parent hashes for a given block hash. pub forced_parent_hashes: Option>, + /// Storage Hub RPC config + pub maybe_storage_hub_client_config: Option>, } /// Instantiate all full RPC extensions. -pub fn create_full( - deps: FullDeps, +pub fn create_full( + deps: FullDeps, ) -> Result, Box> where - C: ProvideRuntimeApi + StorageProvider + AuxStore, - C: HeaderBackend + HeaderMetadata + 'static, - C: Send + Sync + 'static, - C::Api: substrate_frame_rpc_system::AccountNonceApi, - C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, - C::Api: BlockBuilder, - C::Api: mmr_rpc::MmrRuntimeApi::Hash, BlockNumber>, - C::Api: EthereumRuntimeRPCApi, - C::Api: BabeApi, - C::Api: fp_rpc::ConvertTransactionRuntimeApi, - C: sc_client_api::UsageProvider, - C: CallApiAt< - sp_runtime::generic::Block, OpaqueExtrinsic>, - >, P: TransactionPool + 'static, BE: Backend + Send + Sync + 'static, BE::State: StateBackend, AuthorityId: AuthorityIdBound, A: ChainApi + 'static, + Runtime: StorageEnableRuntime, + Runtime::RuntimeApi: StorageEnableRuntimeApi< + RuntimeApi: mmr_rpc::MmrRuntimeApi< + Block, + ::Hash, + BlockNumber, + > + EthereumRuntimeRPCApi + + BabeApi + + fp_rpc::ConvertTransactionRuntimeApi, + >, + ParachainClient: StorageProvider, + FL: FileStorageT, + FSH: ForestStorageHandler + Send + Sync + 'static, { use mmr_rpc::{Mmr, MmrApiServer}; use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; @@ -133,6 +140,7 @@ where is_authority, command_sink, forced_parent_hashes, + maybe_storage_hub_client_config, } = deps; module.merge(System::new(Arc::clone(&client), Arc::clone(&pool)).into_rpc())?; @@ -155,6 +163,16 @@ where .into_rpc(), )?; + if let Some(storage_hub_client_config) = maybe_storage_hub_client_config { + module.merge( + StorageHubClientRpc::::new( + client.clone(), + storage_hub_client_config, + ) + .into_rpc(), + )?; + } + enum Never {} impl fp_rpc::ConvertTransaction for Never { fn convert_transaction(&self, _transaction: pallet_ethereum::Transaction) -> T { @@ -182,7 +200,7 @@ where }; module.merge( - Eth::<_, _, _, _, _, _, _, DefaultEthConfig>::new( + Eth::<_, _, _, _, _, _, _, DefaultEthConfig, BE>>::new( Arc::clone(&client), Arc::clone(&pool), graph.clone(), diff --git a/operator/node/src/service.rs b/operator/node/src/service.rs index 9b79db1f..b120236c 100644 --- a/operator/node/src/service.rs +++ b/operator/node/src/service.rs @@ -532,7 +532,7 @@ where } // Storage Hub builder - let (sh_builder, _maybe_storage_hub_client_rpc_config) = init_sh_builder::( + let (sh_builder, maybe_storage_hub_client_rpc_config) = init_sh_builder::( &provider_options, &task_manager, file_transfer_request_protocol, @@ -627,6 +627,7 @@ where fc_db::Backend::Sql(b) => b.clone(), }, forced_parent_hashes: None, + maybe_storage_hub_client_config: maybe_storage_hub_client_rpc_config.clone(), }; crate::rpc::create_full(deps).map_err(Into::into) })