Skip to content

Commit cf7a58c

Browse files
hard-netthard-nettantstalepresh
authored
v0.22.0: - resolve v018-v021 issues (#278)
* add binary * patch: replace cosmos-sdk, bump cometbft * dev: prep for v022 upgrade * remove binary * dev: add custom export cli command * dev: update ed25519 library used in-place-testnet * bump: add debug mod instructions * logs: update replace docs * fix testnet issues * docs * readd v021 upgradeHandler for in-place-testnet * add historical custom upgrade patch logic * dev: remove unnecessary x/account feegrant query * dev: bumps to upggradeHandler logs & tests * dev: bump export custom * dev: return err instead of panic, require no error in tests * add default replace, bump docker alpine version * go mod tidy * wip: retain broken validator in testnet for patch assertion * wip: retain validator in staking store * tests: 1 log file printed for debugging v022 upgradeHandler, added upgradeHandler logic to in-place-testnet * dev: access appKeepers from top level app * test: add unbonded control validator to unit tests * spellcheck * cosmos-sdk@v0.53, implement x/protocol-pool * register protocol pool in our app modules basic manager * ict: impl x/protocolpool tests * protocol-pool test * uncomment tests * init protocolpool keeper prior to distribution keeper --------- Co-authored-by: hard-nett <hardnettt@proton.me> Co-authored-by: antstalepresh <brchen327@gmail.com>
1 parent fbdc845 commit cf7a58c

File tree

112 files changed

+4477
-2715
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+4477
-2715
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build \
3838
&& (file /code/build/bitsongd | grep "statically linked")
3939

4040
# --------------------------------------------------------
41-
FROM alpine:3.16
41+
FROM alpine:3.17
4242

4343
COPY --from=go-builder /code/build/bitsongd /usr/bin/bitsongd
4444

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ help:
3030

3131
APP_DIR = ./app
3232
BINDIR ?= $(GOPATH)/bin
33+
BUILDDIR ?= $(CURDIR)/build
3334

3435
PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation')
3536
PACKAGES_UNITTEST=$(shell go list ./... | grep -v '/simulation' | grep -v '/cli_test')
@@ -40,7 +41,6 @@ COMMIT := $(shell git log -1 --format='%H')
4041

4142
LEDGER_ENABLED ?= true
4243
SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
43-
BUILDDIR ?= $(CURDIR)/build
4444

4545
TENDERMINT_VERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::') # grab everything after the space in "github.com/tendermint/tendermint v0.34.7"
4646

app/app.go

Lines changed: 92 additions & 68 deletions
Large diffs are not rendered by default.

app/export.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func (app *BitsongApp) ExportAppStateAndValidators(
3737
return servertypes.ExportedApp{}, err
3838
}
3939

40-
validators, err := staking.WriteValidators(ctx, app.AppKeepers.StakingKeeper)
40+
validators, err := staking.WriteValidators(ctx, app.StakingKeeper)
4141
if err != nil {
4242
return servertypes.ExportedApp{}, err
4343
}
@@ -72,21 +72,21 @@ func (app *BitsongApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
7272
}
7373

7474
/* Just to be safe, assert the invariants on current state. */
75-
app.AppKeepers.CrisisKeeper.AssertInvariants(ctx)
75+
app.CrisisKeeper.AssertInvariants(ctx)
7676

7777
/* Handle fee distribution state. */
7878

7979
// withdraw all validator commission
80-
app.AppKeepers.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
81-
_, err := app.AppKeepers.DistrKeeper.WithdrawValidatorCommission(ctx, sdk.ValAddress(val.GetOperator()))
80+
app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
81+
_, err := app.DistrKeeper.WithdrawValidatorCommission(ctx, sdk.ValAddress(val.GetOperator()))
8282
if err != nil {
8383
panic(err)
8484
}
8585
return false
8686
})
8787

8888
// withdraw all delegator rewards
89-
dels, err := app.AppKeepers.StakingKeeper.GetAllDelegations(ctx)
89+
dels, err := app.StakingKeeper.GetAllDelegations(ctx)
9090
if err != nil {
9191
panic(err)
9292
}
@@ -100,34 +100,34 @@ func (app *BitsongApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
100100
if err != nil {
101101
panic(err)
102102
}
103-
_, _ = app.AppKeepers.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr)
103+
_, _ = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr)
104104
}
105105

106106
// clear validator slash events
107-
app.AppKeepers.DistrKeeper.DeleteAllValidatorSlashEvents(ctx)
107+
app.DistrKeeper.DeleteAllValidatorSlashEvents(ctx)
108108

109109
// clear validator historical rewards
110-
app.AppKeepers.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx)
110+
app.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx)
111111

112112
// set context height to zero
113113
height := ctx.BlockHeight()
114114
ctx = ctx.WithBlockHeight(0)
115115

116116
// reinitialize all validators
117-
app.AppKeepers.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
117+
app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
118118
// donate any unwithdrawn outstanding reward fraction tokens to the community pool
119-
scraps, err := app.AppKeepers.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, sdk.ValAddress(val.GetOperator()))
119+
scraps, err := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, sdk.ValAddress(val.GetOperator()))
120120
if err != nil {
121121
panic(err)
122122
}
123-
feePool, err := app.AppKeepers.DistrKeeper.FeePool.Get(ctx)
123+
feePool, err := app.DistrKeeper.FeePool.Get(ctx)
124124
if err != nil {
125125
panic(err)
126126
}
127127
feePool.CommunityPool = feePool.CommunityPool.Add(scraps...)
128-
app.AppKeepers.DistrKeeper.FeePool.Set(ctx, feePool)
128+
app.DistrKeeper.FeePool.Set(ctx, feePool)
129129

130-
app.AppKeepers.DistrKeeper.Hooks().AfterValidatorCreated(ctx, sdk.ValAddress(val.GetOperator()))
130+
app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, sdk.ValAddress(val.GetOperator()))
131131
return false
132132
})
133133

@@ -141,8 +141,8 @@ func (app *BitsongApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
141141
if err != nil {
142142
panic(err)
143143
}
144-
app.AppKeepers.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr)
145-
app.AppKeepers.DistrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr)
144+
app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr)
145+
app.DistrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr)
146146
}
147147

148148
// reset context height
@@ -151,20 +151,20 @@ func (app *BitsongApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
151151
/* Handle staking state. */
152152

153153
// iterate through redelegations, reset creation height
154-
app.AppKeepers.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) {
154+
app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) {
155155
for i := range red.Entries {
156156
red.Entries[i].CreationHeight = 0
157157
}
158-
app.AppKeepers.StakingKeeper.SetRedelegation(ctx, red)
158+
app.StakingKeeper.SetRedelegation(ctx, red)
159159
return false
160160
})
161161

162162
// iterate through unbonding delegations, reset creation height
163-
app.AppKeepers.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) {
163+
app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) {
164164
for i := range ubd.Entries {
165165
ubd.Entries[i].CreationHeight = 0
166166
}
167-
app.AppKeepers.StakingKeeper.SetUnbondingDelegation(ctx, ubd)
167+
app.StakingKeeper.SetUnbondingDelegation(ctx, ubd)
168168
return false
169169
})
170170

@@ -176,7 +176,7 @@ func (app *BitsongApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
176176

177177
for ; iter.Valid(); iter.Next() {
178178
addr := sdk.ValAddress(iter.Key()[1:])
179-
validator, err := app.AppKeepers.StakingKeeper.GetValidator(ctx, addr)
179+
validator, err := app.StakingKeeper.GetValidator(ctx, addr)
180180
if err != nil {
181181
panic("expected validator, not found")
182182
}
@@ -186,24 +186,24 @@ func (app *BitsongApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
186186
validator.Jailed = true
187187
}
188188

189-
app.AppKeepers.StakingKeeper.SetValidator(ctx, validator)
189+
app.StakingKeeper.SetValidator(ctx, validator)
190190
counter++
191191
}
192192

193193
iter.Close()
194194

195-
if _, err := app.AppKeepers.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx); err != nil {
195+
if _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx); err != nil {
196196
panic(err)
197197
}
198198

199199
/* Handle slashing state. */
200200

201201
// reset start height on signing infos
202-
app.AppKeepers.SlashingKeeper.IterateValidatorSigningInfos(
202+
app.SlashingKeeper.IterateValidatorSigningInfos(
203203
ctx,
204204
func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) {
205205
info.StartHeight = 0
206-
app.AppKeepers.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info)
206+
app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info)
207207
return false
208208
},
209209
)

0 commit comments

Comments
 (0)