Skip to content

Instantly share code, notes, and snippets.

View bedeho's full-sized avatar
🎯
Focusing

Bedeho Mender bedeho

🎯
Focusing
View GitHub Profile
bedeho / Joystream
I keep asking about how modules should deal with possible panic resulting from broken invariants, sorry to go on about it, but here is another one:
I am reading the democracy module, and from what I am seeing, when the staked amount assocaited with a preimage is released, an operation is initiated which may fail, from a static point of view, namely repatraite_reserved. Now obviously, if this reservation logic has been correctly managed, this is not possible during runtime. However, in the codepath, the error case is explicitly ignored by doing let _ = repatraite .... This is sort of a silent way of handling broken invaraints.
a) am I understanding this correctly
b) is it correct that this approach to dealing with broken invaraints is prevalent in the Substrate/Polkadot code base, even more so than the approach of trying to report errors for broken invariants
shawntabrizi