Description
To enhance the safety and robustness, various plain data types should be replaced with strongly typed wrappers, to semantically differentiate between them. This applies mostly to numbers and hashes.
The value we get from tooling will be improved too:
- Compiler checking for potential mismatches.
- Self-documenting function signatures. (Rustdoc is capable of looking up functions from signature, precise types help there.)
- I also noticed that lately rust language server does some light type directed search to rank completions.
An incomplete list (feel free to add):
- Booleans (
bool
)- a custom enum is often more expressive and readable, e.g.
ForceUpdate::{Yes, No}
.
- a custom enum is often more expressive and readable, e.g.
- Numbers (
u32
,u64
for most part)- mostly various IDs and indices and counters
NetworkId
,RollupId
RollupIndex
,ExitIndex
EpochNumber
,CertificateHeight
,L1BlockHeight
, ...
- Hashes (
H256
,[u8; 32]
,agglayer_types::Digest
)${WHATEVER}ExitRoot
,L1InfoRoot
< 6C16 /li>CertificateId
Related: