Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Ref docs for safe_defensive_programming #44

Closed
Tracked by #39
juangirini opened this issue Nov 9, 2023 · 0 comments · Fixed by paritytech/polkadot-sdk#2615
Closed
Tracked by #39

Ref docs for safe_defensive_programming #44

juangirini opened this issue Nov 9, 2023 · 0 comments · Fixed by paritytech/polkadot-sdk#2615
Assignees

Comments

@juangirini
Copy link

juangirini commented Nov 9, 2023

Create the reference docs as part of the Developer Hub -> https://github.com/paritytech/polkadot-sdk/blob/9c2b3eaa8c05f4f25809e87f1890679261cd1e03/developer-hub/src/reference_docs/mod.rs#L52

The focus should be: Learn about how to write safe and defensive code in your FRAME runtime.

@juangirini juangirini changed the title safe_defensive_programming @CrackTheCode016 Ref docs for safe_defensive_programming Nov 9, 2023
@juangirini juangirini moved this to In Progress in Polkadot SDK Docs Nov 9, 2023
@juangirini juangirini moved this from In Progress to Review in Polkadot SDK Docs Jan 2, 2024
github-merge-queue bot pushed a commit to paritytech/polkadot-sdk that referenced this issue Mar 20, 2024
_This PR is being continued from
#2206, which was closed
when the developer_hub was merged._
closes paritytech/polkadot-sdk-docs#44

---
# Description

This PR adds a reference document to the `developer-hub` crate (see
#2102). This specific
reference document covers defensive programming practices common within
the context of developing a runtime with Substrate.

In particular, this covers the following areas: 

- Default behavior of how Rust deals with numbers in general
- How to deal with floating point numbers in runtime / fixed point
arithmetic
- How to deal with Integer overflows
- General "safe math" / defensive programming practices for common
pallet development scenarios
- Defensive traits that exist within Substrate, i.e.,
`defensive_saturating_add `, `defensive_unwrap_or`
- More general defensive programming examples (keep it concise)
- Link to relevant examples where these practices are actually in
production / being used
- Unwrapping (or rather lack thereof) 101

todo
-- 
- [x] Apply feedback from previous PR
- [x] This may warrant a PR to append some of these docs to
`sp_arithmetic`

---------

Co-authored-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: Gonçalo Pestana <[email protected]>
Co-authored-by: Kian Paimani <[email protected]>
Co-authored-by: Francisco Aguirre <[email protected]>
Co-authored-by: Radha <[email protected]>
@github-project-automation github-project-automation bot moved this from Review to Done in Polkadot SDK Docs Mar 20, 2024
dharjeezy pushed a commit to dharjeezy/polkadot-sdk that referenced this issue Mar 24, 2024
_This PR is being continued from
paritytech#2206, which was closed
when the developer_hub was merged._
closes paritytech/polkadot-sdk-docs#44

---
# Description

This PR adds a reference document to the `developer-hub` crate (see
paritytech#2102). This specific
reference document covers defensive programming practices common within
the context of developing a runtime with Substrate.

In particular, this covers the following areas: 

- Default behavior of how Rust deals with numbers in general
- How to deal with floating point numbers in runtime / fixed point
arithmetic
- How to deal with Integer overflows
- General "safe math" / defensive programming practices for common
pallet development scenarios
- Defensive traits that exist within Substrate, i.e.,
`defensive_saturating_add `, `defensive_unwrap_or`
- More general defensive programming examples (keep it concise)
- Link to relevant examples where these practices are actually in
production / being used
- Unwrapping (or rather lack thereof) 101

todo
-- 
- [x] Apply feedback from previous PR
- [x] This may warrant a PR to append some of these docs to
`sp_arithmetic`

---------

Co-authored-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: Gonçalo Pestana <[email protected]>
Co-authored-by: Kian Paimani <[email protected]>
Co-authored-by: Francisco Aguirre <[email protected]>
Co-authored-by: Radha <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.