You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem: If a Validator is already registered there is no need of further processing. Check for same is missing
Recommendation: Add a check to verify if the given validator is already whitelisted in which case directly return. Use is_valid_validator in state.rs for this purpose
anchor_basset_hub contract :: execute_register_validator function
Function: execute_register_validator
Contract: https://github.com/Anchor-Protocol/anchor-bAsset-contracts/blob/master/contracts/anchor_basset_hub/src/config.rs#L114
Problem: If a Validator is already registered there is no need of further processing. Check for same is missing
Recommendation: Add a check to verify if the given validator is already whitelisted in which case directly return. Use is_valid_validator in state.rs for this purpose
gov contract :: withdraw_voting_tokens function
Function: withdraw_voting_tokens
Contract: https://github.com/code-423n4/2022-02-anchor/blob/main/contracts/anchor-token-contracts/contracts/gov/src/staking.rs#L87
Problem: Gas is wasted if withdraw_share is computed as 0
Recommendation: Add a check for withdraw_share>0, otherwise return
gov contract :: create_poll function
Function: create_poll
Contract: https://github.com/code-423n4/2022-02-anchor/blob/main/contracts/anchor-token-contracts/contracts/gov/src/contract.rs#L281
Recommendation: Change state.poll_count += 1; to state.poll_count = poll_id; to perform gas saving
gov contract :: cast_vote
Function: cast_vote
Contract: https://github.com/code-423n4/2022-02-anchor/blob/main/contracts/anchor-token-contracts/contracts/gov/src/contract.rs#L582
Problem: If amount is 0 then user vote gets wasted and also cause gas wastage
Recommendation: check amount!=0
community contract :: execute function
Function: execute
Contract: https://github.com/code-423n4/2022-02-anchor/blob/main/contracts/anchor-token-contracts/contracts/community/src/contract.rs#L35
Recommendation:
Since both function require governance, governance check can be placed in execute instead of placing individually in UpdateConfig and Spend as done in https://github.com/code-423n4/2022-02-anchor/blob/main/contracts/anchor-token-contracts/contracts/vesting/src/contract.rs
anchor_basset_reward :: execute_increase_balance/execute_decrease_balance
Function: execute_increase_balance/execute_decrease_balance
Contract:
https://github.com/code-423n4/2022-02-anchor/blob/main/contracts/anchor-bAsset-contracts/contracts/anchor_basset_reward/src/user.rs#L80
https://github.com/code-423n4/2022-02-anchor/blob/main/contracts/anchor-bAsset-contracts/contracts/anchor_basset_reward/src/user.rs#L125
Recommendation:
In both the function add a check for amount!=0
The text was updated successfully, but these errors were encountered: