diff --git a/Cargo.lock b/Cargo.lock
index 2f28372ae09..575195e537f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2978,9 +2978,9 @@ dependencies = [
[[package]]
name = "diesel"
-version = "2.3.2"
+version = "2.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e8496eeb328dce26ee9d9b73275d396d9bddb433fa30106cf6056dd8c3c2764c"
+checksum = "9940fb8467a0a06312218ed384185cb8536aa10d8ec017d0ce7fad2c1bd882d5"
dependencies = [
"bigdecimal 0.3.1",
"bitflags 2.11.1",
@@ -2999,16 +2999,15 @@ dependencies = [
[[package]]
name = "diesel-async"
-version = "0.8.0"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b95864e58597509106f1fddfe0600de7e589e1fddddd87f54eee0a49fd111bbc"
+checksum = "9c20ddcc6737cecdaef3dfecb2796bdfe3002456521189d30be8e4c5a1bc821d"
dependencies = [
"deadpool 0.13.0",
"diesel",
"futures-core",
"futures-util",
"pin-project-lite",
- "scoped-futures",
"tokio",
"tokio-postgres",
]
@@ -7300,15 +7299,6 @@ dependencies = [
"parking_lot",
]
-[[package]]
-name = "scoped-futures"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b24aae2d0636530f359e9d5ef0c04669d11c5e756699b27a6a6d845d8329091"
-dependencies = [
- "pin-project-lite",
-]
-
[[package]]
name = "scopeguard"
version = "1.2.0"
diff --git a/Cargo.toml b/Cargo.toml
index 46e7a059ef0..2e418a4f98e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -61,7 +61,7 @@ diesel = { version = "2.2.7", features = [
"chrono",
"i-implement-a-third-party-backend-and-opt-into-breaking-changes",
] }
-diesel-async = { version = "0.8.0", features = ["deadpool", "async-connection-wrapper", "tokio", "postgres"] }
+diesel-async = { version = "0.9.0", features = ["deadpool", "async-connection-wrapper", "tokio", "postgres"] }
diesel-derive-enum = { version = "2.1.0", features = ["postgres"] }
diesel-dynamic-schema = { version = "0.2.3", features = ["postgres"] }
diesel_derives = "2.3.8"
diff --git a/node/src/manager/commands/chain.rs b/node/src/manager/commands/chain.rs
index 2f344bdeb7b..69185d3d8d5 100644
--- a/node/src/manager/commands/chain.rs
+++ b/node/src/manager/commands/chain.rs
@@ -25,7 +25,6 @@ use graph_chain_ethereum::chain::BlockFinality;
use graph_store_postgres::BlockStore;
use graph_store_postgres::ChainStore;
use graph_store_postgres::PoolCoordinator;
-use graph_store_postgres::ScopedFutureExt;
use graph_store_postgres::Shard;
use graph_store_postgres::add_chain;
use graph_store_postgres::find_chain;
@@ -260,34 +259,35 @@ pub async fn change_block_cache_shard(
let new_name = format!("{}-old", &chain_name);
let ident = chain_store.chain_identifier().await?;
- conn.transaction::<(), StoreError, _>(|conn| {
- async {
- let shard = Shard::new(shard.to_string())?;
+ conn.transaction::<(), StoreError, _>(async |conn| {
+ let shard = Shard::new(shard.to_string())?;
- let chain = BlockStore::allocate_chain(conn, &chain_name, &shard, &ident).await?;
+ let chain = BlockStore::allocate_chain(conn, &chain_name, &shard, &ident).await?;
- store.add_chain_store(&chain, true).await?;
+ store.add_chain_store(&chain, true).await?;
- // Drop the foreign key constraint on deployment_schemas
- sql_query(
- "alter table deployment_schemas drop constraint deployment_schemas_network_fkey;",
- )
- .execute(conn).await?;
+ // Drop the foreign key constraint on deployment_schemas
+ sql_query(
+ "alter table deployment_schemas drop constraint deployment_schemas_network_fkey;",
+ )
+ .execute(conn)
+ .await?;
- // Update the current chain name to chain-old
- update_chain_name(conn, &chain_name, &new_name).await?;
+ // Update the current chain name to chain-old
+ update_chain_name(conn, &chain_name, &new_name).await?;
- // Create a new chain with the name in the destination shard
- let _ = add_chain(conn, &chain_name, &shard, ident).await?;
+ // Create a new chain with the name in the destination shard
+ let _ = add_chain(conn, &chain_name, &shard, ident).await?;
- // Re-add the foreign key constraint
- sql_query(
- "alter table deployment_schemas add constraint deployment_schemas_network_fkey foreign key (network) references chains(name);",
- )
- .execute(conn).await?;
- Ok(())
- }.scope_boxed()
- }).await?;
+ // Re-add the foreign key constraint
+ sql_query(
+ "alter table deployment_schemas add constraint deployment_schemas_network_fkey foreign key (network) references chains(name);",
+ )
+ .execute(conn)
+ .await?;
+ Ok(())
+ })
+ .await?;
chain_store.update_name(&new_name).await?;
diff --git a/store/postgres/src/block_store.rs b/store/postgres/src/block_store.rs
index 0ae4b05597a..683553d7c22 100644
--- a/store/postgres/src/block_store.rs
+++ b/store/postgres/src/block_store.rs
@@ -5,7 +5,7 @@ use graph::{components::store::BLOCK_CACHE_SIZE, parking_lot::RwLock};
use anyhow::anyhow;
use async_trait::async_trait;
use diesel::{ExpressionMethods as _, QueryDsl, sql_query};
-use diesel_async::{RunQueryDsl, scoped_futures::ScopedFutureExt};
+use diesel_async::RunQueryDsl;
use graph::{
blockchain::ChainIdentifier,
components::store::{BlockStore as BlockStoreTrait, QueryPermit},
@@ -253,9 +253,7 @@ impl BlockStore {
const CHAIN_HEAD_CACHE_TTL: Duration = Duration::from_secs(2);
let mirror = PrimaryMirror::new(&pools);
- let existing_chains = mirror
- .read_async(|conn| primary::load_chains(conn).scope_boxed())
- .await?;
+ let existing_chains = mirror.read_async(primary::load_chains).await?;
let chain_head_cache = TimedCache::new(CHAIN_HEAD_CACHE_TTL);
let chains = shards.clone();
@@ -437,18 +435,15 @@ impl BlockStore {
let chain = chain.to_string();
let this = self.cheap_clone();
self.mirror
- .read_async(|conn| {
- async {
- match primary::find_chain(conn, &chain).await? {
- Some(chain) => {
- let chain_store = this.add_chain_store(&chain, false).await?;
- Ok(Some(chain_store))
- }
- None => Ok(None),
+ .read_async(
+ async |conn| match primary::find_chain(conn, &chain).await? {
+ Some(chain) => {
+ let chain_store = this.add_chain_store(&chain, false).await?;
+ Ok(Some(chain_store))
}
- }
- .scope_boxed()
- })
+ None => Ok(None),
+ },
+ )
.await
}
diff --git a/store/postgres/src/chain_store.rs b/store/postgres/src/chain_store.rs
index 3fe39462a98..3160afebfab 100644
--- a/store/postgres/src/chain_store.rs
+++ b/store/postgres/src/chain_store.rs
@@ -2,8 +2,7 @@ use anyhow::anyhow;
use async_trait::async_trait;
use diesel::sql_types::Text;
use diesel::{ExpressionMethods, OptionalExtension, QueryDsl, insert_into, update};
-use diesel_async::AsyncConnection;
-use diesel_async::{RunQueryDsl, scoped_futures::ScopedFutureExt};
+use diesel_async::RunQueryDsl;
use graph::components::store::ChainHeadStore;
use graph::data::store::ethereum::call;
@@ -2420,24 +2419,21 @@ impl ChainStore {
use public::ethereum_networks::dsl::*;
let mut conn = self.pool.get_permitted().await?;
- conn.transaction(|conn| {
- async move {
- insert_into(ethereum_networks)
- .values((
- name.eq(&self.chain),
- namespace.eq(&self.storage),
- head_block_hash.eq::