From c1b60bb1e5aeb65098257398bd72438955fd8406 Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Tue, 13 Aug 2024 20:24:54 +0200 Subject: [PATCH] fix wrong logic --- .../base/x/{{moduleName}}/module/genesis_test.go.plush | 6 ++++-- ignite/templates/typed/list/genesis.go | 4 ++-- ignite/templates/typed/map/map.go | 2 +- ignite/templates/typed/singleton/singleton.go | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/module/genesis_test.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/genesis_test.go.plush index a305e68e7f..67d42f972a 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/module/genesis_test.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/genesis_test.go.plush @@ -18,8 +18,10 @@ func TestGenesis(t *testing.T) { } k, ctx, _ := keepertest.<%= title(moduleName) %>Keeper(t) - <%= moduleName %>.InitGenesis(ctx, k, genesisState) - got := <%= moduleName %>.ExportGenesis(ctx, k) + err := <%= moduleName %>.InitGenesis(ctx, k, genesisState) + require.NoError(t, err) + got, err := <%= moduleName %>.ExportGenesis(ctx, k) + require.NoError(t, err) require.NotNil(t, got) nullify.Fill(&genesisState) diff --git a/ignite/templates/typed/list/genesis.go b/ignite/templates/typed/list/genesis.go index 6dae4a5e77..5999446885 100644 --- a/ignite/templates/typed/list/genesis.go +++ b/ignite/templates/typed/list/genesis.go @@ -149,12 +149,12 @@ err = k.%[2]v.Walk(ctx, nil, func(key uint64, elem types.%[2]v) (bool, error) { return false, nil }) if err != nil { - return err + return nil, err } genesis.%[2]vCount, err = k.%[2]vSeq.Peek(ctx) if err != nil { - return err + return nil, err } %[1]v` diff --git a/ignite/templates/typed/map/map.go b/ignite/templates/typed/map/map.go index 9884372297..29e1dfd252 100644 --- a/ignite/templates/typed/map/map.go +++ b/ignite/templates/typed/map/map.go @@ -420,7 +420,7 @@ for _, elem := range genState.%[3]vList { genesis.%[2]vList = append(genesis.%[2]vList, val) return false, nil }); err != nil { - return err + return nil, err } %[1]v` replacementModuleExport := fmt.Sprintf( diff --git a/ignite/templates/typed/singleton/singleton.go b/ignite/templates/typed/singleton/singleton.go index 36d81c7811..3c1819f7f9 100644 --- a/ignite/templates/typed/singleton/singleton.go +++ b/ignite/templates/typed/singleton/singleton.go @@ -390,7 +390,7 @@ if genState.%[3]v != nil { templateModuleExport := `// Get all %[2]v %[2]v, err := k.%[3]v.Get(ctx) if err != nil { - return err + return nil, err } genesis.%[3]v = &%[2]v %[1]v`