substrate icon indicating copy to clipboard operation
substrate copied to clipboard

Provide helpful message when incorrectly forcing balance to below ED

Open gilescope opened this issue 2 years ago • 2 comments

Had to debug through some code to find out what was going wrong. This will make it obvious for the next person writing a new test and wondering why setting the balance doesn't work.

I've run all the tests in debug mode to make sure they currently all pass:

cargo nextest run --workspace --locked --verbose --features runtime-benchmarks,try-runtime,experimental
...
Summary [ 702.876s] 5452 tests run: 5452 passed (97 slow), 25 skipped

gilescope avatar Aug 02 '23 11:08 gilescope

Here's another example where we use debug_asserts so I think this is fair game: https://github.com/paritytech/substrate/blob/19eb56a3fc51140b269e339ecb7e9a4a378c26ff/frame/support/src/traits/tokens/fungibles/regular.rs#L549C4-L549C60

gilescope avatar Aug 10 '23 07:08 gilescope

Thanks for the feedback. I've switched it to log an error. I wanted there to be some warning/error in the output when someone runs cargo test. If the log message is just a warning then it's not visible from the command output, so there would be little point. (Could we configure warnings to be displayed when tests are run?)

gilescope avatar Aug 15 '23 16:08 gilescope