Skip to content

Commit

Permalink
Remove linear # of bech32 encodes introduced (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
ValarDragon committed Oct 11, 2021
1 parent be48cbd commit 4b11014
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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

0 comments on commit 4b11014

Please sign in to comment.