ci: optimize workflow with parallel jobs and better caching (#42)

* ci: optimize performance with better caching and parallel execution

* ci: hybrid pipeline with strategic build->test sequencing

* ci: try other way

* ci: seperate lint too, try ubuntu-latest-arm64 and some cargo optimize keys

* ci: remove ubuntu-latest-arm64

* ci: back to manual cache

* ci: add needs: [build-stable-release] for lint

* ci: fix CI lint and simplify command for lint and doc CI jobs

* chore: alot of clippy warning fix because of new Rust version

* ci: make all the task parallel

* chore: rerun CI workflow
This commit is contained in:
Vinh Trịnh
2025-07-09 12:35:02 +07:00
committed by GitHub
parent 559cc856c0
commit e37a4b435f
9 changed files with 85 additions and 212 deletions

View File

@@ -8,7 +8,7 @@ on:
name: "CI" name: "CI"
env: env:
PROTOC_VERSION: '3.25.3' PROTOC_VERSION: "3.25.3"
jobs: jobs:
lint: lint:
@@ -16,148 +16,70 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install stable toolchain - name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
components: rustfmt, clippy components: rustfmt, clippy
- name: Cache protoc - uses: Swatinem/rust-cache@v2
uses: actions/cache@v4
with: with:
path: ~/.local/bin shared-key: "stable"
key: protoc-${{ env.PROTOC_VERSION }}-${{ runner.os }} - name: Install protoc
restore-keys: |
protoc-${{ env.PROTOC_VERSION }}-
protoc-
- name: install protoc
uses: taiki-e/install-action@v2 uses: taiki-e/install-action@v2
with: with:
tool: protoc@${{ env.PROTOC_VERSION }} tool: protoc@${{ env.PROTOC_VERSION }}
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: rust-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
rust-${{ runner.os }}-
- name: Check formatting - name: Check formatting
run: cargo fmt --all --check run: cargo fmt --all --check
- name: Run clippy - name: Run clippy
run: cargo clippy --all-features --tests -- -D warnings run: cargo clippy --all-features --tests -- -D warnings
unused_dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@nightly
- name: Cache protoc
uses: actions/cache@v4
with:
path: ~/.local/bin
key: protoc-${{ env.PROTOC_VERSION }}-${{ runner.os }}
restore-keys: |
protoc-${{ env.PROTOC_VERSION }}-
protoc-
- name: install protoc
uses: taiki-e/install-action@v2
with:
tool: protoc@${{ env.PROTOC_VERSION }}
- name: Cache cargo-udeps
uses: actions/cache@v4
with:
path: ~/.cargo/bin
key: cargo-udeps-${{ runner.os }}
- name: install cargo-udeps
uses: taiki-e/install-action@cargo-udeps
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: rust-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
rust-${{ runner.os }}-
- name: cargo udeps
run: cargo +nightly udeps
- name: cargo udeps all-targets
run: cargo +nightly udeps --all-targets
docs: docs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with: - name: Install protoc
submodules: 'recursive'
- name: Cache protoc
uses: actions/cache@v4
with:
path: ~/.local/bin
key: protoc-${{ env.PROTOC_VERSION }}-${{ runner.os }}
restore-keys: |
protoc-${{ env.PROTOC_VERSION }}-
protoc-
- name: install protoc
uses: taiki-e/install-action@v2 uses: taiki-e/install-action@v2
with: with:
tool: protoc@${{ env.PROTOC_VERSION }} tool: protoc@${{ env.PROTOC_VERSION }}
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies - uses: Swatinem/rust-cache@v2
uses: actions/cache@v4
with: with:
path: | shared-key: "stable"
~/.cargo/registry - name: Generate documentation
~/.cargo/git
target
key: rust-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
rust-${{ runner.os }}-
- name: "doc --lib --all-features"
run: | run: |
cargo doc --lib --no-deps --all-features --document-private-items cargo doc --lib --no-deps --all-features --document-private-items
env: env:
RUSTDOCFLAGS: -Dwarnings RUSTDOCFLAGS: -Dwarnings
test: test:
needs: [lint, unused_dependencies]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with: with:
submodules: 'recursive' shared-key: "stable"
- name: Cache protoc - name: Install protoc
uses: actions/cache@v4
with:
path: ~/.local/bin
key: protoc-${{ env.PROTOC_VERSION }}-${{ runner.os }}
restore-keys: |
protoc-${{ env.PROTOC_VERSION }}-
protoc-
- name: install protoc
uses: taiki-e/install-action@v2 uses: taiki-e/install-action@v2
with: with:
tool: protoc@${{ env.PROTOC_VERSION }} tool: protoc@${{ env.PROTOC_VERSION }}
- uses: dtolnay/rust-toolchain@stable - name: Test
- name: Cache Rust dependencies run: cargo test --release
uses: actions/cache@v4
unused_dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with: with:
path: | shared-key: "nightly"
~/.cargo/registry - name: Install protoc
~/.cargo/git uses: taiki-e/install-action@v2
target with:
key: rust-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} tool: protoc@${{ env.PROTOC_VERSION }}
restore-keys: | - name: Install cargo-udeps
rust-${{ runner.os }}- uses: taiki-e/install-action@cargo-udeps
- name: Build and test - name: Check for unused dependencies
run: | run: cargo +nightly udeps --all-targets
cargo build --release
cargo test --release

