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

Remove linear # of bech32 encodes introduced #505

Merged
merged 1 commit into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ Ref: https://keepachangelog.com/en/1.0.0/
-->

# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

* Fix bug in incentives epoch distribution events, used to use raw address, now uses bech32 addr

## [v4.0.0]

* Significantly speedup epoch times
Expand Down
5 changes: 4 additions & 1 deletion x/incentives/keeper/gauge.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ func (k Keeper) debugDistribute(ctx sdk.Context, gauge types.Gauge) (sdk.Coins,
type distributionInfo struct {
nextID int
lockOwnerAddrToID map[string]int
idToBech32Addr []string
idToDecodedAddr []sdk.AccAddress
idToDistrCoins []sdk.Coins
}
Expand All @@ -341,6 +342,7 @@ func newDistributionInfo() distributionInfo {
return distributionInfo{
nextID: 0,
lockOwnerAddrToID: make(map[string]int),
idToBech32Addr: []string{},
idToDecodedAddr: []sdk.AccAddress{},
idToDistrCoins: []sdk.Coins{},
}
Expand All @@ -358,6 +360,7 @@ func (d *distributionInfo) addLockRewards(lock lockuptypes.PeriodLock, rewards s
if err != nil {
return err
}
d.idToBech32Addr = append(d.idToBech32Addr, lock.Owner)
d.idToDecodedAddr = append(d.idToDecodedAddr, decodedOwnerAddr)
d.idToDistrCoins = append(d.idToDistrCoins, rewards)
}
Expand All @@ -381,7 +384,7 @@ func (k Keeper) doDistributionSends(ctx sdk.Context, denom string, distrs distri
sdk.NewEvent(
types.TypeEvtDistribution,
sdk.NewAttribute(types.AttributeLockedDenom, denom),
sdk.NewAttribute(types.AttributeReceiver, distrs.idToDecodedAddr[id].String()),
sdk.NewAttribute(types.AttributeReceiver, distrs.idToBech32Addr[id]),
sdk.NewAttribute(types.AttributeAmount, distrs.idToDistrCoins[id].String()),
),
})
Expand Down