Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[audit] 8. Suboptimal storage update #867

Merged
merged 2 commits into from
Aug 11, 2024
Merged

Conversation

NoahSaso
Copy link
Member

@NoahSaso NoahSaso commented Aug 2, 2024

From Oak:

In packages/dao-pre-propose-base/src/execute.rs:199, the execute_update_config function validates the submission_policy parameter in line 213 and updates it to the Config state.

However, this is inefficient because the Config state is retrieved in line 211 before validating the submission policy. If the submission policy does not pass the validation, the loaded storage value (indicated as the prev variable) remains unused.

This fix moves the validation to before the Config state storage read.

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.65%. Comparing base (75272b9) to head (b4ab941).

Additional details and impacted files
@@             Coverage Diff              @@
##           development     #867   +/-   ##
============================================
  Coverage        96.64%   96.65%           
============================================
  Files              240      240           
  Lines            65294    65297    +3     
============================================
+ Hits             63106    63110    +4     
+ Misses            2188     2187    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bekauz bekauz merged commit 85782bd into development Aug 11, 2024
9 checks passed
@bekauz bekauz deleted the noah/rewards-audit-fix-8 branch August 11, 2024 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants