Skip to content

Commit 871e69e

Browse files
committed
No longer randomly generate outcome zero
1 parent a0c4a65 commit 871e69e

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

src/actions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ pub fn strat_tiny_mint_into_burn_outcomes(
143143
use proptest::collection::vec;
144144
(
145145
strat_uniq_outcomes(2, max_outcomes),
146-
vec(any::<Address>(), 0..=max_referrers),
146+
vec(any::<Address>(), 2..=max_referrers),
147147
)
148148
.prop_flat_map(move |(outs, refs)| {
149149
let outs2 = outs.clone();

src/utils.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,27 @@ pub fn strat_fixed_bytes<const N: usize>() -> impl proptest::prelude::Strategy<V
188188
strat_fixed_bytes_sizeable::<N>(Uintsize::Large)
189189
}
190190

191+
#[cfg(all(feature = "testing", not(target_arch = "wasm32")))]
192+
pub fn strat_outcome_not_zero() -> impl proptest::prelude::Strategy<Value = FixedBytes<8>> {
193+
([
194+
1..u8::MAX,
195+
0..u8::MAX,
196+
0..u8::MAX,
197+
0..u8::MAX,
198+
0..u8::MAX,
199+
0..u8::MAX,
200+
0..u8::MAX,
201+
0..u8::MAX,
202+
])
203+
.prop_map(FixedBytes::<8>::new)
204+
}
205+
191206
#[cfg(all(feature = "testing", not(target_arch = "wasm32")))]
192207
pub fn strat_uniq_outcomes(
193208
lower: usize,
194209
upper: usize,
195210
) -> impl Strategy<Value = Vec<FixedBytes<8>>> {
196-
proptest::collection::btree_set(any::<FixedBytes<8>>(), lower..=upper)
211+
proptest::collection::btree_set(strat_outcome_not_zero(), lower..=upper)
197212
.prop_map(|s| s.into_iter().collect())
198213
}
199214

tests/amm_pred.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,4 +1342,4 @@ def simulate_market_0x9d86E956d55e1AfDaC5910b581f7ec4322B65704_1640358():
13421342
print("simulation result", market.sell(3, market.inverse_sell(3,14.843,"Alice"), "Alice"))
13431343

13441344
if __name__ == "__main__":
1345-
simulate_market_16()
1345+
simulate_market_3()

0 commit comments

Comments
 (0)