Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Commit

Permalink
sync simapp changes
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt authored and github-actions[bot] committed Jun 13, 2024
1 parent 56a0d12 commit 9276700
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 4 deletions.
54 changes: 54 additions & 0 deletions app/next/upgrades_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package simapp

import (
"testing"

cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
"github.com/stretchr/testify/require"

"cosmossdk.io/collections"
authkeeper "cosmossdk.io/x/auth/keeper"
authtypes "cosmossdk.io/x/auth/types"
)

// TestSyncAccountNumber tests if accounts module account number is set correctly with the value get from auth.
// Also check if the store entry for auth GlobalAccountNumberKey is successfully deleted.
func TestSyncAccountNumber(t *testing.T) {
app := Setup(t, true)
ctx := app.NewUncachedContext(true, cmtproto.Header{})

bytesKey := authtypes.GlobalAccountNumberKey
store := app.AuthKeeper.KVStoreService.OpenKVStore(ctx)

// initially there is no value set yet
v, err := store.Get(bytesKey)
require.NoError(t, err)
require.Nil(t, v)

// set value for legacy account number
v, err = collections.Uint64Value.Encode(10)
require.NoError(t, err)
err = store.Set(bytesKey, v)
require.NoError(t, err)

// make sure value are updated
v, err = store.Get(bytesKey)
require.NoError(t, err)
require.NotEmpty(t, v)
num, err := collections.Uint64Value.Decode(v)
require.NoError(t, err)
require.Equal(t, uint64(10), num)

err = authkeeper.MigrateAccountNumberUnsafe(ctx, &app.AuthKeeper)
require.NoError(t, err)

// make sure the DB entry for this key is deleted
v, err = store.Get(bytesKey)
require.NoError(t, err)
require.Nil(t, v)

// check if accounts's account number is updated
currentNum, err := app.AccountsKeeper.AccountNumber.Peek(ctx)
require.NoError(t, err)
require.Equal(t, uint64(10), currentNum)
}
2 changes: 1 addition & 1 deletion app/v050/COMMIT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
aeb1e8f46b8dad727e1935ac7728fb0c0327f280
c5253e82295eab112874875ad893dc581987d788
2 changes: 1 addition & 1 deletion app/v050/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ replace (
// use cosmos fork of keyring
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
// Simapp always use the latest version of the cosmos-sdk
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.50.8-0.20240607123402-aeb1e8f46b8d
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.50.8-0.20240612072529-c5253e82295e
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1
Expand Down
4 changes: 2 additions & 2 deletions app/v050/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK
github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
github.com/cosmos/cosmos-sdk v0.50.8-0.20240607123402-aeb1e8f46b8d h1:Pi0XIK8hyn+7/EZRbQ9/S/1eXAAEzgS2uvFEBK65xXk=
github.com/cosmos/cosmos-sdk v0.50.8-0.20240607123402-aeb1e8f46b8d/go.mod h1:uK0amHvR3nlIAJ1OMVuNv6HwYaYPIanWOUX8yHCIL1E=
github.com/cosmos/cosmos-sdk v0.50.8-0.20240612072529-c5253e82295e h1:owZUVklA0dxjh/QQMw397RWFBT90s8Gh8trBlBKMGHE=
github.com/cosmos/cosmos-sdk v0.50.8-0.20240612072529-c5253e82295e/go.mod h1:uK0amHvR3nlIAJ1OMVuNv6HwYaYPIanWOUX8yHCIL1E=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE=
Expand Down

0 comments on commit 9276700

Please sign in to comment.