Skip to content

Commit fc30ca0

Browse files
skaunovcode-pangolin
authored andcommitted
phase out pseudorandom test-case generators (Neptune-Crypto#543)
Closes Neptune-Crypto#110.
1 parent 0c03900 commit fc30ca0

39 files changed

+696
-734
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ tokio-console = ["dep:console-subscriber"]
6363
aead = { version = "0.5", features = ["std"] }
6464
aes-gcm = "0.10"
6565
anyhow = { version = "1.0", features = ["backtrace"] }
66-
arbitrary = { version = "1.3", features = ["derive"], optional = true }
66+
arbitrary = { version = "1.4.1", features = ["derive"], optional = true }
6767
arraystring = { version = "0.3.0", features = ["serde-traits"] }
6868
bech32 = "0.9"
6969
bincode = "1.3"
@@ -137,7 +137,7 @@ deranged = "=0.4.0"
137137
# because they are optional deps but required for unit tests.
138138
# please ensure versions match in both sections.
139139

140-
arbitrary = { version = "1.3", features = ["derive"] }
140+
arbitrary = { version = "1.4.1", features = ["derive"] }
141141
assert2 = "0.3"
142142
blake3 = "1.5.4"
143143
clienter = "0.1.1"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Seeds for failure cases proptest has generated in the past. It is
2+
# automatically read and these particular cases re-run before any
3+
# novel cases are generated.
4+
#
5+
# It is recommended to check this file in to source control so that
6+
# everyone who runs the test benefits from these saved cases.
7+
cc 3f3ee95b494c869c3181f96fd00474e6ba18527614a5ed78ea1971ce87755583 # shrinks to a = 182, b = 23598722
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Seeds for failure cases proptest has generated in the past. It is
2+
# automatically read and these particular cases re-run before any
3+
# novel cases are generated.
4+
#
5+
# It is recommended to check this file in to source control so that
6+
# everyone who runs the test benefits from these saved cases.
7+
cc 277a15bc6084663c6a6ca5ccb79ff247ac2ceb1c9df9190e297a5407d9790cdb # shrinks to input = _CatchInconsistentSharesArgs { n: 3, t: 2, s: XFieldElement { coefficients: [BFieldElement(0), BFieldElement(0), BFieldElement(0)] }, seed_a: [0, 0, 244, 79, 87, 114, 45, 179, 177, 244, 48, 86, 13, 124, 232, 44, 114, 56, 37, 104, 131, 49, 17, 176, 238, 9, 36, 2, 255, 172, 170, 164], seed_b: [105, 12, 160, 18, 138, 166, 133, 34, 94, 44, 149, 193, 199, 222, 211, 45, 27, 217, 192, 16, 2, 208, 146, 151, 249, 142, 227, 112, 135, 211, 186, 210], indices: {0: false, 1: false} }
8+
cc 13273dd6ad615cc44297e5514ef8109f23b9e2b39f4cc7055e0bd6970b8f9a7c # shrinks to input = _CatchTooFewSharesToRecombineArgs { n: 5, t: 2, fromindices_remove_num: 1, s: XFieldElement { coefficients: [BFieldElement(15230334930374689589), BFieldElement(13245717797154725729), BFieldElement(16740857572578077618)] }, seed: [130, 153, 93, 131, 38, 88, 103, 106, 175, 19, 242, 51, 163, 35, 186, 36, 186, 163, 207, 131, 104, 241, 159, 14, 87, 231, 150, 32, 77, 98, 183, 235] }
9+
cc 4adcbb9c7a069d655d530e7e2be1501814339a40f70302335c3bc3bc02f5bfbf # shrinks to input = _CatchTooFewSharesToRecombineArgs { n: 13, t: 4, fromindices_take: 3, s: XFieldElement { coefficients: [BFieldElement(2157574511224767603), BFieldElement(3141929367015615680), BFieldElement(12387067636899090808)] }, seed: [158, 233, 166, 68, 118, 192, 184, 5, 160, 160, 32, 2, 49, 118, 161, 53, 13, 117, 40, 21, 10, 226, 142, 231, 56, 29, 166, 205, 41, 60, 14, 209] }

proptest-regressions/models/state/wallet/wallet_state.txt

Lines changed: 7 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Seeds for failure cases proptest has generated in the past. It is
2+
# automatically read and these particular cases re-run before any
3+
# novel cases are generated.
4+
#
5+
# It is recommended to check this file in to source control so that
6+
# everyone who runs the test benefits from these saved cases.
7+
cc 9a1b149fba15483e9f31a7852760ce8d5df51e9d38b2126f1ddaec0825d1384d # shrinks to input = _PublicAnnouncementsInBlockTestArgs { tx_block1: TransactionKernel { inputs: [], outputs: [AdditionRecord { canonical_commitment: Digest([BFieldElement(0), BFieldElement(0), BFieldElement(0), BFieldElement(0), BFieldElement(0)]) }, AdditionRecord { canonical_commitment: Digest([BFieldElement(0), BFieldElement(0), BFieldElement(0), BFieldElement(0), BFieldElement(0)]) }], public_announcements: [PublicAnnouncement { message: [] }, PublicAnnouncement { message: [] }, PublicAnnouncement { message: [] }, PublicAnnouncement { message: [] }, PublicAnnouncement { message: [] }, PublicAnnouncement { message: [BFieldElement(67425554709697360)] }, PublicAnnouncement { message: [] }], fee: NativeCurrencyAmount(-70685956793913118433183217491150354), coinbase: Some(NativeCurrencyAmount(-7927620070728119810108028777943770)), timestamp: Timestamp(BFieldElement(4891014318722709738)), mutator_set_hash: Digest([BFieldElement(11934671718491951346), BFieldElement(11281373832596201266), BFieldElement(11355207949940880926), BFieldElement(3448036920268554380), BFieldElement(18323932419006503564)]), merge_bit: false, mast_sequences: OnceLock(<uninit>) } }
8+
cc a41693db527e06e59a7f2be3b95304c4cef3e750a99a405319ee6554c48d297b # shrinks to input = _PublicAnnouncementsInBlockTestArgs { tx_block1: TransactionKernel { inputs: [], outputs: [AdditionRecord { canonical_commitment: Digest([BFieldElement(0), BFieldElement(0), BFieldElement(0), BFieldElement(0), BFieldElement(0)]) }, AdditionRecord { canonical_commitment: Digest([BFieldElement(0), BFieldElement(0), BFieldElement(0), BFieldElement(0), BFieldElement(0)]) }], public_announcements: [PublicAnnouncement { message: [BFieldElement(0), BFieldElement(9321591543486476998), BFieldElement(14573288706066622957), BFieldElement(9270886323901199519), BFieldElement(6734302117330064099), BFieldElement(16315627936601254197), BFieldElement(1178352053662224171), BFieldElement(8562213646120173239), BFieldElement(14793640925920860846), BFieldElement(7689510137104745238)] }, PublicAnnouncement { message: [BFieldElement(5850826884696472421), BFieldElement(10698350416477277912), BFieldElement(13415571233392094868), BFieldElement(9369934884966037034), BFieldElement(1662925058444927082), BFieldElement(7719516251173924890), BFieldElement(5373964820120010726), BFieldElement(10610712547096075267), BFieldElement(11399396361836030022), BFieldElement(13510348934276136326), BFieldElement(9085767833742476303), BFieldElement(5723913007932892529), BFieldElement(14231465034676843008), BFieldElement(6743161496293035502), BFieldElement(2749227069055044627), BFieldElement(18036348259610191480), BFieldElement(5492289514897661826), BFieldElement(1816896152465294170), BFieldElement(11544661119781190865), BFieldElement(12871712508422676972), BFieldElement(5126909686560286199), BFieldElement(4106022111572319076), BFieldElement(4065245845049566976), BFieldElement(8435945931257478577), BFieldElement(581043917489909685), BFieldElement(15460116745659416903), BFieldElement(11595981507090494167), BFieldElement(10449461704944053966), BFieldElement(2348631313570448087), BFieldElement(9927913115758177289), BFieldElement(2633819268146899658), BFieldElement(10669540681299957084), BFieldElement(5013673220773961496), BFieldElement(3948526355233602916), BFieldElement(998937149810993859), BFieldElement(3130813340322589295), BFieldElement(16942730675331240903), BFieldElement(6739880786431782644), BFieldElement(1658810169485282839), BFieldElement(4680543269938070822), BFieldElement(4635403039071193656), BFieldElement(9284534826280127145), BFieldElement(9668509141778854314), BFieldElement(18154100913628760140), BFieldElement(6790729872447145021), BFieldElement(11405845389050366412), BFieldElement(2148834898663828983), BFieldElement(10394265723755212783), BFieldElement(6493915292875594243), BFieldElement(12365884486086245291), BFieldElement(17067169933775367752), BFieldElement(5940587059403139278), BFieldElement(5126795535245805706), BFieldElement(968779048322462424), BFieldElement(16406133146074705194), BFieldElement(12848833384879852395), BFieldElement(17404328651326943881)] }, PublicAnnouncement { message: [BFieldElement(7594660911295056224), BFieldElement(9005093803197862104), BFieldElement(15025730599736576353), BFieldElement(7914242664642492317), BFieldElement(12018369970623897564), BFieldElement(9872731862978059190), BFieldElement(13894353222482954917), BFieldElement(5477190326445056532), BFieldElement(15805830104178530499), BFieldElement(18290222969886878371), BFieldElement(5809929793795126022), BFieldElement(14375298667674961713), BFieldElement(4708049240228224037), BFieldElement(7418504464344747364), BFieldElement(3933733290989638003), BFieldElement(481998146018717127), BFieldElement(12284253152957971365), BFieldElement(15386012654265221971), BFieldElement(13095150001978380178), BFieldElement(295382796281590133), BFieldElement(8620366749541598725), BFieldElement(1304791959912836792), BFieldElement(15032448768365563164), BFieldElement(5739589016008141687), BFieldElement(13327138790541052286), BFieldElement(15815768633216926923), BFieldElement(6870536856369804543), BFieldElement(13847281322079990768), BFieldElement(17867324372895401144), BFieldElement(7460365984828993082), BFieldElement(12571143625909199848), BFieldElement(3658343088136045555), BFieldElement(8268888862926619393), BFieldElement(14224805658164422154), BFieldElement(16285394648147870757)] }, PublicAnnouncement { message: [BFieldElement(7439523716026445599), BFieldElement(16506073198336684448), BFieldElement(8705287737056517607), BFieldElement(8231651265310199470), BFieldElement(8882080563348816394), BFieldElement(10981566394564037466), BFieldElement(9944193038408968910), BFieldElement(2673945369351400012), BFieldElement(18410912251055652393), BFieldElement(13529496378182984936), BFieldElement(17507505312805448836), BFieldElement(17093662154025067297), BFieldElement(13577695661611463010), BFieldElement(14027539052546300427), BFieldElement(14320401750441668324), BFieldElement(4642063197896523367), BFieldElement(11435512758271904425), BFieldElement(3594000353401027283), BFieldElement(12948518030387709580), BFieldElement(13872249565484404042), BFieldElement(13711630440439798972), BFieldElement(3055460397186942638), BFieldElement(4471839359132047087), BFieldElement(7252155648573431983), BFieldElement(15488590433812695552), BFieldElement(3073337756105039874), BFieldElement(17524778332946899191), BFieldElement(2992524196386455437), BFieldElement(2680138085677036979), BFieldElement(4833235556042958219), BFieldElement(12699725177376044034), BFieldElement(10023777893194050836), BFieldElement(15269608515504270087), BFieldElement(1068170828386830562), BFieldElement(4028999331936546181), BFieldElement(5058503403519597591), BFieldElement(18155019592594960458), BFieldElement(4673416853673096741), BFieldElement(18193416338625244637), BFieldElement(15033419402450607093), BFieldElement(2820245543402743989), BFieldElement(1287191723978980010), BFieldElement(3163286325826709282), BFieldElement(12820804990350095894), BFieldElement(5974568893285562216), BFieldElement(5229511236206493934), BFieldElement(7531764728822743164), BFieldElement(13540153938888160563), BFieldElement(16591155923905484307), BFieldElement(15548338335182666774), BFieldElement(2907711232935622352), BFieldElement(13364481892358474264), BFieldElement(3324677873674596074), BFieldElement(7924880984895465917), BFieldElement(15828564237640882969)] }, PublicAnnouncement { message: [BFieldElement(3165922451199185807), BFieldElement(9189718261240953031), BFieldElement(17776659556933552908), BFieldElement(1311034704645877024), BFieldElement(5202296038206071929), BFieldElement(7411088882245642516), BFieldElement(14558620641619267447), BFieldElement(10675027321315435128), BFieldElement(598665310789595969), BFieldElement(7819087183872051628), BFieldElement(12056578678418623332), BFieldElement(6486259572712224753), BFieldElement(826095746329047719)] }, PublicAnnouncement { message: [BFieldElement(10724539382916705974), BFieldElement(1303220643318753185), BFieldElement(9473115488117201169), BFieldElement(18414856417842107025), BFieldElement(13025091628248206563), BFieldElement(17528284268534257198), BFieldElement(5429883350585155873), BFieldElement(556130114172974692), BFieldElement(961897794049784841), BFieldElement(8967399253274453237), BFieldElement(8717640694119776425), BFieldElement(3407239960751345411), BFieldElement(11910891741869293262), BFieldElement(3089303601062184614), BFieldElement(6412325466307238772), BFieldElement(13520523155363096809), BFieldElement(13210311521673699752), BFieldElement(14313262878921039267), BFieldElement(16375763654579367188), BFieldElement(10723868226945010993), BFieldElement(17899760067805144176), BFieldElement(6796570027146899127), BFieldElement(9843358327620200645), BFieldElement(10878971082324431167), BFieldElement(17633750723062498615), BFieldElement(5423225153423790055)] }, PublicAnnouncement { message: [BFieldElement(15063874826012908280), BFieldElement(11794845301655914544), BFieldElement(68103292217826961), BFieldElement(7664254457830799794), BFieldElement(9752717190870353867), BFieldElement(7707108688065508978), BFieldElement(11616340567884692049), BFieldElement(8311508965875839190), BFieldElement(4761161030291574899), BFieldElement(1008348757178514264), BFieldElement(9372206087471090780), BFieldElement(2077983553569022931), BFieldElement(7138630344912605983), BFieldElement(8851221038629380645), BFieldElement(13851104793546852152), BFieldElement(12508746294651885015), BFieldElement(3522013474798245655), BFieldElement(12931322237949325250), BFieldElement(10615197952485630066), BFieldElement(14073208853836752003), BFieldElement(17723075682634902071), BFieldElement(5864566181164094734)] }], fee: NativeCurrencyAmount(-80189601208177427720452833441052689), coinbase: None, timestamp: Timestamp(BFieldElement(81953083721190621)), mutator_set_hash: Digest([BFieldElement(1209579961828006965), BFieldElement(17845347245891483320), BFieldElement(8689404300665274380), BFieldElement(12557353202409237661), BFieldElement(10895426204171946523)]), merge_bit: true, mast_sequences: OnceLock(<uninit>) } }
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Seeds for failure cases proptest has generated in the past. It is
2+
# automatically read and these particular cases re-run before any
3+
# novel cases are generated.
4+
#
5+
# It is recommended to check this file in to source control so that
6+
# everyone who runs the test benefits from these saved cases.
7+
cc beb87393cd159b94e90456b0d4ed98d512823341049f1e2470baf26dc6444b05 # shrinks to input = _RemovalRecordMissingChunkElementIsInvalidPbtArgs { initial_additions: 33, index_to_drop: 14, to_remove_rand: 94615430264692362 }
8+
cc 188cbdc2fcf5f21fdde330e2184199074a1488a21447491a0a2a6659913eda64 # shrinks to input = _RemovalRecordMissingChunkElementIsInvalidPbtArgs { initial_additions: 38, index_to_drop: 2, to_remove_rand: 792244780276861568 }
9+
cc 43e028e16e3a6e23838fdb9ab81b37b5e6b06979332cd7661363e7f42bfa4e00 # shrinks to input = _RemovalRecordMissingChunkElementIsInvalidPbtArgs { initial_additions: 68, index_to_drop: 4, to_remove_rand: 22 }

src/api/api_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ impl Api {
5858
}
5959

6060
/// retrieve a transaction recipient in mutable context.
61-
pub fn wallet_mut(&mut self) -> api::wallet::Wallet {
61+
pub fn wallet_mut(&mut self) -> api::wallet::Wallet<'_> {
6262
self.global_state_lock.clone().into()
6363
}
6464

6565
/// retrieve a transaction recipient in immutable context.
66-
pub fn wallet(&self) -> api::wallet::Wallet {
66+
pub fn wallet(&self) -> api::wallet::Wallet<'_> {
6767
self.global_state_lock.clone().into()
6868
}
6969
}

