-
Notifications
You must be signed in to change notification settings - Fork 139
feat: feePayer for Sudo fees #129
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: feePayer for Sudo fees #129
Conversation
f1d8419 to
147aae4
Compare
proto/interchaintxs/v1/tx.proto
Outdated
| // MsgSubmitTxResponse defines the response for Msg/SubmitTx | ||
| message MsgSubmitTxResponse { | ||
| // channel's sequence_id for outgoing ibc packet. Unique per a channel. | ||
| // channel's sequence_id for outgoing ibc packet. Unique per a channel.y |
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.
typo
| allowance, err := k.feegrantKeeper.GetAllowance(ctx, payerInfo.FeePayer, payerInfo.Sender) | ||
| if err != nil { | ||
| return err | ||
| } |
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.
new line after error handling, please
x/feerefunder/keeper/keeper.go
Outdated
| if payerInfo.FeePayer != nil && !payerInfo.FeePayer.Empty() { | ||
| allowance, err := k.feegrantKeeper.GetAllowance(ctx, payerInfo.FeePayer, payerInfo.Sender) | ||
| if err != nil { | ||
| return err |
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.
wrap error to make it more meaningful?
x/interchaintxs/keeper/msg_server.go
Outdated
| feePayerAddr, err := sdk.AccAddressFromBech32(msg.Fee.Payer) | ||
| if msg.Fee.Payer != "" && err != nil { | ||
| k.Logger(ctx).Debug("SubmitTx: failed to parse fee payer address", "fee payer", msg.Fee.Payer) | ||
| return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "failed to parse address: %s", msg.Fee.Payer) | ||
| } | ||
|
|
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.
Just a suggestion: maybe we can define a method which accepts sender and payer and returns (feetypes.PayerInfo, error)?
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.
+1, cause it looks a bit hard to read
NeverHappened
left a comment
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.
LGTM, mentioned small things
x/feerefunder/keeper/keeper.go
Outdated
| coins = append(coins, fee.RecvFee...) | ||
| _, err = allowance.Accept(ctx, coins, []sdk.Msg{}) | ||
| if err != nil { | ||
| return err |
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.
wrap an error
…n-org/neutron into feat/NTRN-331-sudo-fees-payer
x/feerefunder/keeper/keeper_test.go
Outdated
| FeePayer: nil, | ||
| }) | ||
|
|
||
| p, err = k.GetPayerInfo(ctx, TestAddress, TestAddress) |
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.
To test logic to verify that it's different addresses it would probably be better to send different addresses as args
related stuff: