Skip to content

Commit

Permalink
feat(user-ops-indexer): rewrite to alloy (#1165)
Browse files Browse the repository at this point in the history
* feat: rewrite to alloy

* chore: more refactor

* chore: update feature flags

* chore: bump alloy

* chore: use alloy macroses

* chore: node client enum

* chore: refactor parsing logic

* chore: bump sea-orm and laucher
  • Loading branch information
k1rill-fedoseev authored Jan 23, 2025
1 parent 0cf48c3 commit dff4888
Show file tree
Hide file tree
Showing 40 changed files with 3,408 additions and 3,568 deletions.
5,215 changes: 2,488 additions & 2,727 deletions user-ops-indexer/Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion user-ops-indexer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ members = [
]

[workspace.dependencies]
blockscout-service-launcher = "0.13.2"
blockscout-service-launcher = "0.16.2"
1 change: 1 addition & 0 deletions user-ops-indexer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ found [here](../docs/common-envs.md).
| `USER_OPS_INDEXER__INDEXER__PAST_DB_LOGS_INDEXER__ENABLED` | | Enable one-time reindex of missed user operations from core Blockscout DB. Will query relevant events from `logs` Postgres table | `false` |
| `USER_OPS_INDEXER__INDEXER__PAST_DB_LOGS_INDEXER__START_BLOCK` | | Block range start for one-time DB reindex. Use positive number for static block number, or zero/negative number to count backwards from `latest` | `0` |
| `USER_OPS_INDEXER__INDEXER__PAST_DB_LOGS_INDEXER__END_BLOCK` | | Block range end for one-time DB reindex. Use positive number for static block number, or zero/negative number to count backwards from `latest` | `0` |
| `USER_OPS_INDEXER__INDEXER__TRACE_CLIENT` | | RPC tracing namespace to use for tracing transactions, `debug` for using `debug_traceTransaction`, `trace` for using `trace_transaction` | Depends on `web3_clientVersion` |
| `USER_OPS_INDEXER__DATABASE__CONNECT__URL` | true | Postgres connect URL to Blockscout DB with read/write access | (empty) |
| `USER_OPS_INDEXER__DATABASE__CREATE_DATABASE` | | Create database if doesn't exist | `false` |
| `USER_OPS_INDEXER__DATABASE__RUN_MIGRATIONS` | | Run database migrations | `false` |
Expand Down
2 changes: 1 addition & 1 deletion user-ops-indexer/user-ops-indexer-entity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ name = "entity"
path = "src/lib.rs"

[dependencies]
sea-orm = { version = "0.12.2", features = [ "sqlx-postgres", "runtime-tokio-rustls", "macros" ] }
sea-orm = { version = "1.0.1", features = [ "sqlx-postgres", "runtime-tokio-rustls", "macros" ] }

2 changes: 1 addition & 1 deletion user-ops-indexer/user-ops-indexer-entity/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.4
pub mod prelude;

Expand Down
2 changes: 1 addition & 1 deletion user-ops-indexer/user-ops-indexer-entity/src/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.4
pub use super::user_operations::Entity as UserOperations;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.4
use sea_orm::entity::prelude::*;

Expand All @@ -17,12 +17,12 @@ pub enum EntryPointVersion {
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "sponsor_type")]
pub enum SponsorType {
#[sea_orm(string_value = "paymaster_hybrid")]
PaymasterHybrid,
#[sea_orm(string_value = "paymaster_sponsor")]
PaymasterSponsor,
#[sea_orm(string_value = "wallet_balance")]
WalletBalance,
#[sea_orm(string_value = "wallet_deposit")]
WalletDeposit,
#[sea_orm(string_value = "wallet_balance")]
WalletBalance,
#[sea_orm(string_value = "paymaster_sponsor")]
PaymasterSponsor,
#[sea_orm(string_value = "paymaster_hybrid")]
PaymasterHybrid,
}
34 changes: 17 additions & 17 deletions user-ops-indexer/user-ops-indexer-entity/src/user_operations.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.4
use super::sea_orm_active_enums::{EntryPointVersion, SponsorType};
use sea_orm::entity::prelude::*;
Expand All @@ -9,16 +9,16 @@ pub struct Model {
#[sea_orm(
primary_key,
auto_increment = false,
column_type = "Binary(BlobSize::Blob(None))"
column_type = "VarBinary(StringLen::None)"
)]
pub hash: Vec<u8>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub sender: Vec<u8>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub nonce: Vec<u8>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub init_code: Option<Vec<u8>>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub call_data: Vec<u8>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))")]
pub call_gas_limit: BigDecimal,
Expand All @@ -30,33 +30,33 @@ pub struct Model {
pub max_fee_per_gas: BigDecimal,
#[sea_orm(column_type = "Decimal(Some((100, 0)))")]
pub max_priority_fee_per_gas: BigDecimal,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub paymaster_and_data: Option<Vec<u8>>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub signature: Vec<u8>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub aggregator: Option<Vec<u8>>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub aggregator_signature: Option<Vec<u8>>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub entry_point: Vec<u8>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub transaction_hash: Vec<u8>,
pub block_number: i32,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub block_hash: Vec<u8>,
pub bundle_index: i32,
pub index: i32,
pub user_logs_start_index: i32,
pub user_logs_count: i32,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub bundler: Vec<u8>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub factory: Option<Vec<u8>>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub paymaster: Option<Vec<u8>>,
pub status: bool,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub revert_reason: Option<Vec<u8>>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))")]
pub gas: BigDecimal,
Expand Down
30 changes: 6 additions & 24 deletions user-ops-indexer/user-ops-indexer-logic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,36 @@ edition = "2021"
[dependencies]
user-ops-indexer-entity = { path = "../user-ops-indexer-entity" }
user-ops-indexer-proto = { path = "../user-ops-indexer-proto" }
blockscout-db = { git = "https://github.com/blockscout/blockscout-rs", rev = "bb2eb15" }
blockscout-db = { git = "https://github.com/blockscout/blockscout-rs", rev = "8f2caa9" }

atoi = "2.0.0"
anyhow = "1.0"
blockscout-display-bytes = "1.0"
bytes = "1.2"
ethabi = "18.0"
ethers-core = "2.0.0"
hex = "0.4"
mismatch = "1.0"
sea-orm = { version = "0.12.2", features = [
sea-orm = { version = "1.0.1", features = [
"sqlx-postgres",
"runtime-tokio-rustls",
"macros",
"postgres-array",
] }
futures = "0.3"
keccak-hash = "0.10.0"
lazy_static = "1"
prometheus = "0.13"
reqwest = "0.11.18"
semver = "1.0"
serde = "1.0"
serde_json = "1.0"
solidity-metadata = "1.0"
thiserror = "1.0"
tokio = { version = "1.22", features = ["sync"] }
tonic = { version = "0.8", features = ["tls-roots"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
ethers = { version = "2.0.11", features = ["ws"] }
num-traits = "0.2.17"
itertools = "0.11.0"
chrono = "0.4.31"
lru = "0.12.2"
async-trait = "0.1.77"
serde_with = "3.6.1"
alloy = { version = "0.9.2", features = ["contract", "pubsub", "provider-debug-api", "provider-trace-api"] }
thiserror = "2.0.9"

[dev-dependencies]
async-trait = "0.1"
blockscout-service-launcher = { workspace = true, features = ["test-database", "database-0_12"] }
blockscout-service-launcher = { workspace = true, features = ["test-database", "database-1_0"] }
user-ops-indexer-migration = { path = "../user-ops-indexer-migration" }
mockall = "0.11"
pretty_assertions = "1.3"
rstest = "0.18.0"
sea-orm = { version = "*", features = ["mock"] }
tokio-stream = { version = "0.1", features = ["net"] }
url = "2.4.0"
sea-orm = { version = "1.0.1", features = ["mock"] }

[features]
# When activated includes helper methods for tests and benchmarking
Expand Down
Loading

0 comments on commit dff4888

Please sign in to comment.