View File

@@ -49,12 +49,12 @@ impl WakuNode<Initialized> {
.expect("Failed to send message to waku"); .expect("Failed to send message to waku");
} }
WakuEvent::RelayTopicHealthChange(evt) => { WakuEvent::RelayTopicHealthChange(evt) => {
info!("Relay topic change evt: {:?}", evt); info!("Relay topic change evt: {evt:?}");
} }
WakuEvent::ConnectionChange(evt) => { WakuEvent::ConnectionChange(evt) => {
info!("Conn change evt: {:?}", evt); info!("Conn change evt: {evt:?}");
} }
WakuEvent::Unrecognized(err) => panic!("Unrecognized waku event: {:?}", err), WakuEvent::Unrecognized(e) => panic!("Unrecognized waku event: {e:?}"),
_ => panic!("event case not expected"), _ => panic!("event case not expected"),
}; };
} }
@@ -65,7 +65,7 @@ impl WakuNode<Initialized> {
.expect("set event call back working"); .expect("set event call back working");
let waku = self.node.start().await.map_err(|e| { let waku = self.node.start().await.map_err(|e| {
debug!("Failed to start the Waku Node: {:?}", e); debug!("Failed to start the Waku Node: {e:?}");
DeliveryServiceError::WakuNodeAlreadyInitialized(e.to_string()) DeliveryServiceError::WakuNodeAlreadyInitialized(e.to_string())
})?; })?;
@@ -94,7 +94,7 @@ impl WakuNode<Running> {
.relay_publish_message(&waku_message, &pubsub_topic(), None) .relay_publish_message(&waku_message, &pubsub_topic(), None)
.await .await
.map_err(|e| { .map_err(|e| {
error!("Failed to relay publish the message: {:?}", e); error!("Failed to relay publish the message: {e:?}");
DeliveryServiceError::WakuPublishMessageError(e) DeliveryServiceError::WakuPublishMessageError(e)
})?; })?;
@@ -106,19 +106,19 @@ impl WakuNode<Running> {
peer_addresses: Vec<Multiaddr>, peer_addresses: Vec<Multiaddr>,
) -> Result<(), DeliveryServiceError> { ) -> Result<(), DeliveryServiceError> {
for peer_address in peer_addresses { for peer_address in peer_addresses {
info!("Connecting to peer: {:?}", peer_address); info!("Connecting to peer: {peer_address:?}");
self.node self.node
.connect(&peer_address, None) .connect(&peer_address, None)
.await .await
.map_err(|e| DeliveryServiceError::WakuConnectPeerError(e.to_string()))?; .map_err(|e| DeliveryServiceError::WakuConnectPeerError(e.to_string()))?;
info!("Connected to peer: {:?}", peer_address); info!("Connected to peer: {peer_address:?}");
} }
Ok(()) Ok(())
} }
pub async fn listen_addresses(&self) -> Result<Vec<Multiaddr>, DeliveryServiceError> { pub async fn listen_addresses(&self) -> Result<Vec<Multiaddr>, DeliveryServiceError> {
let addresses = self.node.listen_addresses().await.map_err(|e| { let addresses = self.node.listen_addresses().await.map_err(|e| {
debug!("Failed to get the listen addresses: {:?}", e); debug!("Failed to get the listen addresses: {e:?}");
DeliveryServiceError::WakuGetListenAddressesError(e) DeliveryServiceError::WakuGetListenAddressesError(e)
})?; })?;
@@ -194,7 +194,7 @@ pub async fn run_waku_node(
while let Some(msg) = reciever.recv().await { while let Some(msg) = reciever.recv().await {
info!("Received message to send to waku"); info!("Received message to send to waku");
let id = waku_node.send_message(msg).await?; let id = waku_node.send_message(msg).await?;
info!("Successfully publish message with id: {:?}", id); info!("Successfully publish message with id: {id:?}");
} }
Ok(()) Ok(())

View File

@@ -44,7 +44,7 @@ pub async fn handle_user_actions(
.retain(|topic| topic.application_name != group_name); .retain(|topic| topic.application_name != group_name);
info!("Leave group: {:?}", &group_name); info!("Leave group: {:?}", &group_name);
let app_message = wrap_conversation_message_into_application_msg( let app_message = wrap_conversation_message_into_application_msg(
format!("You're removed from the group {}", group_name).into_bytes(), format!("You're removed from the group {group_name}").into_bytes(),
"system".to_string(), "system".to_string(),
group_name.clone(), group_name.clone(),
); );
@@ -93,11 +93,8 @@ pub async fn handle_ws_action(
.await?; .await?;
let app_message = wrap_conversation_message_into_application_msg( let app_message = wrap_conversation_message_into_application_msg(
format!( format!("Remove proposal for user {user_to_ban} added to steward queue")
"Remove proposal for user {} added to steward queue", .into_bytes(),
user_to_ban
)
.into_bytes(),
"system".to_string(), "system".to_string(),
group_name.clone(), group_name.clone(),
); );

View File

@@ -325,14 +325,14 @@ impl Group {
/// Get the number of pending proposals for the current epoch /// Get the number of pending proposals for the current epoch
pub async fn get_pending_proposals_count(&self) -> usize { pub async fn get_pending_proposals_count(&self) -> usize {
let count = self.state_machine.get_current_epoch_proposals_count().await; let count = self.state_machine.get_current_epoch_proposals_count().await;
info!("State machine reports {} current epoch proposals", count); info!("State machine reports {count} current epoch proposals");
count count
} }
/// Get the number of pending proposals for the voting epoch /// Get the number of pending proposals for the voting epoch
pub async fn get_voting_proposals_count(&self) -> usize { pub async fn get_voting_proposals_count(&self) -> usize {
let count = self.state_machine.get_voting_epoch_proposals_count().await; let count = self.state_machine.get_voting_epoch_proposals_count().await;
info!("State machine reports {} voting proposals", count); info!("State machine reports {count} voting proposals");
count count
} }

View File

@@ -83,12 +83,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
tokio::select! { tokio::select! {
result = recv_messages => { result = recv_messages => {
if let Err(w) = result { if let Err(w) = result {
error!("Error receiving messages from waku: {}", w); error!("Error receiving messages from waku: {w}");
} }
} }
result = server_task => { result = server_task => {
if let Err(e) = result { if let Err(e) = result {
error!("Error hosting server: {}", e); error!("Error hosting server: {e}");
} }
} }
} }
@@ -110,7 +110,7 @@ async fn run_server(
.with_state(app_state) .with_state(app_state)
.layer(cors); .layer(cors);
info!("Hosted on {:?}", addr); info!("Hosted on {addr:?}");
axum::Server::bind(&addr) axum::Server::bind(&addr)
.serve(app.into_make_service()) .serve(app.into_make_service())
@@ -142,14 +142,14 @@ async fn handle_socket(socket: WebSocket, state: Arc<AppState>) {
if !rooms.contains(&connect.group_id.clone()) { if !rooms.contains(&connect.group_id.clone()) {
rooms.insert(connect.group_id.clone()); rooms.insert(connect.group_id.clone());
} }
info!("Prepare info for main loop: {:?}", main_loop_connection); info!("Prepare info for main loop: {main_loop_connection:?}");
break; break;
} }
Ok(_) => { Ok(_) => {
info!("Got chat message for non-existent user"); info!("Got chat message for non-existent user");
} }
Err(e) => error!("Error handling message: {}", e), Err(e) => error!("Error handling message: {e}"),
} }
} }
@@ -169,10 +169,10 @@ async fn handle_socket(socket: WebSocket, state: Arc<AppState>) {
let content_topic = msg.content_topic.clone(); let content_topic = msg.content_topic.clone();
// Check if message belongs to a relevant topic // Check if message belongs to a relevant topic
if !match_content_topic(&state_clone.content_topics, &content_topic) { if !match_content_topic(&state_clone.content_topics, &content_topic) {
error!("Content topic not match: {:?}", content_topic); error!("Content topic not match: {content_topic:?}");
return; return;
}; };
info!("Received message from waku that matches content topic",); info!("Received message from waku that matches content topic");
let res = handle_user_actions( let res = handle_user_actions(
msg, msg,
state_clone.waku_node.clone(), state_clone.waku_node.clone(),
@@ -183,7 +183,7 @@ async fn handle_socket(socket: WebSocket, state: Arc<AppState>) {
) )
.await; .await;
if let Err(e) = res { if let Err(e) = res {
error!("Error handling waku message: {}", e); error!("Error handling waku message: {e}");
} }
} }
}); });
@@ -201,7 +201,7 @@ async fn handle_socket(socket: WebSocket, state: Arc<AppState>) {
) )
.await; .await;
if let Err(e) = res { if let Err(e) = res {
error!("Error handling websocket message: {}", e); error!("Error handling websocket message: {e}");
} }
} }
}) })

View File

@@ -44,7 +44,7 @@ impl Display for GroupState {
GroupState::Waiting => "Waiting - Steward epoch active", GroupState::Waiting => "Waiting - Steward epoch active",
GroupState::Voting => "Voting - Vote in progress", GroupState::Voting => "Voting - Vote in progress",
}; };
write!(f, "{}", state) write!(f, "{state}")
} }
} }

View File

@@ -328,7 +328,7 @@ impl User {
return Ok(UserAction::DoNothing); return Ok(UserAction::DoNothing);
} }
let ct_name = msg.content_topic.content_topic_name.to_string(); let ct_name = msg.content_topic.content_topic_name.to_string();
info!("Processing waku message from content topic: {:?}", ct_name); info!("Processing waku message from content topic: {ct_name:?}");
match ct_name.as_str() { match ct_name.as_str() {
WELCOME_SUBTOPIC => self.process_welcome_subtopic(msg, group_name).await, WELCOME_SUBTOPIC => self.process_welcome_subtopic(msg, group_name).await,
APP_MSG_SUBTOPIC => self.process_app_subtopic(msg, group_name).await, APP_MSG_SUBTOPIC => self.process_app_subtopic(msg, group_name).await,
@@ -469,7 +469,7 @@ impl User {
} }
// There are proposals, start the steward epoch // There are proposals, start the steward epoch
info!("Starting steward epoch with {} proposals", proposal_count); info!("Starting steward epoch with {proposal_count} proposals");
group.start_steward_epoch().await?; group.start_steward_epoch().await?;
Ok(proposal_count) Ok(proposal_count)
} }
@@ -491,10 +491,7 @@ impl User {
.map(alloy::hex::encode) .map(alloy::hex::encode)
.collect::<Vec<_>>() .collect::<Vec<_>>()
); );
println!( println!("User: start_voting - current user identity: {current_identity}");
"User: start_voting - current user identity: {}",
current_identity
);
let vote_id = uuid::Uuid::new_v4().as_bytes().to_vec(); let vote_id = uuid::Uuid::new_v4().as_bytes().to_vec();
Ok(vote_id) Ok(vote_id)
@@ -522,11 +519,8 @@ impl User {
/// Submit a vote for the given vote ID. /// Submit a vote for the given vote ID.
pub async fn submit_vote(&mut self, vote_id: Vec<u8>, vote: bool) -> Result<(), UserError> { pub async fn submit_vote(&mut self, vote_id: Vec<u8>, vote: bool) -> Result<(), UserError> {
let current_identity = self.identity.identity_string(); let current_identity = self.identity.identity_string();
info!("User: submit_vote - vote_id: {:?}, vote: {}", vote_id, vote); info!("User: submit_vote - vote_id: {vote_id:?}, vote: {vote}");
info!( info!("User: submit_vote - current user identity: {current_identity}");
"User: submit_vote - current user identity: {}",
current_identity
);
Ok(()) Ok(())
} }
@@ -541,7 +535,7 @@ impl User {
None => return Err(UserError::GroupNotFoundError(group_name)), None => return Err(UserError::GroupNotFoundError(group_name)),
}; };
let identity_bytes = alloy::hex::decode(&identity) let identity_bytes = alloy::hex::decode(&identity)
.map_err(|e| UserError::ApplyProposalsError(format!("Invalid hex string: {}", e)))?; .map_err(|e| UserError::ApplyProposalsError(format!("Invalid hex string: {e}")))?;
group.store_remove_proposal(identity_bytes).await?; group.store_remove_proposal(identity_bytes).await?;
Ok(()) Ok(())
} }

