Skip to content

Commit

Permalink
dev(rpc): cleaning (#1289)
Browse files Browse the repository at this point in the history
fix gitignore + some small rework
  • Loading branch information
greged93 authored Jul 13, 2024
1 parent 3cee3db commit 1c2b250
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,9 @@ artifacts/
build/
.kakarot/

# ignore katana dump directory
.katana/
!.katana/messaging_config.json

# ignore proptest-regressions
/proptest-regressions
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ install-katana:
cargo install --git https://github.com/dojoengine/dojo --locked --tag v0.7.3-alpha.0 katana

katana-genesis: install-katana
rm -fr .katana/ && mkdir .katana
cargo run --bin katana_genesis --features testing

run-katana: katana-genesis
Expand Down
9 changes: 5 additions & 4 deletions src/retry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ where

loop {
let start_time_fn = Instant::now();
if let Err(err) = self.retry_and_prune().await {
if let Err(err) = self.process_pending_transactions().await {
tracing::error!("Error while retrying transactions: {:?}", err);
}
let elapsed_time_ms = start_time_fn.elapsed().as_millis();
Expand All @@ -93,8 +93,9 @@ where
});
}

/// Retries and prunes pending transactions.
async fn retry_and_prune(&self) -> Result<()> {
/// Processes all current pending transactions by retrying them
/// and pruning them if necessary.
async fn process_pending_transactions(&self) -> Result<()> {
let pending_transactions = self.pending_transactions().await?;
for transaction in pending_transactions {
if self.should_retry(&transaction).await? {
Expand Down Expand Up @@ -192,7 +193,7 @@ mod tests {

for i in 0..*TRANSACTION_MAX_RETRIES + 2 {
// Retry transactions.
retry_handler.retry_and_prune().await.expect("Failed to retry transactions");
retry_handler.process_pending_transactions().await.expect("Failed to retry transactions");

// Retrieve the retried transactions.
let retried = retry_handler.retried.lock().await.clone();
Expand Down
4 changes: 2 additions & 2 deletions src/tracing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ impl<P: EthereumProvider + Send + Sync + Clone> Tracer<P> {
}

/// Traces the provided transactions using the given closure.
/// The function `transact_and_get_traces` closure uses the `env` and `db` to create an evm
/// which is then used to transact and trace the transaction.
/// The `convert_result` closure takes the resulting tracing result
/// and converts it into the desired type.
fn trace_transactions<T>(
self,
convert_result: fn(TracingResult) -> Option<Vec<T>>,
Expand Down

0 comments on commit 1c2b250

Please sign in to comment.