Skip to content

feat: remove x/authz dependency from precompiles #62

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

Merged
merged 46 commits into from
May 9, 2025

Conversation

cloudgray
Copy link
Contributor

Description

Removal of x/authz dependency on precompiles

  • Remove authzKeeper dependency from common Precompile struct
  • For staking and ics20 precompile
    • remove authorization methods (Approve, Revoke, IncreaseAllowance, DecreaseAllowance, Allowance) and its usage.
  • For erc20 precompile
    • Add Allowance state CRUD methods in x/erc20 module
    • Use added Allowance state of x/erc20 module instead of Grant state of x/authz module for authorization methods (Approve, Revoke, IncreaseAllowance, DecreaseAllowance, Allowance)

Closes: #47


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • tackled an existing issue or discussed with a team member
  • left instructions on how to review the changes
  • targeted the main branch

Reviewers Checklist

All items are required.
Please add a note if the item is not applicable
and please add your handle next to the items reviewed
if you only reviewed selected items.

I have...

  • added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • confirmed all author checklist items have been addressed
  • confirmed that this PR does not change production code
  • reviewed content
  • tested instructions (if applicable)
  • confirmed all CI checks have passed

@cloudgray cloudgray changed the title feat: remove authz dependency from precompiles except for erc20 feat: remove authz dependency from precompiles Apr 9, 2025
@cloudgray cloudgray changed the title feat: remove authz dependency from precompiles feat: remove x/authz dependency from precompiles Apr 9, 2025
Copy link
Contributor

@zsystm zsystm 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 to me so far — the authz removal seems to be handled well.

I had one question while reviewing the test code, which I left as a comment.

Also, this is not directly related to the scope of your PR, but I noticed that some of the existing test cases don’t validate balance changes. For example, after a delete, there’s no assertion checking whether the delegator’s balance was reduced accordingly. Since the precompiled contract involves complex state transitions, I think it would be valuable to add more thorough state validation to ensure the transitions happen as expected.

This can probably be addressed in a separate PR, so just leaving this here for reference. I opened an issue to track it.

cloudgray and others added 9 commits April 21, 2025 13:35
* feat(x/erc20): add allowance state

* test(x/erc20): add unit test for Allowance

* fix(x/erc20): add deleteAllowances method and modify genesis validation

* fix(x/erc20): validation of SetAllowance/GetAllowance and InitGenesis

* test(x/erc20) add test cases for UnsafeSetAllowance

* chore: fix lint
@zsystm zsystm marked this pull request as ready for review April 22, 2025 13:09
@zsystm zsystm requested a review from dongsam April 22, 2025 13:10
Copy link
Contributor

@dongsam dongsam left a comment

Choose a reason for hiding this comment

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

I haven’t gone through everything yet, but from what I’ve seen so far in app.go and the ics20 precompile section, it looks good

I’ll continue the review when I have more time.

@cloudgray
Copy link
Contributor Author

In the cosmos-evm context, naming convention is interfaces.go, not expected_keepers.go. It's not critical, but I think it would be better to change it for consistency

applied in dc225a2

Copy link
Member

@vladjdk vladjdk left a comment

Choose a reason for hiding this comment

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

Lgtm, thanks for the work :)

@vladjdk vladjdk merged commit 6e67d63 into main May 9, 2025
19 of 20 checks passed
@vladjdk vladjdk deleted the feat/remove-authz-from-precompiles branch May 9, 2025 16:02
@vladjdk vladjdk mentioned this pull request May 9, 2025
9 tasks
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.

[EPIC] Removal of x/authz dependency on precompiles
5 participants