OpenZeppelin / rust-contracts-stylus

A library for secure smart contract development written in Rust
MIT License
70 stars 18 forks source link

[Audit]: N-03 Inconsistent Error Types #336

Open bidzyyys opened 3 days ago

bidzyyys commented 3 days ago

What is the feature you would like to see?

Throughout the codebase, there are some extensions that use associated error types to allow users the flexibility to assign a generic Vec as an error type and encode any error that is needed (or not return an error at all), while others do not use this error style. For example, in the IERC20 trait of the ERC20 implementation. Consider using a consistent error style to avoid confusion and improve code clarity.

Contribution Guidelines

bidzyyys commented 3 days ago

The solution is to have the trait and associated error type to enable implementers to define custom errors throughout. It may not be the cleanest approach but seems like the most flexible.