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

fix: mitigate panic caused by must acc address in abci #750

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions x/masterchef/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,13 @@

// Send coins to protocol revenue address
if protocolGasFeeCoins.IsAllPositive() {
protocolRevenueAddress := sdk.MustAccAddressFromBech32(params.ProtocolRevenueAddress)
err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, authtypes.FeeCollectorName, protocolRevenueAddress, protocolGasFeeCoins)
protocolRevenueAddress, err := sdk.AccAddressFromBech32(params.ProtocolRevenueAddress)
if err != nil {
// Handle the error by skipping the fee distribution
ctx.Logger().Error("Invalid protocol revenue address", "error", err)
return gasFeesForLpsDec

Check warning on line 362 in x/masterchef/keeper/abci.go

View check run for this annotation

Codecov / codecov/patch

x/masterchef/keeper/abci.go#L361-L362

Added lines #L361 - L362 were not covered by tests
}
err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, authtypes.FeeCollectorName, protocolRevenueAddress, protocolGasFeeCoins)
if err != nil {
panic(err)
}
Expand Down
Loading