-
Notifications
You must be signed in to change notification settings - Fork 597
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: adding RegisterPayee rpc to ics29 fee middleware #1491
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1491 +/- ##
==========================================
+ Coverage 80.36% 80.42% +0.05%
==========================================
Files 166 166
Lines 12105 12176 +71
==========================================
+ Hits 9728 9792 +64
- Misses 1920 1926 +6
- Partials 457 458 +1
|
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.
Awesome! Once we merge these PRs for the distribution address, we can cut a new beta tag and share with crypto.com.
modules/apps/29-fee/keeper/keeper.go
Outdated
@@ -241,6 +241,24 @@ func (k Keeper) DeleteForwardRelayerAddress(ctx sdk.Context, packetID channeltyp | |||
store.Delete(key) | |||
} | |||
|
|||
// GetDistributionAddress retrieves the fee distribution address stored in state given the provided channel identifier and relayer address |
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.
This is a nit, but should we add these functions next to the ones to get and set the counterparty address?
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.
Yep, done! I've moved to above counterparty getter/setter funcs. And also re-ordered the rpc definitions in proto so RegisterPayee
comes before RegisterCounterpartyPayee
modules/apps/29-fee/types/errors.go
Outdated
@@ -16,4 +16,5 @@ var ( | |||
ErrFeeNotEnabled = sdkerrors.Register(ModuleName, 9, "fee module is not enabled for this channel. If this error occurs after channel setup, fee module may not be enabled") | |||
ErrRelayerNotFoundForAsyncAck = sdkerrors.Register(ModuleName, 10, "relayer address must be stored for async WriteAcknowledgement") | |||
ErrFeeModuleLocked = sdkerrors.Register(ModuleName, 11, "the fee module is currently locked, a severe bug has been detected") | |||
ErrDistributionAddressEmpty = sdkerrors.Register(ModuleName, 12, "distribution address must not be empty") |
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.
Also a nit: since we haven't released fee yet, should we put this error next to ErrCounterpartyAddressEmpty
?
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.
Removed this error as its obsolete now that we check the payee
field directly using sdk.AccAddressFromBech32
in ValidateBasic
.
// the fee distribution address | ||
string distribution_address = 2 [(gogoproto.moretags) = "yaml:\"distribution_address\""]; | ||
// unique port identifier | ||
string port_id = 3 [(gogoproto.moretags) = "yaml:\"port_id\""]; |
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.
Also a nit: should we change the order of the parameters to port_id
, channel_id
, address
, distribution_address
? Also for the register counterparty address command. I think in other messages the port and channel are the first parameters...
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.
Done!
modules/apps/29-fee/types/msgs.go
Outdated
_, err := sdk.AccAddressFromBech32(msg.Address) | ||
if err != nil { | ||
return sdkerrors.Wrap(err, "failed to convert msg.Address into sdk.AccAddress") | ||
} |
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.
I need to add the same for msg.DistributionAddress
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.
its also worth checking here that msg.Address != msg.DistributionAddress
since that is a waste of a message/mapping
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.
Done
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.
We should also check that addresses in ValidateBasic are different, everything else looks good!
modules/apps/29-fee/types/msgs.go
Outdated
_, err := sdk.AccAddressFromBech32(msg.Address) | ||
if err != nil { | ||
return sdkerrors.Wrap(err, "failed to convert msg.Address into sdk.AccAddress") | ||
} |
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.
its also worth checking here that msg.Address != msg.DistributionAddress
since that is a waste of a message/mapping
modules/apps/29-fee/types/msgs.go
Outdated
|
||
// GetSigners implements sdk.Msg | ||
func (msg MsgRegisterDistributionAddress) GetSigners() []sdk.AccAddress { | ||
signer, err := sdk.AccAddressFromBech32(msg.Address) |
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.
Yup, this is already the correct and sufficient authentication
option (gogoproto.goproto_getters) = false; | ||
|
||
// the relayer address | ||
string address = 1; |
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.
rename to relayer_address
?
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.
Should we also rename it like this in the register counterparty message?
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.
Yep, will do this in a follow up PR tomorrow to reduce the number of changes! We will rename to RegisterCounterpartyPayee
and align the same field names..etc 👍
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.
Nice work!
Description
RegisterPayee
to ics29 fee middlewareNOTE: this is one of many PRs to complete the feature work referenced in: #1477
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes