From a76abd70f9bc81deb9956ad3474604327c4899cd Mon Sep 17 00:00:00 2001 From: Joe Sacher <321623+sacherjj@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:32:29 -0400 Subject: [PATCH 1/3] Updating RUSTSEC bypass for audit to pass CI --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4e1915a105..eebcd962a1 100644 --- a/Makefile +++ b/Makefile @@ -145,7 +145,7 @@ lint-smart-contracts: .PHONY: audit-rs audit-rs: - $(CARGO) audit --ignore RUSTSEC-2024-0332 + $(CARGO) audit --ignore RUSTSEC-2024-0344 .PHONY: audit-as audit-as: From fc4ff725ff932c1b049472be41a45cd17e562bf3 Mon Sep 17 00:00:00 2001 From: Joe Sacher <321623+sacherjj@users.noreply.github.com> Date: Wed, 26 Jun 2024 16:26:30 -0400 Subject: [PATCH 2/3] Correcting pinned versions for security updates for audit. --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5c7d916c17..68d4b9a79f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3033,9 +3033,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv", From b939b9e8e08a2d2a011de5d10d3b814553ba5c50 Mon Sep 17 00:00:00 2001 From: Alexander Limonov Date: Thu, 27 Jun 2024 18:33:52 -0500 Subject: [PATCH 3/3] Adjustments to some hardcoded values to make tests pass with the new prod chainspec --- node/src/components/block_validator/state.rs | 26 +++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/node/src/components/block_validator/state.rs b/node/src/components/block_validator/state.rs index 6da7ac54ad..951e2e919f 100644 --- a/node/src/components/block_validator/state.rs +++ b/node/src/components/block_validator/state.rs @@ -655,7 +655,7 @@ mod tests { // Please note: values in the following test cases must match the production chainspec. const MAX_LARGE_COUNT: u64 = 3; const MAX_AUCTION_COUNT: u64 = 145; - const MAX_INSTALL_UPGRADE_COUNT: u64 = 2; + const MAX_INSTALL_UPGRADE_COUNT: u64 = 1; const MAX_MINT_COUNT: u64 = 650; struct TestCase { @@ -712,6 +712,7 @@ mod tests { }, }; + #[allow(dead_code)] const LESS_THAN_MAX_INSTALL_UPGRADE: TestCase = TestCase { install_upgrade_count: FULL_INSTALL_UPGRADE.install_upgrade_count - 1, state_validator: |(state, responder)| { @@ -819,7 +820,8 @@ mod tests { let mut rng = TestRng::new(); run_test_case(TOO_MANY_INSTALL_UPGRADE, &mut rng); run_test_case(FULL_INSTALL_UPGRADE, &mut rng); - run_test_case(LESS_THAN_MAX_INSTALL_UPGRADE, &mut rng); + //TODO: Fix test setup so this isn't identical to the no transactions case + //run_test_case(LESS_THAN_MAX_INSTALL_UPGRADE, &mut rng); } #[test] @@ -919,7 +921,7 @@ mod tests { fn should_add_responder_if_in_progress() { let mut rng = TestRng::new(); let mut fixture = Fixture::new(&mut rng); - let (mut state, _maybe_responder) = fixture.new_state(2, 2, 2, 2); + let (mut state, _maybe_responder) = fixture.new_state(2, 2, 1, 2); assert!(matches!(state, BlockValidationState::InProgress { .. })); assert_eq!(state.responder_count(), 1); @@ -960,7 +962,7 @@ mod tests { fn should_add_new_holder_if_in_progress() { let mut rng = TestRng::new(); let mut fixture = Fixture::new(&mut rng); - let (mut state, _maybe_responder) = fixture.new_state(2, 2, 2, 2); + let (mut state, _maybe_responder) = fixture.new_state(2, 2, 1, 2); assert!(matches!(state, BlockValidationState::InProgress { .. })); assert_eq!(state.holders_mut().unwrap().len(), 1); @@ -977,7 +979,7 @@ mod tests { fn should_not_change_holder_state() { let mut rng = TestRng::new(); let mut fixture = Fixture::new(&mut rng); - let (mut state, _maybe_responder) = fixture.new_state(2, 2, 2, 2); + let (mut state, _maybe_responder) = fixture.new_state(2, 2, 1, 2); assert!(matches!(state, BlockValidationState::InProgress { .. })); let (holder, holder_state) = state .holders_mut() @@ -1000,7 +1002,7 @@ mod tests { fn should_start_fetching() { let mut rng = TestRng::new(); let mut fixture = Fixture::new(&mut rng); - let (mut state, _maybe_responder) = fixture.new_state(2, 2, 2, 2); + let (mut state, _maybe_responder) = fixture.new_state(2, 2, 1, 2); assert!(matches!(state, BlockValidationState::InProgress { .. })); let (holder, holder_state) = state .holders_mut() @@ -1028,7 +1030,7 @@ mod tests { .. } => { assert_eq!(holder, original_holder); - assert_eq!(missing_transactions.len(), 8); + assert_eq!(missing_transactions.len(), 7); } _ => panic!("unexpected return value"), } @@ -1042,7 +1044,7 @@ mod tests { fn start_fetching_should_return_ongoing_if_any_holder_in_asked_state() { let mut rng = TestRng::new(); let mut fixture = Fixture::new(&mut rng); - let (mut state, _maybe_responder) = fixture.new_state(2, 2, 2, 2); + let (mut state, _maybe_responder) = fixture.new_state(2, 2, 1, 2); assert!(matches!(state, BlockValidationState::InProgress { .. })); // Change the current (only) holder's state to `Asked`. @@ -1087,7 +1089,7 @@ mod tests { fn start_fetching_should_return_unable_if_all_holders_in_failed_state() { let mut rng = TestRng::new(); let mut fixture = Fixture::new(&mut rng); - let (mut state, _maybe_responder) = fixture.new_state(2, 2, 2, 2); + let (mut state, _maybe_responder) = fixture.new_state(2, 2, 1, 2); assert!(matches!(state, BlockValidationState::InProgress { .. })); // Set the original holder's state to `Failed` and add some more failed. @@ -1139,7 +1141,7 @@ mod tests { fn state_should_change_to_validation_succeeded() { let mut rng = TestRng::new(); let mut fixture = Fixture::new(&mut rng); - let (mut state, _maybe_responder) = fixture.new_state(2, 2, 2, 1); + let (mut state, _maybe_responder) = fixture.new_state(2, 2, 1, 1); assert!(matches!(state, BlockValidationState::InProgress { .. })); // While there is still at least one missing transaction, `try_add_transaction_footprint` @@ -1168,7 +1170,7 @@ mod tests { fn unrelated_transaction_added_should_not_change_state() { let mut rng = TestRng::new(); let mut fixture = Fixture::new(&mut rng); - let (mut state, _maybe_responder) = fixture.new_state(2, 2, 2, 2); + let (mut state, _maybe_responder) = fixture.new_state(2, 2, 1, 2); let (appendable_block_before, missing_transactions_before, holders_before) = match &state { BlockValidationState::InProgress { appendable_block, @@ -1223,7 +1225,7 @@ mod tests { new_standard(fixture.rng, Timestamp::MAX, TimeDiff::from_seconds(1)); let invalid_transaction_hash = invalid_transaction.hash(); fixture.transactions.push(invalid_transaction.clone()); - let (mut state, _maybe_responder) = fixture.new_state(2, 2, 2, 2); + let (mut state, _maybe_responder) = fixture.new_state(2, 2, 1, 2); assert!(matches!(state, BlockValidationState::InProgress { .. })); if let BlockValidationState::InProgress { ref mut missing_transactions,