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

Refactor loading of gov proposals for execution #2630

Merged
merged 4 commits into from Apr 12, 2024

Conversation

brentstone
Copy link
Contributor

@brentstone brentstone commented Feb 15, 2024

Describe your changes

Governance proposals were previously loaded every single block, which was a pointless operation. This logic is now coupled more tightly with the execution of the proposals, occurring only once per epoch within a function that loads and then executes.

Proposals are now clearly executed at the beginning of the grace epoch. The previously decoupled logic made it such that proposals were actually executed at the begging of grace_epoch + 1.

This logic is removed from the Shell and reimplemented in the governance crate.

Indicate on which release or other PRs this topic is based on

v0.32.1

Checklist before merging to draft

  • I have added a changelog
  • Git history is in acceptable state

@codecov-commenter
Copy link

codecov-commenter commented Feb 15, 2024

Codecov Report

Attention: Patch coverage is 42.85714% with 76 lines in your changes are missing coverage. Please review.

Project coverage is 53.48%. Comparing base (61a0759) to head (3b3ae91).

Files Patch % Lines
crates/namada/src/ledger/governance/mod.rs 0.00% 28 Missing ⚠️
crates/governance/src/cli/onchain.rs 0.00% 9 Missing ⚠️
crates/governance/src/cli/validation.rs 0.00% 9 Missing ⚠️
crates/sdk/src/signing.rs 0.00% 8 Missing ⚠️
crates/governance/src/storage/keys.rs 36.36% 7 Missing ⚠️
crates/governance/src/storage/proposal.rs 0.00% 7 Missing ⚠️
crates/governance/src/storage/mod.rs 83.33% 5 Missing ⚠️
crates/light_sdk/src/transaction/governance.rs 0.00% 2 Missing ⚠️
crates/apps/src/lib/bench_utils.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2630      +/-   ##
==========================================
+ Coverage   53.44%   53.48%   +0.03%     
==========================================
  Files         310      310              
  Lines      101574   101604      +30     
==========================================
+ Hits        54288    54340      +52     
+ Misses      47286    47264      -22     

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

@adrianbrink
Copy link
Member

I think the current behavior is correct. The changes should be activated on the epoch after the grace epoch ends.

@brentstone
Copy link
Contributor Author

@adrianbrink this is kind of arbitrary though right, since we could just increase the grace_epoch by 1 to achieve the same behavior. I like the idea of renaming to activation_epoch to be more intuitive. I think the code would end up clearer if execution occurred at the grace epoch (or wtv we name it) as well.

@brentstone brentstone force-pushed the brent/refactor-proposal-loading branch 2 times, most recently from 20ebc2d to 3c0cf18 Compare February 23, 2024 20:40
@brentstone
Copy link
Contributor Author

@Fraccaman @adrianbrink what do you think of the changes in 9a354f4? I think renaming makes things much clearer to understand upon reading code and in general going forward, but we can remove this commit if there are objections.

grarco
grarco previously approved these changes Apr 2, 2024
@brentstone brentstone force-pushed the brent/refactor-proposal-loading branch from 80024ca to 3b3ae91 Compare April 3, 2024 05:20
brentstone added a commit that referenced this pull request Apr 3, 2024
* brent/refactor-proposal-loading:
  changelog: add #2630
  fmt
  rename `grace_epoch` to `activation_epoch`
  refactor loading of gov proposals for execution
@tzemanovic
Copy link
Member

looks like the e2e tests are actually broken here

@tzemanovic
Copy link
Member

looks like the e2e tests are actually broken here

it just needed make -C wasm_for_tests/wasm_source (can be done on merge)

yito88 added a commit that referenced this pull request Apr 4, 2024
tzemanovic added a commit that referenced this pull request Apr 10, 2024
* origin/brent/refactor-proposal-loading:
  changelog: add #2630
  fmt
  rename `grace_epoch` to `activation_epoch`
  refactor loading of gov proposals for execution

# Conflicts:
#	crates/apps/src/lib/node/ledger/shell/finalize_block.rs
@tzemanovic tzemanovic merged commit b1276ba into main Apr 12, 2024
14 of 19 checks passed
@tzemanovic tzemanovic deleted the brent/refactor-proposal-loading branch April 12, 2024 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants