Closed sherlock-admin3 closed 13 hours ago
Passive Indigo Dolphin
Low/Info
The codebase is polluted with various constraint checks. This checks could easily be handled to give better error messages than the default which is been used.
constraint
try_query.rs (!wooconfig.paused)
swap.rs
incase_token_got_stuck.rs
These are just few examples of the above scenarios in which there are constraint checks but insufficient error handling
These can make it harder for the developer to debug the cause of an issue in the case of an instruction not passing
No response
Add an error message to the error file and then use the added error message in your account struct to easily handle it.
This can then be called with constraint = token_vault.mint == token_mint.key() @ ErrorCode::InvalidMint has_one = authority @ ErrorCode::WrongAuthority
constraint = token_vault.mint == token_mint.key() @ ErrorCode::InvalidMint
has_one = authority @ ErrorCode::WrongAuthority
Reference
Passive Indigo Dolphin
Low/Info
Error messages due to constraint violation can be handled better
Summary
The codebase is polluted with various
constraint
checks. This checks could easily be handled to give better error messages than the default which is been used.Root Cause
try_query.rs (!wooconfig.paused)
swap.rs
incase_token_got_stuck.rs
These are just few examples of the above scenarios in which there are
constraint
checks but insufficient error handlingImpact
These can make it harder for the developer to debug the cause of an issue in the case of an instruction not passing
PoC
No response
Mitigation
Add an error message to the error file and then use the added error message in your account struct to easily handle it.
This can then be called with
constraint = token_vault.mint == token_mint.key() @ ErrorCode::InvalidMint
has_one = authority @ ErrorCode::WrongAuthority
Reference