View File

@@ -33,7 +33,7 @@ pub async fn create_user_instance(
.map_err(|e| UserError::KameoCreateGroupError(e.to_string()))?; .map_err(|e| UserError::KameoCreateGroupError(e.to_string()))?;
let mut content_topics = build_content_topics(&group_name); let mut content_topics = build_content_topics(&group_name);
info!("Building content topics: {:?}", content_topics); info!("Building content topics: {content_topics:?}");
app_state app_state
.content_topics .content_topics
.lock() .lock()
@@ -41,10 +41,7 @@ pub async fn create_user_instance(
.append(&mut content_topics); .append(&mut content_topics);
if connection.should_create_group { if connection.should_create_group {
info!( info!("User {user_address:?} start sending steward message for group {group_name:?}");
"User {:?} start sending steward message for group {:?}",
user_address, group_name
);
let user_clone = user_ref.clone(); let user_clone = user_ref.clone();
let group_name_clone = group_name.clone(); let group_name_clone = group_name.clone();
tokio::spawn(async move { tokio::spawn(async move {
@@ -62,7 +59,7 @@ pub async fn create_user_instance(
Ok::<(), UserError>(()) Ok::<(), UserError>(())
} }
.await .await
.inspect_err(|e| error!("Error sending steward message to waku: {}", e)); .inspect_err(|e| error!("Error sending steward message to waku: {e}"));
} }
}); });
}; };
@@ -81,7 +78,7 @@ pub async fn handle_steward_flow_per_epoch(
group_name: String, group_name: String,
app_state: Arc<AppState>, app_state: Arc<AppState>,
) -> Result<(), UserError> { ) -> Result<(), UserError> {
info!("Starting steward epoch for group: {}", group_name); info!("Starting steward epoch for group: {group_name}");
// Step 1: Start steward epoch - check for proposals and start epoch if needed // Step 1: Start steward epoch - check for proposals and start epoch if needed
let proposals_count = user let proposals_count = user
@@ -101,22 +98,12 @@ pub async fn handle_steward_flow_per_epoch(
app_state.waku_node.send(msg).await?; app_state.waku_node.send(msg).await?;
if proposals_count == 0 { if proposals_count == 0 {
info!( info!("No proposals to vote on for group: {group_name}, completing epoch without voting");
"No proposals to vote on for group: {}, completing epoch without voting", info!("Steward epoch completed for group: {group_name} (no proposals)");
group_name
);
info!(
"Steward epoch completed for group: {} (no proposals)",
group_name
);
return Ok(()); return Ok(());
} }
info!( info!("Found {proposals_count} proposals to vote on for group: {group_name}");
"Found {} proposals to vote on for group: {}",
proposals_count, group_name
);
// Step 3: Start voting process // Step 3: Start voting process
let vote_id = user let vote_id = user
@@ -126,10 +113,7 @@ pub async fn handle_steward_flow_per_epoch(
.await .await
.map_err(|e| UserError::ProcessProposalsError(e.to_string()))?; .map_err(|e| UserError::ProcessProposalsError(e.to_string()))?;
info!( info!("Started voting with vote_id: {vote_id:?} for group: {group_name}");
"Started voting with vote_id: {:?} for group: {}",
vote_id, group_name
);
// Step 4: Complete voting (in a real implementation, this would wait for actual votes) // Step 4: Complete voting (in a real implementation, this would wait for actual votes)
// For now, we'll simulate the voting process // For now, we'll simulate the voting process
@@ -141,10 +125,7 @@ pub async fn handle_steward_flow_per_epoch(
.await .await
.map_err(|e| UserError::ApplyProposalsError(e.to_string()))?; .map_err(|e| UserError::ApplyProposalsError(e.to_string()))?;
info!( info!("Voting completed with result: {vote_result} for group: {group_name}");
"Voting completed with result: {} for group: {}",
vote_result, group_name
);
// Step 5: If vote passed, apply proposals and complete // Step 5: If vote passed, apply proposals and complete
if vote_result { if vote_result {
@@ -160,15 +141,9 @@ pub async fn handle_steward_flow_per_epoch(
app_state.waku_node.send(msg).await?; app_state.waku_node.send(msg).await?;
} }
info!( info!("Proposals applied and steward epoch completed for group: {group_name}");
"Proposals applied and steward epoch completed for group: {}",
group_name
);
} else { } else {
info!( info!("Vote failed, returning to working state for group: {group_name}");
"Vote failed, returning to working state for group: {}",
group_name
);
} }
user.ask(RemoveProposalsAndCompleteRequest { user.ask(RemoveProposalsAndCompleteRequest {
@@ -177,9 +152,6 @@ pub async fn handle_steward_flow_per_epoch(
.await .await
.map_err(|e| UserError::ApplyProposalsError(e.to_string()))?; .map_err(|e| UserError::ApplyProposalsError(e.to_string()))?;
info!( info!("Removing proposals and completing steward epoch for group: {group_name}");
"Removing proposals and completing steward epoch for group: {}",
group_name
);
Ok(()) Ok(())
} }

View File

@@ -81,10 +81,7 @@ async fn test_invite_users_flow() {
.get_pending_proposals_count(group_name.clone()) .get_pending_proposals_count(group_name.clone())
.await .await
.expect("Failed to get proposal count"); .expect("Failed to get proposal count");
println!( println!("Debug: Proposal count before steward epoch: {proposal_count_before}");
"Debug: Proposal count before steward epoch: {}",
proposal_count_before
);
// Add Bob and Carol to the group initially using steward epoch flow // Add Bob and Carol to the group initially using steward epoch flow
// State machine: start steward epoch, voting, complete voting // State machine: start steward epoch, voting, complete voting
@@ -93,10 +90,7 @@ async fn test_invite_users_flow() {
.await .await
.expect("Failed to start steward epoch"); .expect("Failed to start steward epoch");
println!( println!("Debug: Steward epoch returned {steward_epoch_proposals} proposals");
"Debug: Steward epoch returned {} proposals",
steward_epoch_proposals
);
let vote_id = alice let vote_id = alice
.start_voting(group_name.clone()) .start_voting(group_name.clone())
@@ -146,7 +140,7 @@ async fn test_invite_users_flow() {
.process_waku_message(bob_res_waku_message.clone()) .process_waku_message(bob_res_waku_message.clone())
.await .await
.expect("Failed to process waku message"); .expect("Failed to process waku message");
println!("Alice result: {:?}", res_alice); println!("Alice result: {res_alice:?}");
let res_alice_msg = match res_alice { let res_alice_msg = match res_alice {
UserAction::SendToApp(msg) => msg, UserAction::SendToApp(msg) => msg,
_ => panic!("User action is not SendToApp"), _ => panic!("User action is not SendToApp"),
@@ -170,7 +164,7 @@ async fn test_invite_users_flow() {
) )
.await .await
.expect("Failed to process waku message"); .expect("Failed to process waku message");
println!("Carol result: {:?}", res_carol); println!("Carol result: {res_carol:?}");
let carol_group = carol let carol_group = carol
.get_group(group_name.clone()) .get_group(group_name.clone())
@@ -298,7 +292,7 @@ async fn test_add_user_in_different_epoch() {
); );
// Submit a vote (Alice votes yes for her own proposals) // Submit a vote (Alice votes yes for her own proposals)
println!("Test: Submitting vote with ID: {:?}", vote_id); println!("Test: Submitting vote with ID: {vote_id:?}");
println!("Test: Alice's identity: {}", alice.identity_string()); println!("Test: Alice's identity: {}", alice.identity_string());
alice alice
.submit_vote(vote_id.clone(), true) .submit_vote(vote_id.clone(), true)
@@ -397,7 +391,7 @@ async fn test_add_user_in_different_epoch() {
); );
// Submit a vote (Alice votes yes for her own proposals) // Submit a vote (Alice votes yes for her own proposals)
println!("Test: Submitting vote with ID: {:?}", vote_id); println!("Test: Submitting vote with ID: {vote_id:?}");
println!("Test: Alice's identity: {}", alice.identity_string()); println!("Test: Alice's identity: {}", alice.identity_string());
alice alice
.submit_vote(vote_id.clone(), true) .submit_vote(vote_id.clone(), true)
@@ -446,7 +440,7 @@ async fn test_add_user_in_different_epoch() {
.expect("Failed to process waku message apply commit to the Bob") .expect("Failed to process waku message apply commit to the Bob")
{ {
UserAction::SendToWaku(msg) => { UserAction::SendToWaku(msg) => {
println!("Bob action is SendToWaku: {:?}", msg); println!("Bob action is SendToWaku: {msg:?}");
} }
UserAction::DoNothing => { UserAction::DoNothing => {
println!("Bob action is DoNothing"); println!("Bob action is DoNothing");
@@ -581,10 +575,7 @@ async fn test_remove_user_flow() {
.get_pending_proposals_count(group_name.clone()) .get_pending_proposals_count(group_name.clone())
.await .await
.expect("Failed to get proposal count"); .expect("Failed to get proposal count");
println!( println!("Debug: Proposal count before steward epoch: {proposal_count_before}");
"Debug: Proposal count before steward epoch: {}",
proposal_count_before
);
// Add Bob and Carol to the group initially using steward epoch flow // Add Bob and Carol to the group initially using steward epoch flow
// State machine: start steward epoch, voting, complete voting // State machine: start steward epoch, voting, complete voting
@@ -593,10 +584,7 @@ async fn test_remove_user_flow() {
.await .await
.expect("Failed to start steward epoch"); .expect("Failed to start steward epoch");
println!( println!("Debug: Steward epoch returned {steward_epoch_proposals} proposals");
"Debug: Steward epoch returned {} proposals",
steward_epoch_proposals
);
let vote_id = alice let vote_id = alice
.start_voting(group_name.clone()) .start_voting(group_name.clone())
@@ -646,7 +634,7 @@ async fn test_remove_user_flow() {
.process_waku_message(bob_res_waku_message.clone()) .process_waku_message(bob_res_waku_message.clone())
.await .await
.expect("Failed to process waku message"); .expect("Failed to process waku message");
println!("Alice result: {:?}", res_alice); println!("Alice result: {res_alice:?}");
let res_alice_msg = match res_alice { let res_alice_msg = match res_alice {
UserAction::SendToApp(msg) => msg, UserAction::SendToApp(msg) => msg,
_ => panic!("User action is not SendToApp"), _ => panic!("User action is not SendToApp"),
@@ -670,7 +658,7 @@ async fn test_remove_user_flow() {
) )
.await .await
.expect("Failed to process waku message"); .expect("Failed to process waku message");
println!("Carol result: {:?}", res_carol); println!("Carol result: {res_carol:?}");
let carol_group = carol let carol_group = carol
.get_group(group_name.clone()) .get_group(group_name.clone())
@@ -778,7 +766,7 @@ async fn test_remove_user_flow() {
.expect("Failed to start voting (removal)"); .expect("Failed to start voting (removal)");
// Submit a vote (Alice votes yes for the removal) // Submit a vote (Alice votes yes for the removal)
println!("Test: Submitting vote with ID: {:?}", vote_id); println!("Test: Submitting vote with ID: {vote_id:?}");
println!("Test: Alice's identity: {}", alice.identity_string()); println!("Test: Alice's identity: {}", alice.identity_string());
alice alice
.submit_vote(vote_id.clone(), true) .submit_vote(vote_id.clone(), true)