-
Notifications
You must be signed in to change notification settings - Fork 64
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: use a generated intermediate address as the forwarder #72
feat: use a generated intermediate address as the forwarder #72
Conversation
@@ -218,7 +219,7 @@ func (k *Keeper) ForwardTransferPacket( | |||
|
|||
// pay fees | |||
if feeAmount.IsPositive() { | |||
hostAccAddr, err := sdk.AccAddressFromBech32(receiver) | |||
hostAccAddr, err := sdk.AccAddressFromBech32(feePayer) |
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.
the intermediateSender
should be the fee payer here, as that is where the funds are received, and will be forwarded out of.
@@ -391,12 +393,21 @@ func (k *Keeper) RetryTimeout( | |||
|
|||
token := sdk.NewCoin(denom, amount) | |||
|
|||
// Handle backward compatibility for inflight packets right after the middleware upgrade |
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 not necessary when the fee payer is the intermediateSender
@@ -202,7 +202,8 @@ func (k *Keeper) ForwardTransferPacket( | |||
inFlightPacket *types.InFlightPacket, | |||
srcPacket channeltypes.Packet, | |||
srcPacketSender string, | |||
receiver string, | |||
feePayer string, |
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 shouldn't need to separate feePayer
and intermediateSender
@@ -10,7 +10,8 @@ import ( | |||
var ( | |||
DefaultFeePercentage = sdk.NewDec(0) | |||
// KeyFeePercentage is store's key for FeePercentage Params | |||
KeyFeePercentage = []byte("FeePercentage") | |||
KeyFeePercentage = []byte("FeePercentage") | |||
IntermediateAddrPrefix = "packet-fowarder" |
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.
IntermediateAddrPrefix = "packet-fowarder" | |
IntermediateAddrPrefix = "packet-forwarder" |
@@ -202,7 +202,8 @@ func (k *Keeper) ForwardTransferPacket( | |||
inFlightPacket *types.InFlightPacket, | |||
srcPacket channeltypes.Packet, | |||
srcPacketSender string, | |||
receiver string, | |||
feePayer string, |
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.
Why is this called fee payer? AFAIK the fee is paid by the relayer everywhere except for the initial send
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.
oh, I see! this is in the case where there is a forwarding fee. Interesting 🤔 I wonder if any chain has the fees enabled.
Thanks @agouin. Somehow I thought the fee payer was going to pay in the native token existing in the account instead of using the amount that was transferred. This makes a lot more sense. Thanks for the review. |
Since the changes here are the same as #71 closing this in favour of that. |
This PR replaces #69. Instead of enforce the usage of the module account as the intermediate forwarder, PMF will generate an address based on the sender's address.
This method has the following advantages: