Skip to content

feat: implement authority module#1815

Merged
lumtis merged 35 commits intodevelopfrom
feat/authority
Mar 5, 2024
Merged

feat: implement authority module#1815
lumtis merged 35 commits intodevelopfrom
feat/authority

Conversation

@lumtis
Copy link
Contributor

@lumtis lumtis commented Feb 27, 2024

Description

  • Add authority module containing object Policies matching address with policy types
  • Refactor messages to use this module for authorization check
  • Refactor message tests to use mocks for IsAuthorized for better unit testing
  • Migration script observer.Params -> authority.Policies
  • Add UpdatePolicies message to update the policies.

Closes: #1714

@codecov
Copy link

codecov bot commented Feb 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 33.36%. Comparing base (5297c87) to head (da33217).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1815      +/-   ##
===========================================
- Coverage    39.92%   33.36%   -6.57%     
===========================================
  Files          206      130      -76     
  Lines        12617     9205    -3412     
===========================================
- Hits          5037     3071    -1966     
+ Misses        7183     5909    -1274     
+ Partials       397      225     -172     
Files Coverage Δ
x/authority/genesis.go 100.00% <100.00%> (ø)
x/authority/keeper/grpc_query_policies.go 100.00% <100.00%> (ø)
x/authority/keeper/msg_server_update_policies.go 100.00% <100.00%> (ø)
x/authority/keeper/policies.go 100.00% <100.00%> (ø)
...le/keeper/msg_server_deploy_fungible_coin_zrc20.go 94.11% <100.00%> (ø)
...ngible/keeper/msg_server_deploy_system_contract.go 67.44% <100.00%> (ø)
.../fungible/keeper/msg_server_remove_foreign_coin.go 100.00% <100.00%> (ø)
...le/keeper/msg_server_udpate_zrc20_liquidity_cap.go 100.00% <100.00%> (ø)
...ible/keeper/msg_server_update_contract_bytecode.go 92.50% <100.00%> (ø)
...ngible/keeper/msg_server_update_system_contract.go 79.59% <100.00%> (ø)
... and 5 more

... and 81 files with indirect coverage changes

@github-actions
Copy link

!!!WARNING!!!
nosec detected in the following files: x/observer/keeper/msg_server_update_observer_test.go

Be very careful about using #nosec in code. It can be a quick way to suppress security warnings and move forward with development, it should be employed with caution. Suppressing warnings with #nosec can hide potentially serious vulnerabilities. Only use #nosec when you're absolutely certain that the security issue is either a false positive or has been mitigated in another way.

Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203
Broad #nosec annotations should be avoided, as they can hide other vulnerabilities. The CI will block you from merging this PR until you remove #nosec annotations that do not target specific rules.

Pay extra attention to the way #nosec is being used in the files listed above.

@github-actions github-actions bot added the nosec label Feb 29, 2024
@lumtis lumtis marked this pull request as ready for review March 1, 2024 10:07
Copy link
Member

@skosito skosito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, couple smaller comments

Copy link
Contributor

@ws4charlie ws4charlie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few minor comments

@ws4charlie ws4charlie self-requested a review March 1, 2024 19:11
lumtis and others added 4 commits March 5, 2024 09:59
Co-authored-by: Tanmay <tanmay@zetachain.com>
Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com>
@skosito skosito self-requested a review March 5, 2024 13:40
@lumtis
Copy link
Contributor Author

lumtis commented Mar 5, 2024

Seems like there is bug with Codecov, the diff coverage is -6% while the new addition is almost fully covered, will merge and check if there is a bug, otherwise gonna see what's wrong

@lumtis lumtis merged commit 422e00e into develop Mar 5, 2024
@lumtis lumtis deleted the feat/authority branch March 5, 2024 18:46
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.

Introduce an authority module

4 participants