refactor(x/accounts)!: accounts and auth module use the same account number tracking (#20405)

This commit is contained in:
son trinh
2024-06-03 13:40:03 +00:00
committed by GitHub
parent dbc0e659c0
commit 74d89bf506
23 changed files with 245 additions and 17 deletions
+13
View File
@@ -1,6 +1,7 @@
package integration_test
import (
"context"
"fmt"
"io"
"testing"
@@ -49,6 +50,12 @@ func Example() {
// gomock initializations
ctrl := gomock.NewController(&testing.T{})
acctsModKeeper := authtestutil.NewMockAccountsModKeeper(ctrl)
accNum := uint64(0)
acctsModKeeper.EXPECT().NextAccountNumber(gomock.Any()).AnyTimes().DoAndReturn(func(ctx context.Context) (uint64, error) {
currentNum := accNum
accNum++
return currentNum, nil
})
accountKeeper := authkeeper.NewAccountKeeper(
runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()),
@@ -147,6 +154,12 @@ func Example_oneModule() {
// gomock initializations
ctrl := gomock.NewController(&testing.T{})
acctsModKeeper := authtestutil.NewMockAccountsModKeeper(ctrl)
accNum := uint64(0)
acctsModKeeper.EXPECT().NextAccountNumber(gomock.Any()).AnyTimes().DoAndReturn(func(ctx context.Context) (uint64, error) {
currentNum := accNum
accNum++
return currentNum, nil
})
accountKeeper := authkeeper.NewAccountKeeper(
runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()),