Skip to content

Commit d3c7f9f

Browse files
committed
Merge branch 'main' into bancor
Former-commit-id: 953fed8
2 parents 5a1aed7 + f861027 commit d3c7f9f

Some content is hidden

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

43 files changed

+3341
-1652
lines changed

Cargo.lock

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+9-10
Original file line numberDiff line numberDiff line change
@@ -172,24 +172,23 @@ redefined = { git = "https://github.com/SorellaLabs/redefined" }
172172
bytes = "1.5"
173173

174174
arrow = "51.0.0"
175-
polars = { version = "0.38.3", features = ["lazy"]}
176-
parquet = {version = "51.0.0", features = ["async"] }
175+
polars = { version = "0.38.3", features = ["lazy"] }
176+
parquet = { version = "51.0.0", features = ["async"] }
177177
indicatif = "0.17.8"
178178

179179

180-
[profile.dev]
181-
opt-level = 0
180+
[profile.release]
181+
lto = "thin"
182+
strip = "debuginfo"
183+
184+
[profile.debug-fast]
185+
inherits = "release"
186+
strip = "none"
182187
debug = true
183-
rpath = false
184-
lto = false
185-
debug-assertions = true
186-
codegen-units = 16
187-
incremental = true
188188

189189

190190
[profile.maxperf]
191191
inherits = "release"
192192
lto = "fat"
193193
codegen-units = 1
194194
incremental = false
195-

crates/bin/Cargo.toml

+7
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ metrics-process.workspace = true
8282
itertools.workspace = true
8383
fdlimit = "0.3.0"
8484

85+
tikv-jemallocator = { version = "0.5.0", features = [
86+
"unprefixed_malloc_on_supported_platforms",
87+
] }
8588

8689
[features]
8790
default = [
@@ -90,8 +93,12 @@ default = [
9093
"brontes-classifier/default",
9194
"brontes-inspect/default",
9295
"pretty-print",
96+
"jemalloc",
9397
]
9498

99+
jemalloc = []
100+
jemalloc-prof = ["jemalloc", "tikv-jemallocator/profiling"]
101+
95102
sorella-server = ["local-reth", "local-clickhouse"]
96103

97104
cex-dex-markout = [

crates/bin/src/cli/db/db_clear.rs

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ impl Clear {
4949
AddressMeta,
5050
SearcherEOAs,
5151
SearcherContracts,
52-
SubGraphs,
5352
TxTraces
5453
)
5554
});

crates/bin/src/cli/db/db_insert.rs

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ impl Insert {
4747
MevBlocks,
4848
AddressToProtocolInfo,
4949
TokenDecimals,
50-
SubGraphs,
5150
TxTraces,
5251
Builder,
5352
AddressMeta,

crates/bin/src/cli/db/db_query.rs

-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ impl DatabaseQuery {
7979
AddressMeta,
8080
SearcherEOAs,
8181
SearcherContracts,
82-
SubGraphs,
8382
TxTraces
8483
);
8584
} else {
@@ -99,7 +98,6 @@ impl DatabaseQuery {
9998
AddressMeta,
10099
SearcherEOAs,
101100
SearcherContracts,
102-
SubGraphs,
103101
TxTraces,
104102
PoolCreationBlocks = &self.key
105103
);

crates/bin/src/cli/utils.rs

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use brontes_core::local_provider::LocalProvider;
77
use brontes_database::clickhouse::Clickhouse;
88
#[cfg(not(feature = "local-clickhouse"))]
99
use brontes_database::clickhouse::ClickhouseHttpClient;
10+
#[cfg(all(feature = "local-clickhouse", feature = "local-no-inserts"))]
11+
use brontes_database::clickhouse::ClickhouseMiddleware;
1012
#[cfg(all(feature = "local-clickhouse", not(feature = "local-no-inserts")))]
1113
use brontes_database::clickhouse::ClickhouseMiddleware;
1214
#[cfg(all(feature = "local-clickhouse", not(feature = "local-no-inserts")))]

crates/bin/src/executors/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ impl<T: TracingProvider, DB: LibmdbxInit, CH: ClickhouseHandle, P: Processor>
9797
}
9898
}
9999

100-
/*
101-
./target/release/brontes run --start-block 18500000 --end-block 18500100 --brontes-db-path /home/data/brontes-joe-db --init-crit-tables -vvv
102-
*/
103-
104100
//TODO: We currently don't have the ability to stream the query results from
105101
// clickhouse because the client is shit, so we have to break up the downloads
106102
// into smaller batches & wait for these smaller queries to return to write all

crates/bin/src/main.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
use std::{env, error::Error};
22

