Skip to content

Commit 561d77b

Browse files
PantaniDeveloper Experience team at IgnitejulienrbrtJerónimo Albi
authored
feat: cosmos-sdk v0.50.x (#3659)
* update go.sum * cosmos-sdk v0.50 imports * changes imports and update sdk * fix vet issues * fix unused imports * bump ibc * add changelog * update mocks * rollback some test changes * fix go version for the git workflows * fix wront tx result for abci tx * fix wrong test case * remove some legacy methods and add module import blank to the `app_config.go` * remove legacy amino and fix genesis commands * fix module orders * remove unused modules and commands * fix module imports * use statstore instead key and memory store * fix missing runtime import for test keepers * remove typo * fix missing imports * add msg signer option to the tx proto messages * add release branch to trigger tests * remove invalid test case * fix typo * fix missing create mesage option for single messages scaffold * Initialized with Ignite CLI * remove unused files * `--events` flag was moved to `--query` into `query tx` command * refactor: v0.50 store app wiring (#3672) * refactor: v0.50 store app wiring * updates * updates --------- Co-authored-by: Danilo Pantani <danpantani@gmail.com> * refactor: remove unecessary boilerplate in module (#3673) * refactor: remove unecessary boilerplate in module * updates --------- Co-authored-by: Danilo Pantani <danpantani@gmail.com> * refactor: simplify app.go (#3675) * refactor: simplify app.go * updates --------- Co-authored-by: Danilo Pantani <danpantani@gmail.com> * fix simulation types * fix query txs params * remove some empty lines * refactor: remove unecessary boilerplate (#3676) Co-authored-by: Danilo Pantani <danpantani@gmail.com> * update go.mod.plush * rollback go.mod changes * fix module discovery to use the keepers * bump sdk and ibc * find module per keeper * check blank imports * remove unused test data * remove old support methods and move module pkg to module folder * fix the module scaffold to find the module folder * add more test case and blank imports * use basepath instead roothopath * add pre blockers * fix cmd root_v2 * change ProvideClientContext to a pointer * remove unused unit tests and fix others * bump cosmos-sdk and run make format * fix root.go * fix wrong tx swagger generation * fix ibc module import * fix unit tests * fix app config for the unit tests * return ModuleCDC for ibc modules * fix capability keeper without app wiring * cleanup root.go and app.go * rollback txConfigOpts * use keepers injections as optional * fix error handler assign for sim tests * fix root sdk config call * skip lint cache * fix unit tests for app.go discovery * fix test data * add mmising interface methods for some tests * fix cosmosanalystis find implementation methods * fix ibc keepers for the testutil pkg * fix expected keepers injection conflict * remove unused expected keepers interfsces * fix capability keeper nullpointer for unit tests * fix module_ibc.go scaffolder * rollback sdk context * add creator options for packet msgs * bump cosmos-sdk * fix unhandled error * rollback lint version and improve app module comments * move appconfig inject to app.go * fix default test config * increase chain test timeout for integration * remove unused `go.sum` files * bump cosmos-sdk and ibc * fix network tests * add generic clenaup for the network config * add cfg addresses manually * avoid override config ports * add chain id and log format to tx integration test * add tx output * add json output for key query * bump ibc/capability and sdk/client * bum go dependencies * rollback not linux support dependency * bump ibc * regenerate mocks * docs: update tutorials to work with SDK `v0.50` (#3705) * chore: add `--chain-id` flag to blog commands * chore: use `cosmossdk.io/store` * chore: change blog tutorial to use the store service * chore: use `cosmossdk.io/errors` * chore: change "PostID" to "PostId" * chore: add missing import to code snippet * fix: correct expected keepers interface args * chore: add `--chain-id` flag to loan commands * ci: fix broken links * ci: fix broken references * ci: fix broken reference * chore: fix typo --------- Co-authored-by: Danilo Pantani <danpantani@gmail.com> * bum chain ibc * fix: fix ibc registration in 0.50 (#3758) * fix: fix ibc registration in 0.59 * updates * nit --------- Co-authored-by: Danilo Pantani <danpantani@gmail.com> * register capability module and fix genesis order * ibc params register --------- Co-authored-by: Pantani <Pantani> Co-authored-by: Developer Experience team at Ignite <hello@ignite.com> Co-authored-by: Julien Robert <julien@rbrt.fr> Co-authored-by: Jerónimo Albi <jeronimo.albi@tendermint.com>
1 parent 2b53b25 commit 561d77b

File tree

218 files changed

+4813
-6742
lines changed

Some content is hidden

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

218 files changed

+4813
-6742
lines changed

.github/workflows/md-link-checker-config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
},
1818
{
1919
"pattern": "^index.md"
20+
},
21+
{
22+
"pattern": "^https://docs.starport.network"
2023
}
2124
],
2225
"replacementPatterns": [

.github/workflows/md-link-checker.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- "**.*.md"
99
branches:
1010
- main
11+
- release/*
1112

1213
concurrency:
1314
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}

.github/workflows/test-integration.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- '**.md'
77
branches:
88
- main
9+
- release/*
910

1011
concurrency:
1112
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- '**.md'
88
branches:
99
- main
10+
- release/*
1011

1112
concurrency:
1213
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [#3476](https://github.com/ignite/cli/pull/3476) Use `buf.build` binary to code generate from proto files
1111
- [#3614](https://github.com/ignite/cli/pull/3614) feat: use DefaultBaseappOptions for app.New method
1212
- [#3536](https://github.com/ignite/cli/pull/3536) Change app.go to v2 and add AppWiring feature
13+
- [#3659](https://github.com/ignite/cli/pull/3659) cosmos-sdk `v0.50.x`
1314
- [#3670](https://github.com/ignite/cli/pull/3670) Remove nodetime binaries
1415
- [#3724](https://github.com/ignite/cli/pull/3724) Add or vendor proto packages from Go dependencies
1516
- [#3715](https://github.com/ignite/cli/pull/3715) Add test suite for the cli tests

docs/docs/02-guide/03-hello/01-scaffolding.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ to the list of available commands, allowing users to call it from the
187187
command-line interface (CLI).
188188

189189
```go title="x/hello/client/cli/query.go"
190-
func GetQueryCmd(queryRoute string) *cobra.Command {
190+
func GetQueryCmd() *cobra.Command {
191191
cmd := &cobra.Command{
192192
Use: types.ModuleName,
193193
Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName),

docs/docs/02-guide/04-blog/00-express.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ While `ignite chain serve` is running in one terminal window, open another
173173
terminal and use the chain's binary to create a new blog post on the blockchain:
174174

175175
```
176-
blogd tx blog create-post 'Hello, World!' 'This is a blog post' --from alice
176+
blogd tx blog create-post 'Hello, World!' 'This is a blog post' --from alice --chain-id blog
177177
```
178178

179179
When using the `--from` flag to specify the account that will be used to sign a
@@ -220,7 +220,7 @@ transaction will be broadcasted to the blockchain and the blog post will be
220220
updated with the new body content.
221221

222222
```
223-
blogd tx blog update-post 0 'Hello, World!' 'This is a blog post from Alice' --from alice
223+
blogd tx blog update-post 0 'Hello, World!' 'This is a blog post from Alice' --from alice --chain-id blog
224224
```
225225

226226
Now that we have updated the blog post with new content, let's query the
@@ -263,7 +263,7 @@ example of how the blockchain can enforce rules and permissions, and it shows
263263
that only authorized users are able to make changes to the blockchain.
264264

265265
```
266-
blogd tx blog delete-post 0 --from bob
266+
blogd tx blog delete-post 0 --from bob --chain-id blog
267267
268268
raw_log: 'failed to execute message; message index: 0: incorrect owner: unauthorized'
269269
```
@@ -273,7 +273,7 @@ account. Since Alice is the author of the blog post, she should be authorized to
273273
delete it.
274274

275275
```
276-
blogd tx blog delete-post 0 --from alice
276+
blogd tx blog delete-post 0 --from alice --chain-id blog
277277
```
278278

279279
To check whether the blog post has been successfully deleted by Alice, we can
@@ -306,4 +306,4 @@ some of the code ourselves, we can gain a deeper understanding of how Ignite
306306
works and how it can be used to create applications on a blockchain. This will
307307
help us learn more about the capabilities of Ignite CLI and how it can be used
308308
to build robust and powerful applications. Keep an eye out for these tutorials
309-
and get ready to dive deeper into the world of blockchains with Ignite!
309+
and get ready to dive deeper into the world of blockchains with Ignite!

docs/docs/02-guide/04-blog/03-create.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@ import (
2929

3030
"blog/x/blog/types"
3131

32-
"github.com/cosmos/cosmos-sdk/store/prefix"
32+
"cosmossdk.io/store/prefix"
33+
"github.com/cosmos/cosmos-sdk/runtime"
3334
sdk "github.com/cosmos/cosmos-sdk/types"
3435
)
3536

3637
func (k Keeper) AppendPost(ctx sdk.Context, post types.Post) uint64 {
3738
count := k.GetPostCount(ctx)
3839
post.Id = count
39-
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PostKey))
40+
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
41+
store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.PostKey))
4042
appendedValue := k.cdc.MustMarshal(&post)
4143
store.Set(GetPostIDBytes(post.Id), appendedValue)
4244
k.SetPostCount(ctx, count+1)
@@ -126,7 +128,8 @@ In the file `post.go`, let's define the `GetPostCount` function as follows:
126128

127129
```go title="x/blog/keeper/post.go"
128130
func (k Keeper) GetPostCount(ctx sdk.Context) uint64 {
129-
store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte{})
131+
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
132+
store := prefix.NewStore(storeAdapter, []byte{})
130133
byteKey := types.KeyPrefix(types.PostCountKey)
131134
bz := store.Get(byteKey)
132135
if bz == nil {
@@ -209,7 +212,8 @@ in the database.
209212

210213
```go title="x/blog/keeper/post.go"
211214
func (k Keeper) SetPostCount(ctx sdk.Context, count uint64) {
212-
store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte{})
215+
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
216+
store := prefix.NewStore(storeAdapter, []byte{})
213217
byteKey := types.KeyPrefix(types.PostCountKey)
214218
bz := make([]byte, 8)
215219
binary.BigEndian.PutUint64(bz, count)
@@ -316,4 +320,4 @@ then returns a `MsgCreatePostResponse` object containing the ID of the newly
316320
created post.
317321

318322
By implementing these methods, you have successfully implemented the necessary
319-
logic for handling "create post" messages and adding posts to the blockchain.
323+
logic for handling "create post" messages and adding posts to the blockchain.

docs/docs/02-guide/04-blog/04-update.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Implement the `GetPost` keeper method in `post.go`:
1515

1616
```go title="x/blog/keeper/post.go"
1717
func (k Keeper) GetPost(ctx sdk.Context, id uint64) (val types.Post, found bool) {
18-
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PostKey))
18+
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
19+
store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.PostKey))
1920
b := store.Get(GetPostIDBytes(id))
2021
if b == nil {
2122
return val, false
@@ -48,7 +49,8 @@ Implement the `SetPost` keeper method in `post.go`:
4849

4950
```go title="x/blog/keeper/post.go"
5051
func (k Keeper) SetPost(ctx sdk.Context, post types.Post) {
51-
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PostKey))
52+
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
53+
store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.PostKey))
5254
b := k.cdc.MustMarshal(&post)
5355
store.Set(GetPostIDBytes(post.Id), b)
5456
}
@@ -78,6 +80,7 @@ import (
7880

7981
"blog/x/blog/types"
8082

83+
errorsmod "cosmossdk.io/errors"
8184
sdk "github.com/cosmos/cosmos-sdk/types"
8285
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
8386
)
@@ -92,10 +95,10 @@ func (k msgServer) UpdatePost(goCtx context.Context, msg *types.MsgUpdatePost) (
9295
}
9396
val, found := k.GetPost(ctx, msg.Id)
9497
if !found {
95-
return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("key %d doesn't exist", msg.Id))
98+
return nil, errorsmod.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("key %d doesn't exist", msg.Id))
9699
}
97100
if msg.Creator != val.Creator {
98-
return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "incorrect owner")
101+
return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "incorrect owner")
99102
}
100103
k.SetPost(ctx, post)
101104
return &types.MsgUpdatePostResponse{}, nil
@@ -124,4 +127,4 @@ can be useful for correcting mistakes or updating the content of a post as new
124127
information becomes available.
125128

126129
Finally, you implemented the `UpdatePost` method, which is called whenever the
127-
blockchain processes a message requesting an update to a post.
130+
blockchain processes a message requesting an update to a post.

docs/docs/02-guide/04-blog/05-delete.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ message.
77

88
```go title="x/blog/keeper/post.go"
99
func (k Keeper) RemovePost(ctx sdk.Context, id uint64) {
10-
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PostKey))
10+
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
11+
store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.PostKey))
1112
store.Delete(GetPostIDBytes(id))
1213
}
1314
```
@@ -32,6 +33,7 @@ import (
3233

3334
"blog/x/blog/types"
3435

36+
errorsmod "cosmossdk.io/errors"
3537
sdk "github.com/cosmos/cosmos-sdk/types"
3638
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
3739
)
@@ -40,10 +42,10 @@ func (k msgServer) DeletePost(goCtx context.Context, msg *types.MsgDeletePost) (
4042
ctx := sdk.UnwrapSDKContext(goCtx)
4143
val, found := k.GetPost(ctx, msg.Id)
4244
if !found {
43-
return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("key %d doesn't exist", msg.Id))
45+
return nil, errorsmod.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("key %d doesn't exist", msg.Id))
4446
}
4547
if msg.Creator != val.Creator {
46-
return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "incorrect owner")
48+
return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "incorrect owner")
4749
}
4850
k.RemovePost(ctx, msg.Id)
4951
return &types.MsgDeletePostResponse{}, nil
@@ -57,7 +59,7 @@ a pointer to a message of type `*types.MsgDeletePostResponse` and an `error`.
5759
Inside the function, the context is unwrapped using the `sdk.UnwrapSDKContext`
5860
function and the value of the post with the ID specified in the message is
5961
retrieved using the `GetPost` function. If the post is not found, an error is
60-
returned using the `sdkerrors.Wrap` function. If the creator of the message does
62+
returned using the `errorsmod.Wrap` function. If the creator of the message does
6163
not match the creator of the post, another error is returned. If both of these
6264
checks pass, the `RemovePost` function is called with the context and the ID of
6365
the post to delete the post. Finally, the function returns a response message
@@ -71,4 +73,4 @@ requester is the creator of the post before deleting it.
7173
Congratulations on completing the implementation of the `RemovePost` and
7274
`DeletePost` methods in the keeper package! These methods provide functionality
7375
for removing a post from a store and handling a request to delete a post,
74-
respectively.
76+
respectively.

0 commit comments

Comments
 (0)