-
Notifications
You must be signed in to change notification settings - Fork 661
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
chore: rewrite capability to not use sdk.Context #7089
Changes from 13 commits
3e0cd10
f3c9418
29d32cd
1636f48
a92ec4b
0be258a
88720c2
776ad27
228596b
0f519b4
70fd024
9d4ece4
1288323
360e5d5
f72aa4c
5be5781
2f64ca1
1c82a81
d45cea5
199df39
ae679ca
de65c01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ import ( | |
) | ||
|
||
// escrowPacketFee sends the packet fee to the 29-fee module account to hold in escrow | ||
func (k Keeper) escrowPacketFee(ctx sdk.Context, packetID channeltypes.PacketId, packetFee types.PacketFee) error { | ||
func (k Keeper) escrowPacketFee(ctx context.Context, packetID channeltypes.PacketId, packetFee types.PacketFee) error { | ||
// check if the refund address is valid | ||
refundAddr, err := sdk.AccAddressFromBech32(packetFee.RefundAddress) | ||
if err != nil { | ||
|
@@ -86,7 +86,7 @@ func (k Keeper) DistributePacketFeesOnAcknowledgement(ctx context.Context, forwa | |
|
||
// distributePacketFeeOnAcknowledgement pays the receive fee for a given packetID while refunding the timeout fee to the refund account associated with the Fee. | ||
// If there was no forward relayer or the associated forward relayer address is blocked, the receive fee is refunded. | ||
func (k Keeper) distributePacketFeeOnAcknowledgement(ctx sdk.Context, refundAddr, forwardRelayer, reverseRelayer sdk.AccAddress, packetFee types.PacketFee) { | ||
func (k Keeper) distributePacketFeeOnAcknowledgement(ctx context.Context, refundAddr, forwardRelayer, reverseRelayer sdk.AccAddress, packetFee types.PacketFee) { | ||
// distribute fee to valid forward relayer address otherwise refund the fee | ||
if !forwardRelayer.Empty() && !k.bankKeeper.BlockedAddr(forwardRelayer) { | ||
// distribute fee for forward relaying | ||
|
@@ -140,7 +140,7 @@ func (k Keeper) DistributePacketFeesOnTimeout(ctx context.Context, timeoutRelaye | |
} | ||
|
||
// distributePacketFeeOnTimeout pays the timeout fee to the timeout relayer and refunds the acknowledgement & receive fee. | ||
func (k Keeper) distributePacketFeeOnTimeout(ctx sdk.Context, refundAddr, timeoutRelayer sdk.AccAddress, packetFee types.PacketFee) { | ||
func (k Keeper) distributePacketFeeOnTimeout(ctx context.Context, refundAddr, timeoutRelayer sdk.AccAddress, packetFee types.PacketFee) { | ||
// distribute fee for timeout relaying | ||
k.distributeFee(ctx, timeoutRelayer, refundAddr, packetFee.Fee.TimeoutFee) | ||
|
||
|
@@ -152,9 +152,10 @@ func (k Keeper) distributePacketFeeOnTimeout(ctx sdk.Context, refundAddr, timeou | |
// distributeFee will attempt to distribute the escrowed fee to the receiver address. | ||
// If the distribution fails for any reason (such as the receiving address being blocked), | ||
// the state changes will be discarded. | ||
func (k Keeper) distributeFee(ctx sdk.Context, receiver, refundAccAddress sdk.AccAddress, fee sdk.Coins) { | ||
func (k Keeper) distributeFee(ctx context.Context, receiver, refundAccAddress sdk.AccAddress, fee sdk.Coins) { | ||
// cache context before trying to distribute fees | ||
cacheCtx, writeFn := ctx.CacheContext() | ||
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove when Upgrading to 52 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering we wont be doing that environment workaround we talked about in call, can open a new issue for bumping to 0.52 and link in similar way. can take care of this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #7223 lmk if this is okay There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. beautiful!
DimitrisJim marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cacheCtx, writeFn := sdkCtx.CacheContext() | ||
|
||
err := k.bankKeeper.SendCoinsFromModuleToAccount(cacheCtx, types.ModuleName, receiver, fee) | ||
if err != nil { | ||
|
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.
is this required for the change?
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.
yea need a function, we will tag again to get it, to help unblock this
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.
what function was needed that wasn't included in v50.9?