3+
#[cfg(all(feature = "jemalloc", unix))]
4+
#[global_allocator]
5+
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
6+
37
use brontes::{
48
cli::{Args, Commands},
59
runner,

crates/brontes-classifier/src/classifiers/uniswap/uniswap_v3.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ action_impl!(
7171
|
7272
info: CallInfo,
7373
call_data: mintCall,
74-
return_data: mintReturn, logs: UniswapV3MintCallLogs, db_tx: &DB| {
75-
let owner = logs.mint_field?.owner;
74+
return_data: mintReturn, _logs: UniswapV3MintCallLogs, db_tx: &DB| {
7675
let token_0_delta = return_data.amount0;
7776
let token_1_delta = return_data.amount1;
7877
let details = db_tx.get_protocol_details_sorted(info.target_address)?;
@@ -87,7 +86,7 @@ action_impl!(
8786
Ok(NormalizedMint {
8887
protocol: Protocol::UniswapV3,
8988
trace_index: info.trace_idx,
90-
from: owner,
89+
from: info.from_address,
9190
recipient: call_data.recipient,
9291
pool: info.target_address,
9392
token: vec![t0_info, t1_info],

crates/brontes-database/src/clickhouse/db_client.rs

+8-12
Original file line numberDiff line numberDiff line change
@@ -379,21 +379,19 @@ impl ClickhouseHandle for Clickhouse {
379379

380380
let data: Vec<RawCexQuotes> = match range_or_arbitrary {
381381
CexRangeOrArbitrary::Range(..) => {
382-
let start_time = (block_times
382+
let start_time = block_times
383383
.iter()
384384
.min_by_key(|b| b.timestamp)
385385
.map(|b| b.timestamp)
386386
.unwrap() as f64
387-
- self.cex_download_config.time_window.0)
388-
* SECONDS_TO_US;
387+
- (self.cex_download_config.time_window.0 * SECONDS_TO_US);
389388

390-
let end_time = (block_times
389+
let end_time = block_times
391390
.iter()
392391
.max_by_key(|b| b.timestamp)
393392
.map(|b| b.timestamp)
394393
.unwrap() as f64
395-
+ self.cex_download_config.time_window.1)
396-
* SECONDS_TO_US;
394+
+ (self.cex_download_config.time_window.1 * SECONDS_TO_US);
397395

398396
let query = format!("{RAW_CEX_QUOTES} AND ({exchanges_str})");
399397

@@ -477,21 +475,19 @@ impl ClickhouseHandle for Clickhouse {
477475

478476
let data: Vec<RawCexTrades> = match range_or_arbitrary {
479477
CexRangeOrArbitrary::Range(..) => {
480-
let start_time = (block_times
478+
let start_time = block_times
481479
.iter()
482480
.min_by_key(|b| b.timestamp)
483481
.map(|b| b.timestamp)
484482
.unwrap() as f64
485-
- self.cex_download_config.time_window.0)
486-
* SECONDS_TO_US;
483+
- (self.cex_download_config.time_window.0 * SECONDS_TO_US);
487484

488-
let end_time = (block_times
485+
let end_time = block_times
489486
.iter()
490487
.max_by_key(|b| b.timestamp)
491488
.map(|b| b.timestamp)
492489
.unwrap() as f64
493-
+ self.cex_download_config.time_window.1)
494-
* SECONDS_TO_US;
490+
+ (self.cex_download_config.time_window.1 * SECONDS_TO_US);
495491

496492
let query = format!("{RAW_CEX_TRADES} AND ({exchanges_str})");
497493

crates/brontes-database/src/clickhouse/middleware.rs

+1-17
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use brontes_types::{
1818
pair::Pair,
1919
structured_trace::TxTrace,
2020
traits::TracingProvider,
21-
BlockTree, FastHashMap, Protocol, SubGraphEdge,
21+
BlockTree, FastHashMap, Protocol,
2222
};
2323
use indicatif::ProgressBar;
2424

@@ -310,14 +310,6 @@ impl<I: LibmdbxInit> LibmdbxReader for ClickhouseMiddleware<I> {
310310
self.inner.protocols_created_range(start_block, end_block)
311311
}
312312

313-
fn try_load_pair_before(
314-
&self,
315-
block: u64,
316-
pair: Pair,
317-
) -> eyre::Result<(Pair, Vec<SubGraphEdge>)> {
318-
self.inner.try_load_pair_before(block, pair)
319-
}
320-
321313
fn get_protocol_details(&self, address: Address) -> eyre::Result<ProtocolInfo> {
322314
self.inner.get_protocol_details(address)
323315
}
@@ -574,14 +566,6 @@ impl<I: LibmdbxInit> LibmdbxReader for ReadOnlyMiddleware<I> {
574566
self.inner.protocols_created_range(start_block, end_block)
575567
}
576568

577-
fn try_load_pair_before(
578-
&self,
579-
block: u64,
580-
pair: Pair,
581-
) -> eyre::Result<(Pair, Vec<SubGraphEdge>)> {
582-
self.inner.try_load_pair_before(block, pair)
583-
}
584-
585569
fn get_protocol_details(&self, address: Address) -> eyre::Result<ProtocolInfo> {
586570
self.inner.get_protocol_details(address)
587571
}

0 commit comments

Comments
 (0)