src/bin/dashboard_src/dashboard_app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ impl DashboardApp {
287287
Ok(())
288288
}
289289

290-
pub fn current_screen(&mut self) -> RefMut<dyn Screen> {
290+
pub fn current_screen(&mut self) -> RefMut<'_, dyn Screen> {
291291
self.screens
292292
.get(&self.current_menu_item)
293293
.unwrap()

src/database/leveldb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ impl<'a> Iterable<'a> for DbIntMut {
327327
}
328328

329329
impl Snapshots for DbIntMut {
330-
fn snapshot(&self) -> Snapshot {
330+
fn snapshot(&self) -> Snapshot<'_> {
331331
self.db.as_ref().unwrap().snapshot()
332332
}
333333
}
@@ -567,7 +567,7 @@ impl<'a> Iterable<'a> for DB {
567567
}
568568

569569
impl Snapshots for DB {
570-
fn snapshot(&self) -> Snapshot {
570+
fn snapshot(&self) -> Snapshot<'_> {
571571
self.0.snapshot()
572572
}
573573
}

src/locks/std/atomic_mutex.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl<T> AtomicMutex<T> {
225225
/// let atomic_car = AtomicMutex::from(Car{year: 2016});
226226
/// let year = atomic_car.lock_guard().year;
227227
/// ```
228-
pub fn lock_guard(&self) -> AtomicMutexGuard<T> {
228+
pub fn lock_guard(&self) -> AtomicMutexGuard<'_, T> {
229229
self.try_acquire_read_cb();
230230
let guard = self.inner.lock().expect("Read lock should succeed");
231231
AtomicMutexGuard::new(guard, &self.lock_callback_info, LockAcquisition::Read)
@@ -242,7 +242,7 @@ impl<T> AtomicMutex<T> {
242242
/// let mut atomic_car = AtomicMutex::from(Car{year: 2016});
243243
/// atomic_car.lock_guard_mut().year = 2022;
244244
/// ```
245-
pub fn lock_guard_mut(&mut self) -> AtomicMutexGuard<T> {
245+
pub fn lock_guard_mut(&mut self) -> AtomicMutexGuard<'_, T> {
246246
self.try_acquire_write_cb();
247247
let guard = self.inner.lock().expect("Write lock should succeed");
248248
AtomicMutexGuard::new(guard, &self.lock_callback_info, LockAcquisition::Write)

0 commit comments

Comments
 (0)