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

feat: add CheckAuthorization function #2313

Merged
merged 11 commits into from
Jun 6, 2024

Conversation

kingpinXD
Copy link
Contributor

@kingpinXD kingpinXD commented Jun 4, 2024

Description

This prs adds a CheckAuthorization function to replace the IsAuthorized function. The new function uses the authorization list to verify the signer's authorization.

Closes: #2310

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Include instructions and any relevant details so others can reproduce.

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Checklist:

  • I have added unit tests that prove my fix feature works

Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.26%. Comparing base (aec6ac2) to head (dee3075).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2313      +/-   ##
===========================================
+ Coverage    68.22%   68.26%   +0.03%     
===========================================
  Files          298      298              
  Lines        18857    18880      +23     
===========================================
+ Hits         12865    12888      +23     
  Misses        5355     5355              
  Partials       637      637              
Files Coverage Δ
x/authority/keeper/authorization_list.go 100.00% <100.00%> (ø)
x/authority/keeper/policies.go 100.00% <ø> (ø)
x/authority/types/authorization_list.go 100.00% <ø> (ø)
x/authority/types/policies.go 100.00% <100.00%> (ø)

@kingpinXD kingpinXD changed the title feat: add helper functions to use the authorization table to check authorization feat: add CheckAuthorization function Jun 4, 2024
@kingpinXD kingpinXD marked this pull request as ready for review June 4, 2024 22:53
Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

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

I would keep the naming Authorizations instead of AuthorizationsList to make it consistent with Policies

testutil/sample/authority.go Outdated Show resolved Hide resolved
x/authority/keeper/authorization_list.go Outdated Show resolved Hide resolved
x/authority/keeper/authorization_list.go Show resolved Hide resolved
x/authority/keeper/authorization_list_test.go Show resolved Hide resolved
@kingpinXD
Copy link
Contributor Author

I would keep the naming Authorizations instead of AuthorizationsList to make it consistent with Policies.

The files are named after the data structures for which they have functions. Policies and AuthorizationList .
We can think of renaming the AuthorizationList data structure to Authorizations, but that seems a bit unnecessary, especially considering it is a list of authorization after all.

@lumtis
Copy link
Member

lumtis commented Jun 5, 2024

@kingpinXD ready for re-review?

@kingpinXD kingpinXD requested a review from lumtis June 5, 2024 16:01
testutil/sample/authority.go Outdated Show resolved Hide resolved
testutil/sample/authority.go Outdated Show resolved Hide resolved
x/authority/keeper/authorization_list.go Show resolved Hide resolved
@kingpinXD kingpinXD merged commit 5929b51 into develop Jun 6, 2024
19 checks passed
@kingpinXD kingpinXD deleted the authorization-list-check-messages branch June 6, 2024 14:28
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.

Add CheckAuthorization function
3 participants