From f4e63d60ba092ee175ae461837b713eef0f16173 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Tue, 5 Oct 2021 15:53:33 -0500 Subject: [PATCH] Remove linear # of bech32 encodes introduced --- CHANGELOG.md | 5 +++++ x/incentives/keeper/gauge.go | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9198367fcf4..fda3a2ac5ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/x/incentives/keeper/gauge.go b/x/incentives/keeper/gauge.go index 0ff5455da5b..0fd1f16329d 100644 --- a/x/incentives/keeper/gauge.go +++ b/x/incentives/keeper/gauge.go @@ -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 } @@ -341,6 +342,7 @@ func newDistributionInfo() distributionInfo { return distributionInfo{ nextID: 0, lockOwnerAddrToID: make(map[string]int), + idToBech32Addr: []string{}, idToDecodedAddr: []sdk.AccAddress{}, idToDistrCoins: []sdk.Coins{}, } @@ -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) } @@ -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()), ), })