Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sequencer): rewrite check_tx to be more efficient and fix regression #1515

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion crates/astria-sequencer/src/app/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ pub(crate) async fn initialize_app_with_storage(
.await
.expect("failed to create temp storage backing chain state");
let snapshot = storage.latest_snapshot();
let mempool = Mempool::new();
let metrics = Box::leak(Box::new(Metrics::noop_metrics(&()).unwrap()));
let mempool = Mempool::new(metrics);
let mut app = App::new(snapshot, mempool, metrics).await.unwrap();

let genesis_state = genesis_state.unwrap_or_else(self::genesis_state);
Expand Down
10 changes: 7 additions & 3 deletions crates/astria-sequencer/src/grpc/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ mod tests {
sequencerblock::v1alpha1::SequencerBlock,
};
use cnidarium::StateDelta;
use telemetry::Metrics;

use super::*;
use crate::{
Expand All @@ -246,7 +247,8 @@ mod tests {
async fn test_get_sequencer_block() {
let block = make_test_sequencer_block(1);
let storage = cnidarium::TempStorage::new().await.unwrap();
let mempool = Mempool::new();
let metrics = Box::leak(Box::new(Metrics::noop_metrics(&()).unwrap()));
let mempool = Mempool::new(metrics);
let mut state_tx = StateDelta::new(storage.latest_snapshot());
state_tx.put_block_height(1);
state_tx.put_sequencer_block(block.clone()).unwrap();
Expand All @@ -264,7 +266,8 @@ mod tests {
#[tokio::test]
async fn get_pending_nonce_in_mempool() {
let storage = cnidarium::TempStorage::new().await.unwrap();
let mempool = Mempool::new();
let metrics = Box::leak(Box::new(Metrics::noop_metrics(&()).unwrap()));
let mempool = Mempool::new(metrics);

let alice = get_alice_signing_key();
let alice_address = astria_address(&alice.address_bytes());
Expand Down Expand Up @@ -307,7 +310,8 @@ mod tests {
use crate::accounts::StateWriteExt as _;

let storage = cnidarium::TempStorage::new().await.unwrap();
let mempool = Mempool::new();
let metrics = Box::leak(Box::new(Metrics::noop_metrics(&()).unwrap()));
let mempool = Mempool::new(metrics);
let mut state_tx = StateDelta::new(storage.latest_snapshot());
let alice = get_alice_signing_key();
let alice_address = astria_address(&alice.address_bytes());
Expand Down
4 changes: 3 additions & 1 deletion crates/astria-sequencer/src/mempool/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use sha2::{
Digest as _,
Sha256,
};
use telemetry::Metrics;

use crate::{
app::test_utils::{
Expand Down Expand Up @@ -103,7 +104,8 @@ fn init_mempool<T: MempoolSize>() -> Mempool {
.enable_all()
.build()
.unwrap();
let mempool = Mempool::new();
let metrics = Box::leak(Box::new(Metrics::noop_metrics(&()).unwrap()));
let mempool = Mempool::new(metrics);
let account_mock_balance = mock_balances(0, 0);
let tx_mock_cost = mock_tx_cost(0, 0, 0);
runtime.block_on(async {
Expand Down
Loading
Loading