galacticcouncil / galacticcouncil/Basilisk-node

consider using defensive traits where appropriate

Open
#573 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
73
Forks
23
PR merge metrics
No merged PRs in 30d

Description

Consider using defensive traits

https://github.com/paritytech/substrate/blob/master/frame/support/src/traits/misc.rs

where it would be appropriate and helpful.

Mostly places where you expect infallible code ( basically places where comments such as "cannot happen" , "should not happen", "it is safe because of previous condition" are found,)

Eg.
- defensive_ok_or
- defensive_saturating_add
- etc.

This would be helpful in following way:

1. it panics on debug_assertion, which means if you reach this error in tests, it panics.
2. it logs error in production using runtime logging system. Which might help detecting potential problems.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.