Skip to content

Commit

Permalink
Clean up branch and split docker production to remove it and only all…
Browse files Browse the repository at this point in the history
…ow manual in future commit
  • Loading branch information
AurelienFT committed Nov 12, 2024
1 parent fd4bc3b commit 40ada1a
Show file tree
Hide file tree
Showing 12 changed files with 432 additions and 507 deletions.
412 changes: 2 additions & 410 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

427 changes: 427 additions & 0 deletions .github/workflows/docker-images.yml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion crates/fuel-core/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2599,7 +2599,6 @@ mod tests {
// One of two transactions is skipped.
assert_eq!(skipped_transactions.len(), 1);
let err = &skipped_transactions[0].1;
dbg!(err);
assert!(matches!(
err,
&ExecutorError::TransactionValidity(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ fn _worst_case__correctly_calculates_value(
let change_amount = expected.saturating_mul(percentage).saturating_div(100);
expected = expected.saturating_add(change_amount);
}
dbg!(actual, expected);
assert!(actual >= expected);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ fn _worst_case__correctly_calculates_value(

let expected = expected_exec_price.saturating_add(expected_da_gas_price);

dbg!(actual, expected);
assert!(actual >= expected);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,6 @@ async fn interval_trigger_even_if_queued_tx_events() {
let block_creation_waiter = block_creation_notifier.clone();
tokio::task::spawn(async move {
ctx.block_import.recv().await.unwrap();
dbg!("First block produced");
block_creation_notifier.notify_waiters();
});
block_creation_waiter.notified().await;
Expand Down
1 change: 0 additions & 1 deletion crates/services/sync/src/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ where
pub async fn import(&self, shutdown: &mut StateWatcher) -> anyhow::Result<bool> {
self.import_inner(shutdown).await?;

dbg!("waiting for notify or shutdown");
Ok(wait_for_notify_or_shutdown(&self.notify, shutdown).await)
}

Expand Down
86 changes: 1 addition & 85 deletions crates/services/sync/src/import/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ use crate::{
MockConsensusPort,
MockPeerToPeerPort,
PeerReportReason,
},
state::Status,
sync::SyncHeights,
}
};
use fuel_core_services::stream::IntoBoxStream;
use fuel_core_types::services::p2p::Transactions;
use mockall::Sequence;
use std::time::Duration;

use super::*;
Expand Down Expand Up @@ -279,86 +275,6 @@ async fn import__signature_fails_on_header_4_only() {
assert_eq!((State::new(3, None), false), res);
}

#[tokio::test]
async fn test() {
let (_tx, shutdown) = tokio::sync::watch::channel(fuel_core_services::State::Started);
let mut watcher = shutdown.into();
// given
let observed_height_stream =
futures::stream::iter([2, 2, 2, 2, 2].into_iter().map(BlockHeight::from))
.into_boxed();
let committed_height_stream = futures::stream::iter([]).into_boxed();
let mut p2p = MockPeerToPeerPort::default();
let mut seq = Sequence::new();
p2p.expect_get_sealed_block_headers()
.times(1)
.in_sequence(&mut seq)
.returning(|_| {
dbg!("error p2p");
Err(anyhow::anyhow!("Some network error"))
});
p2p.expect_get_sealed_block_headers()
.times(1)
.in_sequence(&mut seq)
.returning(|_| {
let peer = random_peer();
let headers = Some(vec![empty_header(2)]);
let headers = peer.bind(headers);
Ok(headers)
});
p2p.expect_get_transactions()
.times(1)
.in_sequence(&mut seq)
.returning(|block_ids| {
let data = block_ids.data;
let v = data.into_iter().map(|_| Transactions::default()).collect();
Ok(Some(v))
});
p2p.expect_report_peer().returning(|_, _| Ok(()));
let state = SharedMutex::new(State::new(1, None));
let notify = Arc::new(Notify::new());
let p2p = Arc::new(p2p);
let executor: Arc<MockBlockImporterPort> = Arc::new(DefaultMocks::times([1]));
let consensus: Arc<MockConsensusPort> = Arc::new(DefaultMocks::times([1]));
let params = Config {
block_stream_buffer_size: 10,
header_batch_size: 10,
};
let import = Import {
state: state.clone(),
notify: notify.clone(),
params,
p2p,
executor,
consensus,
};
let mut sync_heights = SyncHeights::new(
observed_height_stream,
committed_height_stream,
state.clone(),
notify.clone(),
);

tokio::spawn(async move {
let mut should_continue = true;
while should_continue {
should_continue = import.import(&mut watcher).await.unwrap_or(true);
}
});
sync_heights.sync().await.unwrap();
let mut verif = false;
while !verif {
verif = state.lock().status() == &Status::Committed(1);
tokio::time::sleep(Duration::from_millis(100)).await;
}
sync_heights.sync().await.unwrap();
let mut verif = false;
while !verif {
verif = state.lock().status() == &Status::Committed(2);
tokio::time::sleep(Duration::from_millis(100)).await;
}
}

#[tokio::test]
async fn import__header_not_found() {
// given
Expand Down
2 changes: 0 additions & 2 deletions crates/services/sync/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ impl State {
#[tracing::instrument]
/// Record that a block has been observed.
pub fn observe(&mut self, height: u32) -> bool {
dbg!(&height);
let new_status = match &self.status {
// Currently uninitialized so process from the start to the observed height.
Status::Uninitialized => Some(Status::Processing(0..=height)),
Expand All @@ -141,7 +140,6 @@ impl State {
(!r.is_empty()).then_some(Status::Processing(r))
}),
};
dbg!(&new_status);
let status_change = new_status.is_some();
self.apply_status(new_status);
status_change
Expand Down
2 changes: 0 additions & 2 deletions crates/services/sync/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use crate::state::State;
#[cfg(test)]
mod tests;

#[derive(Debug)]
pub(crate) enum IncomingHeight {
Observed(BlockHeight),
Committed(BlockHeight),
Expand Down Expand Up @@ -64,7 +63,6 @@ impl SyncHeights {
IncomingHeight::Observed(height) => self.state.apply(|s| s.observe(*height)),
};
if state_change {
dbg!("notify");
self.notify.notify_one();
}
Some(())
Expand Down
1 change: 0 additions & 1 deletion tests/tests/dos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ async fn complex_queries__100_block_headers__works() {
let url = format!("http://{}/v1/graphql", node.bound_address);

let result = send_graph_ql_query(&url, query).await;
dbg!(&result);
assert!(result.contains("transactions"));
}

Expand Down
4 changes: 2 additions & 2 deletions tests/tests/poa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ mod p2p {
// after the first_producer stops, second_producer should start producing blocks
#[tokio::test(flavor = "multi_thread")]
async fn test_poa_multiple_producers() {
const SYNC_TIMEOUT: u64 = 5;
const TIME_UNTIL_SYNCED: u64 = SYNC_TIMEOUT + 5;
const SYNC_TIMEOUT: u64 = 30;
const TIME_UNTIL_SYNCED: u64 = SYNC_TIMEOUT + 10;

info!("Starting test_poa_multiple_producers");
let mut rng = StdRng::seed_from_u64(2222);
Expand Down

0 comments on commit 40ada1a

Please sign in to comment.