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

refactor: rename RegisterCounterpartyAddress rpc to RegisterCounterpartyPayee #1513

Merged
merged 13 commits into from
Jun 14, 2022

Conversation

damiannolan
Copy link
Member

@damiannolan damiannolan commented Jun 8, 2022

Description

Renaming RegisterCounterpartyAddress rpc to RegisterCounterpartyPayee

closes: #XXXX


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.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@codecov-commenter
Copy link

codecov-commenter commented Jun 9, 2022

Codecov Report

Merging #1513 (49ce2f6) into main (5e5e2cd) will decrease coverage by 0.00%.
The diff coverage is 96.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1513      +/-   ##
==========================================
- Coverage   80.27%   80.26%   -0.01%     
==========================================
  Files         166      166              
  Lines       12252    12254       +2     
==========================================
+ Hits         9835     9836       +1     
- Misses       1954     1955       +1     
  Partials      463      463              
Impacted Files Coverage Δ
modules/apps/29-fee/types/codec.go 44.44% <50.00%> (+0.69%) ⬆️
modules/apps/29-fee/ibc_middleware.go 93.97% <100.00%> (ø)
modules/apps/29-fee/keeper/genesis.go 87.50% <100.00%> (ø)
modules/apps/29-fee/keeper/grpc_query.go 75.54% <100.00%> (ø)
modules/apps/29-fee/keeper/keeper.go 92.48% <100.00%> (ø)
modules/apps/29-fee/keeper/msg_server.go 96.00% <100.00%> (ø)
modules/apps/29-fee/keeper/relay.go 88.23% <100.00%> (ø)
modules/apps/29-fee/types/genesis.go 81.96% <100.00%> (ø)
modules/apps/29-fee/types/keys.go 97.14% <100.00%> (ø)
modules/apps/29-fee/types/msgs.go 90.75% <100.00%> (ø)

string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
// the relayer address
string relayer_address = 3;
// the counterparty relayer address
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: update the comment to counterparty payee

Copy link
Member Author

Choose a reason for hiding this comment

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

done

| `port_id` | [string](#string) | | unique port identifier |
| `channel_id` | [string](#string) | | unique channel identifier |
| `relayer_address` | [string](#string) | | the relayer address |
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: is address necessary in this naming if we don't have it for payee below?

string channel_id = 4 [(gogoproto.moretags) = "yaml:\"channel_id\""];
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
// the relayer address
string relayer_address = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

same nit here re: either having relayer_address & counterparty_payee_address or just relayer & counterparty payee

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah actually, it's a fair point. I chatted with @AdityaSripal about this and we felt pretty indifferent about it.
If we are going to go with one or the other I think we should go with dropping the address suffix for consistency as counterparty_payee_address is a bit wordy. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think for purposes of consistency I'll go ahead and drop the address suffix and make the changes in RegisterPayee msgs also

Comment on lines 40 to 41
// RegisterCounterpartyPayee is called by the relayer on each channelEnd and allows them to specify their
// counterparty address before relaying. This ensures they will be properly compensated for forward relaying since
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// RegisterCounterpartyPayee is called by the relayer on each channelEnd and allows them to specify their
// counterparty address before relaying. This ensures they will be properly compensated for forward relaying since
// RegisterCounterpartyPayee is called by the relayer on each channelEnd and allows them to specify the
// counterparty payee address before relaying. This ensures they will be properly compensated for forward relaying since

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll update these docs both here and in the proto files as they're replicated and push the changes 👍

// RegisterCounterpartyPayee defines a rpc handler method for MsgRegisterCounterpartyPayee
// RegisterCounterpartyPayee is called by the relayer on each channelEnd and allows them to specify their
// counterparty address before relaying. This ensures they will be properly compensated for forward relaying since
// destination chain must send back relayer's source address (counterparty address) in acknowledgement. This function
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// destination chain must send back relayer's source address (counterparty address) in acknowledgement. This function
// destination chain must send back the counterparty payee in acknowledgement. This function

// RegisterCounterpartyPayee is called by the relayer on each channelEnd and allows them to specify their
// counterparty address before relaying. This ensures they will be properly compensated for forward relaying since
// destination chain must send back relayer's source address (counterparty address) in acknowledgement. This function
// may be called more than once by a relayer, in which case, the latest counterparty address is always used.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// may be called more than once by a relayer, in which case, the latest counterparty address is always used.
// may be called more than once, in which case, the latest counterparty payee address is always used.

modules/apps/29-fee/keeper/keeper.go Outdated Show resolved Hide resolved
modules/apps/29-fee/keeper/keeper.go Outdated Show resolved Hide resolved
modules/apps/29-fee/keeper/keeper.go Outdated Show resolved Hide resolved
@@ -1412,7 +1412,7 @@ Msg defines the ICS29 Msg service.
| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `RegisterPayee` | [MsgRegisterPayee](#ibc.applications.fee.v1.MsgRegisterPayee) | [MsgRegisterPayeeResponse](#ibc.applications.fee.v1.MsgRegisterPayeeResponse) | RegisterPayee defines a rpc handler method for MsgRegisterPayee RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional payee to which escrowed packet fees will be paid out. The payee should be registered on the source chain from which packets originate as this is where fee distribution takes place. This function may be called more than once by a relayer, in which case, the latest payee is always used. | |
| `RegisterCounterpartyAddress` | [MsgRegisterCounterpartyAddress](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddress) | [MsgRegisterCounterpartyAddressResponse](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddressResponse) | RegisterCounterpartyAddress defines a rpc handler method for MsgRegisterCounterpartyAddress RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their counterparty address before relaying. This ensures they will be properly compensated for forward relaying since destination chain must send back relayer's source address (counterparty address) in acknowledgement. This function may be called more than once by a relayer, in which case, the latest counterparty address is always used. | |
| `RegisterCounterpartyPayee` | [MsgRegisterCounterpartyPayee](#ibc.applications.fee.v1.MsgRegisterCounterpartyPayee) | [MsgRegisterCounterpartyPayeeResponse](#ibc.applications.fee.v1.MsgRegisterCounterpartyPayeeResponse) | RegisterCounterpartyPayee defines a rpc handler method for MsgRegisterCounterpartyPayee RegisterCounterpartyPayee is called by the relayer on each channelEnd and allows them to specify their counterparty address before relaying. This ensures they will be properly compensated for forward relaying since destination chain must send back relayer's source address (counterparty address) in acknowledgement. This function may be called more than once by a relayer, in which case, the latest counterparty address is always used. | |
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't it that the counterparty address doesnt always have to be the relayer's source address?

@damiannolan
Copy link
Member Author

Thanks for the suggestions @charleenfei, I've updated to remove the address suffix on the msg fields and also updated both protodoc and godocs

Copy link
Contributor

@charleenfei charleenfei left a comment

Choose a reason for hiding this comment

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

nice work sham

@@ -1412,7 +1412,7 @@ Msg defines the ICS29 Msg service.
| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `RegisterPayee` | [MsgRegisterPayee](#ibc.applications.fee.v1.MsgRegisterPayee) | [MsgRegisterPayeeResponse](#ibc.applications.fee.v1.MsgRegisterPayeeResponse) | RegisterPayee defines a rpc handler method for MsgRegisterPayee RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional payee to which escrowed packet fees will be paid out. The payee should be registered on the source chain from which packets originate as this is where fee distribution takes place. This function may be called more than once by a relayer, in which case, the latest payee is always used. | |
| `RegisterCounterpartyAddress` | [MsgRegisterCounterpartyAddress](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddress) | [MsgRegisterCounterpartyAddressResponse](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddressResponse) | RegisterCounterpartyAddress defines a rpc handler method for MsgRegisterCounterpartyAddress RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their counterparty address before relaying. This ensures they will be properly compensated for forward relaying since destination chain must send back relayer's source address (counterparty address) in acknowledgement. This function may be called more than once by a relayer, in which case, the latest counterparty address is always used. | |
| `RegisterCounterpartyPayee` | [MsgRegisterCounterpartyPayee](#ibc.applications.fee.v1.MsgRegisterCounterpartyPayee) | [MsgRegisterCounterpartyPayeeResponse](#ibc.applications.fee.v1.MsgRegisterCounterpartyPayeeResponse) | RegisterCounterpartyPayee defines a rpc handler method for MsgRegisterCounterpartyPayee RegisterCounterpartyPayee is called by the relayer on each channelEnd and allows them to specify the counterparty payee address before relaying. This ensures they will be properly compensated for forward relaying since the destination chain must include the registered counterparty payee address in the acknowledgement. This function may be called more than once by a relayer, in which case, the latest counterparty payee address is always used. | |
Copy link
Contributor

Choose a reason for hiding this comment

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

This ensures they will be properly compensated for forward relaying since the destination chain must include the registered counterparty payee address in the acknowledgement. This is not complete true with the introduction of the the MsgRegisterPayee, right? Because the payee that you register could get the fees even if the counterparty address is not registered. An operator could decide not to use the counterparty payee at all and only the payee, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've updated must to may and included an additional note:

// A registered payee on the source chain will always override a registered counterparty payee.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, @damiannolan, I think my comment above is not correct. I just realized while I was writing this comment on the other PR. I think you still need to register the counterparty address, otherwise we wouldn't know on the source chain to which payee to pay out the fees. The counterparty address may or may not have a payee registered.

Copy link
Contributor

Choose a reason for hiding this comment

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

After the conversation this morning in the planning call, I think we need to update this comment again, right?

Copy link
Member Author

@damiannolan damiannolan Jun 13, 2022

Choose a reason for hiding this comment

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

Yep, done! Feel free to suggest changes

Copy link
Contributor

@crodriguezvega crodriguezvega left a comment

Choose a reason for hiding this comment

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

Thank you, @damiannolan!

Copy link
Contributor

@chatton chatton left a comment

Choose a reason for hiding this comment

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

LGTM! Not major comments, just a small nit 💯

cmd := &cobra.Command{
Use: "register-counterparty-payee [port-id] [channel-id] [relayer] [counterparty-payee] ",
Short: "Register a counterparty payee address on a given channel.",
Long: strings.TrimSpace(`Register a counterparty payee address on a given channel.`),
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] unnecessary strings.TrimSpace call, this is just a regular string.

Copy link
Member Author

Choose a reason for hiding this comment

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

I left this in from existing code and I think there's a good few of them around. Maybe we could open a follow up PR to remove them if you want, some general housekeeping.

@crodriguezvega crodriguezvega merged commit dab07f9 into main Jun 14, 2022
@crodriguezvega crodriguezvega deleted the damian/rename-counterparty-payee-rpc branch June 14, 2022 10:50
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.

5 participants