reduce coefficient

This commit is contained in:
Petar Radovic 2026-04-09 14:29:36 +02:00
parent 0eb389b62c
commit a8202603b6
2 changed files with 37 additions and 21 deletions

View File

@ -14,4 +14,9 @@ export CFG_FILE_PATH="/config.yaml" \
# Download deployment settings generated by cfgsync
curl -sf "${CFG_SERVER_ADDR}/deployment-settings" -o /deployment-settings.yaml
# Single-node test setup: bump slot_activation_coeff from 1/10 to 1/2 so blocks
# (and LIB) advance ~5x faster, keeping the indexer integration test within budget.
# Safe with 1 node since there are no reorgs.
sed -i '/slot_activation_coeff:/{n;n;s/denominator: 10/denominator: 2/}' /deployment-settings.yaml
exec /usr/bin/logos-blockchain-node /config.yaml --deployment /deployment-settings.yaml

View File

@ -17,27 +17,46 @@ use nssa::AccountId;
use tokio::test;
use wallet::cli::{Command, programs::native_token_transfer::AuthTransferSubcommand};
/// Timeout in milliseconds to reliably await for block finalization.
/// Maximum time to wait for the indexer to catch up to the sequencer.
const L2_TO_L1_TIMEOUT_MILLIS: u64 = 900_000;
/// Poll the indexer until its last finalized block id reaches the sequencer's
/// current last block id (and at least the genesis block has been advanced past),
/// or until [`L2_TO_L1_TIMEOUT_MILLIS`] elapses. Returns the last indexer block
/// id observed.
async fn wait_for_indexer_to_catch_up(ctx: &TestContext) -> u64 {
let deadline = tokio::time::Instant::now() + Duration::from_millis(L2_TO_L1_TIMEOUT_MILLIS);
loop {
let seq = sequencer_service_rpc::RpcClient::get_last_block_id(ctx.sequencer_client())
.await
.unwrap_or(0);
let ind = ctx
.indexer_client()
.get_last_finalized_block_id()
.await
.unwrap_or(1);
if ind >= seq && ind > 1 {
info!("Indexer caught up: seq={seq}, ind={ind}");
return ind;
}
if tokio::time::Instant::now() >= deadline {
info!("Indexer catch-up timed out: seq={seq}, ind={ind}");
return ind;
}
tokio::time::sleep(Duration::from_secs(2)).await;
}
}
#[test]
async fn indexer_test_run() -> Result<()> {
let ctx = TestContext::new().await?;
// RUN OBSERVATION
tokio::time::sleep(std::time::Duration::from_millis(L2_TO_L1_TIMEOUT_MILLIS)).await;
let last_block_indexer = wait_for_indexer_to_catch_up(&ctx).await;
let last_block_seq =
sequencer_service_rpc::RpcClient::get_last_block_id(ctx.sequencer_client()).await?;
info!("Last block on seq now is {last_block_seq}");
let last_block_indexer = ctx
.indexer_client()
.get_last_finalized_block_id()
.await
.unwrap();
info!("Last block on ind now is {last_block_indexer}");
assert!(last_block_indexer > 1);
@ -49,15 +68,8 @@ async fn indexer_test_run() -> Result<()> {
async fn indexer_block_batching() -> Result<()> {
let ctx = TestContext::new().await?;
// WAIT
info!("Waiting for indexer to parse blocks");
tokio::time::sleep(std::time::Duration::from_millis(L2_TO_L1_TIMEOUT_MILLIS)).await;
let last_block_indexer = ctx
.indexer_client()
.get_last_finalized_block_id()
.await
.unwrap();
let last_block_indexer = wait_for_indexer_to_catch_up(&ctx).await;
info!("Last block on ind now is {last_block_indexer}");
@ -152,9 +164,8 @@ async fn indexer_state_consistency() -> Result<()> {
info!("Successfully transferred privately to owned account");
// WAIT
info!("Waiting for indexer to parse blocks");
tokio::time::sleep(std::time::Duration::from_millis(L2_TO_L1_TIMEOUT_MILLIS)).await;
wait_for_indexer_to_catch_up(&ctx).await;
let acc1_ind_state = ctx
.indexer_client()
@ -240,7 +251,7 @@ async fn indexer_state_consistency_with_labels() -> Result<()> {
assert_eq!(acc_2_balance, 20100);
info!("Waiting for indexer to parse blocks");
tokio::time::sleep(std::time::Duration::from_millis(L2_TO_L1_TIMEOUT_MILLIS)).await;
wait_for_indexer_to_catch_up(&ctx).await;
let acc1_ind_state = ctx
.indexer_client()