diff --git a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs index a753758d280..8e978fbf383 100644 --- a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs +++ b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs @@ -295,7 +295,8 @@ mod tests { fn test_transaction_accessor() { let proof = raw_instant_asset_lock_proof_fixture(None, None); let tx = proof.transaction(); - assert_eq!(tx.version, 0); + // DIP-0002 special transactions (AssetLock) use version 3. + assert_eq!(tx.version, 3); assert_eq!(tx.lock_time, 0); assert_eq!(tx.input.len(), 1); } diff --git a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/v0/mod.rs b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/v0/mod.rs index b84f8070242..fe354a865a2 100644 --- a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/v0/mod.rs +++ b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/validate_asset_lock_transaction_structure/v0/mod.rs @@ -107,7 +107,7 @@ mod tests { }); Transaction { - version: 0, + version: 3, lock_time: 0, input: inputs, output: vec![burn_output], diff --git a/packages/rs-dpp/src/tests/fixtures/instant_asset_lock_proof_fixture.rs b/packages/rs-dpp/src/tests/fixtures/instant_asset_lock_proof_fixture.rs index f00af679eda..f55590029df 100644 --- a/packages/rs-dpp/src/tests/fixtures/instant_asset_lock_proof_fixture.rs +++ b/packages/rs-dpp/src/tests/fixtures/instant_asset_lock_proof_fixture.rs @@ -98,7 +98,7 @@ pub fn instant_asset_lock_proof_transaction_fixture( }); Transaction { - version: 0, + version: 3, lock_time: 0, input: vec![input], output: vec![burn_output, change_output], diff --git a/packages/rs-drive-abci/tests/strategy_tests/test_cases/identity_and_document_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/test_cases/identity_and_document_tests.rs index c5348471b14..91932028afc 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/test_cases/identity_and_document_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/test_cases/identity_and_document_tests.rs @@ -346,7 +346,7 @@ mod tests { .unwrap() .unwrap() ), - "975735252c11cea7ef3fbba86928077e37ebe1926972e6ae38e237ce0864100c".to_string() + "9d8167b295676ae3ca225170535c043fd8c5c919394ea708247206553a46cbed".to_string() ) } diff --git a/packages/rs-drive-abci/tests/strategy_tests/test_cases/voting_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/test_cases/voting_tests.rs index 0e291083d65..4c7eaa2154c 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/test_cases/voting_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/test_cases/voting_tests.rs @@ -585,27 +585,29 @@ mod tests { assert_eq!(contenders.len(), 2); - let first_contender = contenders.first().unwrap(); - - let second_contender = contenders.last().unwrap(); + // Look up by identity id rather than vec position — see explanatory + // comment in the abstain-only test below. + let identity1_contender = contenders + .iter() + .find(|c| c.identifier == identity1_id.to_vec()) + .expect("identity1 in contenders"); + let identity2_contender = contenders + .iter() + .find(|c| c.identifier == identity2_id.to_vec()) + .expect("identity2 in contenders"); assert_eq!( - first_contender.document.as_ref().map(hex::encode), - Some("00177f2479090a0286a67d6a1f67b563b51518edd6eea0461829f7d630fd65708d29124be7e86f97e959894a67a9cc078c3e0106d4bfcfbf34bc403a4f099925b401000700000187690895980000018769089598000001876908959800077175616e74756d077175616e74756d00046461736800210129124be7e86f97e959894a67a9cc078c3e0106d4bfcfbf34bc403a4f099925b40101".to_string()) + identity1_contender.document.as_ref().map(hex::encode), + Some("0021278016512ff707d45a0aa8893a4b1ba67b08158b31bc2bda11a0addb8ab1f4341e6a8e6c01488a75104a8dbc73501ded5cd23abaf688349a8ab34b1157513201000700000187690895980000018769089598000001876908959800077175616e74756d077175616e74756d000464617368002101341e6a8e6c01488a75104a8dbc73501ded5cd23abaf688349a8ab34b115751320100".to_string()) ); assert_eq!( - second_contender.document.as_ref().map(hex::encode), - Some("00490e212593a1d3cc6ae17bf107ab9cb465175e7877fcf7d085ed2fce27be11d68b8948a6801501bbe0431e3d994dcf71cf5a2a0939fe51b0e600076199aba4fb01000700000187690895980000018769089598000001876908959800077175616e74756d077175616e74756d0004646173680021018b8948a6801501bbe0431e3d994dcf71cf5a2a0939fe51b0e600076199aba4fb0100".to_string()) + identity2_contender.document.as_ref().map(hex::encode), + Some("0010b1d465b94520e76daf018ee6b2740c871d51b7ce9690f60fc7a4a70f1bfd6f3a3c745d6c4d3b88ea52976eaab80dbaa77258885b7b6d8e1edfd00fed72414a01000700000187690895980000018769089598000001876908959800077175616e74756d077175616e74756d0004646173680021013a3c745d6c4d3b88ea52976eaab80dbaa77258885b7b6d8e1edfd00fed72414a0101".to_string()) ); - assert_eq!(first_contender.identifier, identity2_id.to_vec()); - - assert_eq!(second_contender.identifier, identity1_id.to_vec()); - - assert_eq!(first_contender.vote_count, Some(0)); - - assert_eq!(second_contender.vote_count, Some(0)); + assert_eq!(identity1_contender.vote_count, Some(0)); + assert_eq!(identity2_contender.vote_count, Some(0)); } #[stack_size(STACK_SIZE)] @@ -945,21 +947,23 @@ mod tests { assert_eq!(contenders.len(), 2); - let first_contender = contenders.first().unwrap(); - - let second_contender = contenders.last().unwrap(); - - assert!(first_contender.document.is_some()); - - assert!(second_contender.document.is_some()); + // Look up by identity id rather than vec position — contender ordering + // follows identifier sort, which derives from the asset-lock txid and + // shifts whenever the asset-lock fixture's wire format changes. + let identity1_contender = contenders + .iter() + .find(|c| c.identifier == identity1_id.to_vec()) + .expect("identity1 in contenders"); + let identity2_contender = contenders + .iter() + .find(|c| c.identifier == identity2_id.to_vec()) + .expect("identity2 in contenders"); - assert_eq!(first_contender.identifier, identity2_id.to_vec()); + assert!(identity1_contender.document.is_some()); + assert!(identity2_contender.document.is_some()); - assert_eq!(second_contender.identifier, identity1_id.to_vec()); - - assert_eq!(first_contender.vote_count, Some(0)); - - assert_eq!(second_contender.vote_count, Some(0)); + assert_eq!(identity1_contender.vote_count, Some(0)); + assert_eq!(identity2_contender.vote_count, Some(0)); assert_eq!(abstain_vote_tally, Some(124)); } @@ -1306,23 +1310,24 @@ mod tests { assert_eq!(contenders.len(), 2); - let first_contender = contenders.first().unwrap(); - - let second_contender = contenders.last().unwrap(); - - assert!(first_contender.document.is_some()); - - assert!(second_contender.document.is_some()); - - assert_eq!(first_contender.identifier, identity2_id.to_vec()); + // Look up by identity id rather than vec position — see explanatory + // comment in the abstain-only test above. + let identity1_contender = contenders + .iter() + .find(|c| c.identifier == identity1_id.to_vec()) + .expect("identity1 in contenders"); + let identity2_contender = contenders + .iter() + .find(|c| c.identifier == identity2_id.to_vec()) + .expect("identity2 in contenders"); - assert_eq!(second_contender.identifier, identity1_id.to_vec()); + assert!(identity1_contender.document.is_some()); + assert!(identity2_contender.document.is_some()); // All vote counts are weighted, so for evonodes, these are in multiples of 4 - assert_eq!(first_contender.vote_count, Some(52)); - - assert_eq!(second_contender.vote_count, Some(56)); + assert_eq!(identity1_contender.vote_count, Some(56)); + assert_eq!(identity2_contender.vote_count, Some(52)); assert_eq!(lock_vote_tally, Some(16)); @@ -1686,19 +1691,21 @@ mod tests { assert_eq!(contenders.len(), 2); - let first_contender = contenders.first().unwrap(); - - let second_contender = contenders.last().unwrap(); - - assert_eq!(first_contender.identifier, identity2_id.to_vec()); - - assert_eq!(second_contender.identifier, identity1_id.to_vec()); + // Look up by identity id rather than vec position — see explanatory + // comment in the abstain-only test above. + let identity1_contender = contenders + .iter() + .find(|c| c.identifier == identity1_id.to_vec()) + .expect("identity1 in contenders"); + let identity2_contender = contenders + .iter() + .find(|c| c.identifier == identity2_id.to_vec()) + .expect("identity2 in contenders"); // All vote counts are weighted, so for evonodes, these are in multiples of 4 - assert_eq!(first_contender.vote_count, Some(60)); - - assert_eq!(second_contender.vote_count, Some(4)); + assert_eq!(identity1_contender.vote_count, Some(4)); + assert_eq!(identity2_contender.vote_count, Some(60)); assert_eq!(lock_vote_tally, Some(4)); @@ -2086,21 +2093,23 @@ mod tests { assert_eq!(contenders.len(), 2); - let first_contender = contenders.first().unwrap(); - - let second_contender = contenders.last().unwrap(); - - assert_eq!(first_contender.identifier, identity2_id.to_vec()); - - assert_eq!(second_contender.identifier, identity1_id.to_vec()); + // Look up by identity id rather than vec position — see explanatory + // comment in the abstain-only test above. + let identity1_contender = contenders + .iter() + .find(|c| c.identifier == identity1_id.to_vec()) + .expect("identity1 in contenders"); + let identity2_contender = contenders + .iter() + .find(|c| c.identifier == identity2_id.to_vec()) + .expect("identity2 in contenders"); // All vote counts are weighted, so for evonodes, these are in multiples of 4 // 19 votes were cast - assert_eq!(first_contender.vote_count, Some(60)); - - assert_eq!(second_contender.vote_count, Some(4)); + assert_eq!(identity1_contender.vote_count, Some(4)); + assert_eq!(identity2_contender.vote_count, Some(60)); assert_eq!(lock_vote_tally, Some(4)); @@ -2517,24 +2526,27 @@ mod tests { assert_eq!(contenders.len(), 2); - let first_contender = contenders.first().unwrap(); - - let second_contender = contenders.last().unwrap(); - - assert_eq!(first_contender.identifier, identity2_id.to_vec()); - - assert_eq!(second_contender.identifier, identity1_id.to_vec()); + // Look up by identity id rather than vec position — see explanatory + // comment in the abstain-only test above. + let identity1_contender = contenders + .iter() + .find(|c| c.identifier == identity1_id.to_vec()) + .expect("identity1 in contenders"); + let identity2_contender = contenders + .iter() + .find(|c| c.identifier == identity2_id.to_vec()) + .expect("identity2 in contenders"); // All vote counts are weighted, so for evonodes, these are in multiples of 4 assert_eq!( ( - first_contender.vote_count, - second_contender.vote_count, + identity1_contender.vote_count, + identity2_contender.vote_count, lock_vote_tally, abstain_vote_tally ), - (Some(64), Some(8), Some(0), Some(0)) + (Some(8), Some(64), Some(0), Some(0)) ); assert_eq!( diff --git a/packages/rs-drive-abci/tests/strategy_tests/test_cases/withdrawal_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/test_cases/withdrawal_tests.rs index 34166e37cb0..85ab5cd4fbf 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/test_cases/withdrawal_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/test_cases/withdrawal_tests.rs @@ -1666,7 +1666,7 @@ mod tests { assert_eq!( total_credits_balance.total_identity_balances, - 409997575280380 + 409997575173840 ); // Around 4100 Dash. assert_eq!( @@ -2393,7 +2393,7 @@ mod tests { assert_eq!( total_credits_balance.total_identity_balances, - 409997575280380 + 409997575173840 ); // Around 4100 Dash. assert_eq!( diff --git a/packages/strategy-tests/src/transitions.rs b/packages/strategy-tests/src/transitions.rs index 96e873e7ba7..fecb5a66aff 100644 --- a/packages/strategy-tests/src/transitions.rs +++ b/packages/strategy-tests/src/transitions.rs @@ -221,7 +221,7 @@ pub fn instant_asset_lock_proof_transaction_fixture( }); Transaction { - version: 0, + version: 3, lock_time: 0, input: vec![input], output: vec![burn_output, change_output], @@ -305,7 +305,7 @@ pub fn instant_asset_lock_proof_transaction_fixture_with_dynamic_amount( }); Transaction { - version: 0, + version: 3, lock_time: 0, input: vec![input], output: vec![burn_output, change_output],