-
Notifications
You must be signed in to change notification settings - Fork 18
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
base: main
Are you sure you want to change the base?
Conversation
@@ -60,15 +60,14 @@ func NewAvailableStaticPrecompiles( | |||
panic(fmt.Errorf("failed to instantiate bech32 precompile: %w", err)) | |||
} | |||
|
|||
stakingPrecompile, err := stakingprecompile.NewPrecompile(stakingKeeper, authzKeeper) | |||
stakingPrecompile, err := stakingprecompile.NewPrecompile(stakingKeeper) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the arguments of NewAvailableStaticPrecompiles
, it also seems possible to remove authzKeeper
.
Additionally, I noticed that dependencies on Erc20Keeper, werc20 and erc20 precompiles (which are planned to be removed later as they will have their own state) still remain, so I’m leaving a note just in case it was overlooked.
FYI: temporary removed for IBC v2 test on this commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for feedback.
- In case of
NewAvailableStaticPrecompiles
, I missed it, I'll fix it. - In case of erc20 and werc20, I intended that the task order that 1) add allowance state in x/erc20 module, 2) modify erc20 precompile, 3) modify werc20 precompile.
- And I will consider commit.
There was a problem hiding this 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.
string memory _validatorAddr, | ||
uint256 _amount, | ||
uint256 _creationHeight | ||
) public { | ||
staking.STAKING_CONTRACT.cancelUnbondingDelegation( | ||
_addr, | ||
_dequeueUnbondingEntry(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @cloudgray, I noticed that _dequeueUnbondingEntry()
is called at the beginning of several test cases like testUndelegate
, testDelegate
, and testRedelegate
.
Just curious — is there a specific reason we need to dequeue at the start of each test? Would love to understand the motivation behind it.
Description
Removal of x/authz dependency on precompiles
Approve
,Revoke
,IncreaseAllowance
,DecreaseAllowance
,Allowance
) and its usage.Allowance
state CRUD methods in x/erc20 moduleAllowance
state of x/erc20 module instead ofGrant
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...
main
branchReviewers 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...
Unreleased
section inCHANGELOG.md