diff --git a/math/src/stableswap/tests/invariants.rs b/math/src/stableswap/tests/invariants.rs index 1468a7887..a730aeda7 100644 --- a/math/src/stableswap/tests/invariants.rs +++ b/math/src/stableswap/tests/invariants.rs @@ -145,24 +145,3 @@ proptest! { assert!(y >= reserve_a); } } - -proptest! { - #![proptest_config(ProptestConfig::with_cases(1000))] - #[test] - fn round_trip_d_y_4(reserve_a in asset_reserve(), - reserve_b in asset_reserve(), - reserve_c in asset_reserve(), - reserve_e in asset_reserve(), - amp in amplification(), - ) { - let ann = amp * 256u128; // 4^4 - - let reserve_d = 0u128; - - let d = calculate_d::(&[reserve_a, reserve_b, reserve_c, reserve_d, reserve_e], ann).unwrap(); - let y = calculate_y::(&[reserve_b, reserve_c, reserve_d, reserve_e], d, ann).unwrap(); - - assert!(y - 4 <= reserve_a); - assert!(y >= reserve_a); - } -} diff --git a/math/src/stableswap/tests/two_assets.rs b/math/src/stableswap/tests/two_assets.rs index 4a95327f0..13dd98910 100644 --- a/math/src/stableswap/tests/two_assets.rs +++ b/math/src/stableswap/tests/two_assets.rs @@ -24,6 +24,12 @@ fn test_d_with_zero_reserves() { assert_eq!(calculate_d::(&reserves, 1), Some(0u128)); } +#[test] +fn test_d_with_one_zero_reserves() { + let reserves = [1000u128, 0u128]; + assert_eq!(calculate_d::(&reserves, 1), None); +} + #[test] fn test_y_given_in() { let reserves = [1000u128, 2000u128]; @@ -94,12 +100,12 @@ fn test_shares() { let amp = 100u128; let initial_reserves = &[0u128, 0u128]; - let updated_reserves = &[1000 * ONE, 0u128]; + let updated_reserves = &[1000 * ONE, 500u128]; let result = calculate_shares::(initial_reserves, updated_reserves, amp, 0u128); assert!(result.is_some()); - assert_eq!(result.unwrap(), 1_000_000_000_000_000u128); + assert_eq!(result.unwrap(), 928031226918u128); } #[test] fn remove_one_asset_should_work() {