Skip to content

Commit 85a4b6c

Browse files
authored
Fix dependencies indexing (#317)
1 parent be28e24 commit 85a4b6c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2614
-2312
lines changed

Cargo.lock

Lines changed: 998 additions & 939 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ resolver = "2"
1313
rindexer = { path = "../core" }
1414

1515
# external dependencies
16-
alloy = { version = "1.0.30", features = ["full"] }
16+
alloy = { version = "1.0.37", features = ["full"] }
1717
alloy-chains = "0.2.8"# pegged to version in "foundry-block-explorers"
1818
foundry-block-explorers = "0.17.0"
1919
clap = { version = "4.5.46", features = ["derive"] }

cli/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ start_all:
1111
start_graphql:
1212
RUSTFLAGS='-C target-cpu=native' RUST_BACKTRACE='full' cargo run --release --features jemalloc -- start --path $(CURDIR)/../examples/rindexer_demo_cli graphql
1313
playground_codegen_typings:
14-
RUSTFLAGS='-C target-cpu=native' cargo run --release --features jemalloc -- codegen --path $(CURDIR)/../rindexer_rust_playground typings
14+
RUSTFLAGS='-C target-cpu=native' cargo run --release --features jemalloc -- codegen --path $(CURDIR)/../examples/rindexer_rust_playground typings
1515
playground_codegen_indexer:
16-
RUSTFLAGS='-C target-cpu=native' cargo run --release --features jemalloc -- codegen --path $(CURDIR)/../rindexer_rust_playground indexer
16+
RUSTFLAGS='-C target-cpu=native' cargo run --release --features jemalloc -- codegen --path $(CURDIR)/../examples/rindexer_rust_playground indexer
1717
codegen_graphql:
1818
RUSTFLAGS='-C target-cpu=native' cargo run --release --features jemalloc -- codegen --path $(CURDIR)/../examples/rindexer_demo_cli graphql --endpoint http://0.0.0.0:5005/graphql
1919
add_contract:

cli/src/commands/add.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,10 @@ pub async fn handle_add_contract_command(
6363
let contract_address =
6464
prompt_for_input(&format!("Enter {network} Contract Address"), None, None, None);
6565

66-
let etherscan_api_key =
67-
manifest.global.as_ref().and_then(|global| global.etherscan_api_key.as_ref()).map_or_else(
68-
|| BACKUP_ETHERSCAN_API_KEY.to_string(),
69-
|key| public_read_env_value(key).unwrap_or_else(|_| key.to_string()),
70-
);
66+
let etherscan_api_key = manifest.global.etherscan_api_key.as_ref().map_or_else(
67+
|| BACKUP_ETHERSCAN_API_KEY.to_string(),
68+
|key| public_read_env_value(key).unwrap_or_else(|_| key.to_string()),
69+
);
7170

7271
let client = Client::builder()
7372
.with_api_key(etherscan_api_key)

cli/src/commands/new.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use alloy::{
1313
};
1414
use rindexer::manifest::config::Config;
1515
use rindexer::manifest::contract::ContractEvent;
16+
use rindexer::manifest::global::Global;
1617
#[cfg(feature = "reth")]
1718
use rindexer::manifest::reth::RethConfig;
1819
use rindexer::{
@@ -250,7 +251,7 @@ pub fn handle_new_command(
250251
}],
251252
native_transfers: NativeTransfers::default(),
252253
phantom: None,
253-
global: None,
254+
global: Global::default(),
254255
storage: Storage {
255256
postgres: if postgres_enabled {
256257
Some(PostgresDetails {

cli/src/commands/phantom.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,10 @@ fn handle_phantom_clone(project_path: &Path, args: &PhantomBaseArgs) -> Result<(
286286
fs::create_dir(&clone_in)?;
287287
}
288288

289-
let etherscan_api_key = manifest
290-
.global
291-
.as_ref()
292-
.and_then(|global| global.etherscan_api_key.as_ref())
293-
.map_or_else(
294-
|| BACKUP_ETHERSCAN_API_KEY.to_string(),
295-
|key| public_read_env_value(key).unwrap_or_else(|_| key.to_string()),
296-
);
289+
let etherscan_api_key = manifest.global.etherscan_api_key.as_ref().map_or_else(
290+
|| BACKUP_ETHERSCAN_API_KEY.to_string(),
291+
|key| public_read_env_value(key).unwrap_or_else(|_| key.to_string()),
292+
);
297293

298294
forge_clone_contract(
299295
&clone_in,

cli/src/commands/start.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ use rindexer::{
66
yaml::{read_manifest, YAML_CONFIG_NAME},
77
},
88
rindexer_error, rindexer_info, setup_info_logger, start_rindexer_no_code,
9-
GraphqlOverrideSettings, HealthOverrideSettings, IndexerNoCodeDetails, PostgresClient,
10-
StartNoCodeDetails,
9+
GraphqlOverrideSettings, IndexerNoCodeDetails, PostgresClient, StartNoCodeDetails,
1110
};
1211

1312
use crate::{
@@ -183,7 +182,6 @@ pub async fn start(
183182
enabled: false,
184183
override_port: None,
185184
},
186-
health_details: HealthOverrideSettings { override_port: None },
187185
};
188186

189187
start_rindexer_no_code(details).await.map_err(|e| {
@@ -199,7 +197,6 @@ pub async fn start(
199197
enabled: true,
200198
override_port: port.as_ref().and_then(|port| port.parse().ok()),
201199
},
202-
health_details: HealthOverrideSettings { override_port: None },
203200
};
204201

205202
start_rindexer_no_code(details).await.map_err(|e| {
@@ -215,7 +212,6 @@ pub async fn start(
215212
enabled: true,
216213
override_port: port.as_ref().and_then(|port| port.parse().ok()),
217214
},
218-
health_details: HealthOverrideSettings { override_port: None },
219215
};
220216

221217
let _ = start_rindexer_no_code(details).await.map_err(|e| {

core/Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mockito = "1.7.0"
1717

1818
[dependencies]
1919
# TODO: Trim down alloy features needed later, for now opt in to all.
20-
alloy = { version = "1.0.30", features = ["full", "json-rpc"] }
20+
alloy = { version = "1.0.37", features = ["full", "json-rpc"] }
2121
async-trait = "0.1.89"
2222
aws-config = "1.8.5"
2323
aws-sdk-sns = "1.82.0"
@@ -62,7 +62,7 @@ tokio-postgres = { version = "0.7", features = [
6262
] }
6363
tokio-stream = "0.1.17"
6464
tracing = "0.1"
65-
tracing-subscriber = { version = "0.3", features = [
65+
tracing-subscriber = { version = "=0.3.19", features = [
6666
"env-filter",
6767
"fmt",
6868
"time",
@@ -83,15 +83,15 @@ axum = "0.7"
8383
# build
8484
jemallocator = { version = "0.6.0", package = "tikv-jemallocator", optional = true }
8585
jemalloc-ctl = { version = "0.6.0", package = "tikv-jemalloc-ctl", optional = true }
86-
foundry-compilers = "0.19.2"
87-
alloy-chains = "0.2.8"
86+
foundry-compilers = "0.19.4"
87+
alloy-chains = "0.2.14"
8888

8989
# reth
90-
reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.0", optional = true }
91-
reth-exex = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.0", features = ["serde"], optional = true }
92-
reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.0", optional = true }
93-
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.0", optional = true }
94-
reth-tracing = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.0", optional = true }
90+
reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true }
91+
reth-exex = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", features = ["serde"], optional = true }
92+
reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true }
93+
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true }
94+
reth-tracing = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true }
9595

9696
[target.'cfg(not(windows))'.dependencies]
9797
rdkafka = { version = "0.37.0", features = ["tokio"] }

core/src/generator/build.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use super::{
1111
},
1212
networks_bindings::generate_networks_code,
1313
};
14+
use crate::manifest::contract::Contract;
1415
use crate::{
1516
generator::{
1617
database_bindings::generate_database_code,
@@ -30,7 +31,6 @@ use crate::{
3031
manifest::{
3132
contract::ParseAbiError,
3233
core::Manifest,
33-
global::Global,
3434
network::Network,
3535
storage::Storage,
3636
yaml::{read_manifest, ReadManifestError, YAML_CONFIG_NAME},
@@ -68,15 +68,15 @@ pub enum WriteGlobalError {
6868

6969
fn write_global(
7070
output: &Path,
71-
global: &Global,
71+
global_contracts: &[Contract],
7272
networks: &[Network],
7373
) -> Result<(), WriteGlobalError> {
7474
let global_contract_file_path = generate_file_location(output, "global_contracts");
7575
if global_contract_file_path.exists() {
7676
fs::remove_file(&global_contract_file_path)?;
7777
}
7878

79-
let context_code = generate_context_code(&global.contracts, networks);
79+
let context_code = generate_context_code(global_contracts, networks);
8080
write_file(&global_contract_file_path, context_code.as_str())?;
8181

8282
Ok(())
@@ -138,7 +138,6 @@ fn write_indexer_events(
138138
use alloy::sol;
139139
140140
sol!(
141-
#[derive(Debug)]
142141
#[sol(rpc, all_derives)]
143142
{contract_name},
144143
r#"{contract_path}"#
@@ -188,7 +187,6 @@ fn write_indexer_events(
188187
use alloy::sol;
189188
190189
sol!(
191-
#[derive(Debug)]
192190
#[sol(rpc, all_derives)]
193191
{abigen_contract_name},
194192
r#"{abi_string}"#
@@ -247,8 +245,8 @@ pub fn generate_rindexer_typings(
247245

248246
write_networks(&output, &manifest.networks)?;
249247

250-
if let Some(global) = &manifest.global {
251-
write_global(&output, global, &manifest.networks)?;
248+
if let Some(global_contracts) = &manifest.global.contracts {
249+
write_global(&output, global_contracts, &manifest.networks)?;
252250
}
253251

254252
if manifest.storage.postgres_enabled() {
@@ -497,7 +495,7 @@ edition = "2021"
497495
[dependencies]
498496
rindexer = {{ git = "https://github.com/joshstevens19/rindexer", branch = "master" {reth_dep}}}
499497
tokio = {{ version = "1", features = ["full"] }}
500-
alloy = {{ version = "1.0.30", features = ["full"] }}
498+
alloy = {{ version = "1.0.37", features = ["full"] }}
501499
serde = {{ version = "1.0", features = ["derive"] }}
502500
"#,
503501
project_name = manifest.name,

core/src/generator/context_bindings.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ fn generate_contract_code(
2424
let code = format!(
2525
r#"
2626
sol!(
27-
#[derive(Debug)]
2827
#[sol(rpc, all_derives)]
2928
{contract_name}{network_suffix},
3029
"{contract_path}"
@@ -52,7 +51,6 @@ fn generate_contract_code(
5251
let code = format!(
5352
r#"
5453
sol!(
55-
#[derive(Debug)]
5654
#[sol(rpc, all_derives)]
5755
{contract_name}{network_suffix},
5856
"{contract_path}"
@@ -84,7 +82,7 @@ fn generate_contracts_code(contracts: &[Contract], networks: &[Network]) -> Code
8482
///
8583
/// This file was auto generated by rindexer - https://github.com/joshstevens19/rindexer.
8684
/// Any manual changes to this file will be overwritten.
87-
85+
8886
use super::networks::{{{}}};
8987
use std::sync::Arc;
9088
use alloy::network::AnyNetwork;
@@ -119,10 +117,6 @@ fn generate_contracts_code(contracts: &[Contract], networks: &[Network]) -> Code
119117
output
120118
}
121119

122-
pub fn generate_context_code(contracts: &Option<Vec<Contract>>, networks: &[Network]) -> Code {
123-
if let Some(contracts) = contracts {
124-
generate_contracts_code(contracts, networks)
125-
} else {
126-
Code::blank()
127-
}
120+
pub fn generate_context_code(contracts: &[Contract], networks: &[Network]) -> Code {
121+
generate_contracts_code(contracts, networks)
128122
}

0 commit comments

Comments
 (0)