Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix obvious issues with tutorials #347

Merged
merged 3 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/gm/init-arabica-testnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jq --argjson pubKey "$PUB_KEY" '.consensus["validators"]=[{"address": "'$ADDRESS
echo "DA_BLOCK_HEIGHT=$DA_BLOCK_HEIGHT" >> restart-testnet.sh
echo "AUTH_TOKEN=$AUTH_TOKEN" >> restart-testnet.sh

echo "gmd start --rollkit.aggregator --rollkit.da_auth_token=\$AUTH_TOKEN --rollkit.da_namespace 00000000000000000000000000000000000000000008e5f679bf7116cb --rollkit.da_start_height \$DA_BLOCK_HEIGHT --rpc.laddr tcp://127.0.0.1:36657 --grpc.address 127.0.0.1:9290 --p2p.laddr \"0.0.0.0:36656\" --minimum-gas-prices="0.025stake"" >> restart-testnet.sh
echo "gmd start --rollkit.aggregator --rollkit.da_auth_token=\$AUTH_TOKEN --rollkit.da_namespace 00000000000000000000000000000000000000000008e5f679bf7116cb --rollkit.da_start_height \$DA_BLOCK_HEIGHT --rpc.laddr tcp://127.0.0.1:26657 --grpc.address 127.0.0.1:9290 --p2p.laddr \"0.0.0.0:36656\" --minimum-gas-prices="0.025stake"" >> restart-testnet.sh
gupadhyaya marked this conversation as resolved.
Show resolved Hide resolved

# start the chain
gmd start --rollkit.aggregator --rollkit.da_auth_token=$AUTH_TOKEN --rollkit.da_namespace 00000000000000000000000000000000000000000008e5f679bf7116cb --rollkit.da_start_height $DA_BLOCK_HEIGHT --rpc.laddr tcp://127.0.0.1:36657 --grpc.address 127.0.0.1:9290 --p2p.laddr "0.0.0.0:36656" --minimum-gas-prices="0.025stake"
gmd start --rollkit.aggregator --rollkit.da_auth_token=$AUTH_TOKEN --rollkit.da_namespace 00000000000000000000000000000000000000000008e5f679bf7116cb --rollkit.da_start_height $DA_BLOCK_HEIGHT --rpc.laddr tcp://127.0.0.1:26657 --grpc.address 127.0.0.1:9290 --p2p.laddr "0.0.0.0:36656" --minimum-gas-prices="0.025stake"
gupadhyaya marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 5 additions & 1 deletion tutorials/cosmwasm.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ And build the binary:
make install
```

::: tip
You will have to install `gcc` if you are trying it on a clean linux vm.
MSevey marked this conversation as resolved.
Show resolved Hide resolved
:::

### ✨ Celestia node {#celestia-node}

You will need a light node running with test tokens on
Expand Down Expand Up @@ -318,7 +322,7 @@ we will need to query our tx hash directly to get information about it.
Let's start by querying our transaction hash for its code ID:

```bash
CODE_ID=$(wasmd query tx --type=hash $TX_HASH celeswasm --node http://127.0.0.1:36657 --output json | jq -r '.events[-1].attributes[1].value')
CODE_ID=$(wasmd query tx --type=hash $TX_HASH --node http://127.0.0.1:36657 --output json | jq -r '.events[-1].attributes[1].value')
echo $CODE_ID
```

Expand Down
2 changes: 1 addition & 1 deletion tutorials/gm-world-arabica-testnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on Arabica devnet (`arabica-11`).
Follow instructions to install and start your Celestia data availability
layer light node selecting the Arabica network. You can
[find instructions to install and run the node](https://docs.celestia.org/nodes/light-node).
After the node is synced, stop the light node.
Keep the node running while doing the next steps.

### 🟢 Start your sovereign rollup {#start-your-sovereign-rollup}

Expand Down
10 changes: 9 additions & 1 deletion tutorials/gm-world-frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,17 @@ Now that you have your rollup running, you are ready to scaffold
the frontend! In your terminal, first install `create-cosmos-app`:

```bash
npm install -g create-cosmos-app
yarn global add create-cosmos-app
```

::: tip
✋ If you don't have yarn, run this command to install it using cURL on most Linux distros and macOS:
```bash
curl -o- -L https://yarnpkg.com/install.sh | bash
```

:::

Now scaffold an app:

```bash
Expand Down
4 changes: 2 additions & 2 deletions tutorials/ibc-connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ pagination:

### Transfer token back from osmosis-local to rollup chain

Set your channel hash from the last step:
Set your channel hash from the last step like this:

```bash
IBC_DENOM_STRING=ibc/64BA6E31FE887D66C6F8F31C7B1A80C7CA179239677B4088BB55F5EA07DBE273
IBC_DENOM_STRING=youribc/64BA6E31FE887D66C6F8F31C7B1A80C7CA179239677B4088BB55F5EA07DBE273
```

Make an ibc-transfer transaction:
Expand Down
26 changes: 18 additions & 8 deletions tutorials/recipe-book.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ package keeper
import (
"encoding/binary"

"github.com/cosmos/cosmos-sdk/store/prefix"
"cosmossdk.io/store/prefix"
"github.com/cosmos/cosmos-sdk/runtime"
sdk "github.com/cosmos/cosmos-sdk/types"

"recipes/x/recipes/types"
Expand Down Expand Up @@ -221,7 +222,8 @@ Next, implement `GetRecipeCount` in the `recipes/x/recipes/keeper/recipe.go` fil
```go title="recipes/x/recipes/keeper/recipe.go"
func (k Keeper) GetRecipeCount(ctx sdk.Context) uint64 {
// Get the store using storeKey (which is "recipes") and RecipeCountKey (which is "Recipe-count-")
store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.RecipeCountKey))
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
store := prefix.NewStore(storeAdapter, []byte(types.RecipeCountKey))

// Convert the RecipeCountKey to bytes
byteKey := []byte(types.RecipeCountKey)
Expand All @@ -244,7 +246,8 @@ And then `SetRecipeCount`:
```go title="recipes/x/recipes/keeper/recipe.go"
func (k Keeper) SetRecipeCount(ctx sdk.Context, count uint64) {
// Get the store using storeKey (which is "recipes") and RecipeCountKey (which is "Recipe-count-")
store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.RecipeCountKey))
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
store := prefix.NewStore(storeAdapter, []byte(types.RecipeCountKey))

// Convert the RecipeCountKey to bytes
byteKey := []byte(types.RecipeCountKey)
Expand All @@ -271,7 +274,8 @@ func (k Keeper) AppendRecipe (ctx sdk.Context, recipe types.Recipe) uint64 {
recipe.Id = count

// Get the store
store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.RecipeKey))
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
store := prefix.NewStore(storeAdapter, []byte(types.RecipeKey))

// Convert the recipe ID into bytes
byteKey := make([]byte, 8)
Expand Down Expand Up @@ -378,10 +382,10 @@ func (k Keeper) Dishes(c context.Context, req *types.QueryDishesRequest) (*types
ctx := sdk.UnwrapSDKContext(c)

// Get the key-value module store using the store key (in our case store key is "chain")
store := ctx.KVStore(k.storeKey)
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))

// Get the part of the store that keeps recipes (using recipe key, which is "Recipe-value-")
recipeStore := prefix.NewStore(store, []byte(types.RecipeKey))
recipeStore := prefix.NewStore(storeAdapter, []byte(types.RecipeKey))

// Paginate the recipes store based on PageRequest
pageRes, err := query.Paginate(recipeStore, req.Pagination, func(key []byte, value []byte) error {
Expand Down Expand Up @@ -421,6 +425,12 @@ sovereign rollup.
Be sure you have initialized your node before trying to start it.
Your start command should look similar to:

::: tip

It is recommended that you [create your own key](https://docs.celestia.org/nodes/light-node#keys-and-wallets) and fund it with a [testnet tokens](https://docs.celestia.org/nodes/light-node#testnet-tokens).

:::

<!-- markdownlint-disable MD013 -->
```bash
celestia light start --core.ip validator-1.celestia-arabica-11.com --p2p.network arabica
Expand Down Expand Up @@ -461,15 +471,15 @@ With that, we have kickstarted our `recipesd` network!
![recipe-start.gif](/recipes/recipe-start.gif)

Find
[your account address on an Arabica explorer to see your `PayForBlobs` transactions](https://explorer.modular.cloud/celestia-arabica/addresses/celestia10rdu7l3gzeuxplpnr5vxchvxxflx7ym0q6wt5v).
[your account address on an Arabica explorer to see your `PayForBlobs` transactions](https://explorer.modular.cloud/celestia-arabica/transactions).

Open another teminal instance. Now, create your first
recipe in the command line by sending a transaction from `recipes-key`,
when prompted, confirm the transaction by entering `y`:

<!-- markdownlint-disable MD013 -->
```bash
recipesd tx recipes create-recipe salad "spinach, mandarin oranges, sliced almonds, smoked gouda, citrus vinaigrette" --from recipes-key --keyring-backend test
recipesd tx recipes create-recipe salad "spinach, mandarin oranges, sliced almonds, smoked gouda, citrus vinaigrette" --from recipes-key --keyring-backend test --fees 5000stake --chain-id recipes
```
<!-- markdownlint-enable MD013 -->

Expand Down
18 changes: 10 additions & 8 deletions tutorials/wordle.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ your cosmos-sdk blockchain.
| readme.md | A readme file for your sovereign application-specific blockchain project.

Going over each one is outside the scope of this guide, but we encourage you
to read about it [here](https://docs.ignite.com/v0.25.2/kb).
to read about it [here](https://docs.ignite.com).

Most of the tutorial work will happen inside the `x` directory.

Expand Down Expand Up @@ -319,6 +319,7 @@ import (
"crypto/sha256"
"encoding/hex"
"wordle/x/wordle/types"
"cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"time"
Expand All @@ -330,11 +331,11 @@ func (k msgServer) SubmitWordle(goCtx context.Context, msg *types.MsgSubmitWordl
ctx := sdk.UnwrapSDKContext(goCtx)
// Check to See the Wordle is 5 letters
if len(msg.Word) != 5 {
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Wordle Must Be A 5 Letter Word")
return nil, errors.Wrap(sdkerrors.ErrInvalidRequest, "Wordle Must Be A 5 Letter Word")
MSevey marked this conversation as resolved.
Show resolved Hide resolved
}
// Check to See Only Alphabets Are Passed for the Wordle
if !(IsLetter(msg.Word)) {
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Wordle Must Only Consist Of Letters In The Alphabet")
return nil, errors.Wrap(sdkerrors.ErrInvalidRequest, "Wordle Must Only Consist Of Letters In The Alphabet")
MSevey marked this conversation as resolved.
Show resolved Hide resolved
}

// Use Current Day to Create The Index of the Newly-Submitted Wordle of the Day
Expand All @@ -356,7 +357,7 @@ func (k msgServer) SubmitWordle(goCtx context.Context, msg *types.MsgSubmitWordl
// This Helps ensure only one Wordle is submitted per day
_, isFound := k.GetWordle(ctx, currentTimeHashString)
if isFound {
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Wordle of the Day is Already Submitted")
return nil, errors.Wrap(sdkerrors.ErrInvalidRequest, "Wordle of the Day is Already Submitted")
MSevey marked this conversation as resolved.
Show resolved Hide resolved
}
// Write Wordle to KV Store
k.SetWordle(ctx, wordle)
Expand Down Expand Up @@ -413,6 +414,7 @@ import (
"crypto/sha256"
"encoding/hex"
"wordle/x/wordle/types"
"cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"strconv"
Expand All @@ -424,12 +426,12 @@ func (k msgServer) SubmitGuess(goCtx context.Context, msg *types.MsgSubmitGuess)
ctx := sdk.UnwrapSDKContext(goCtx)
// Check Word is 5 Characters Long
if len(msg.Word) != 5 {
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Guess Must Be A 5 Letter Word!")
return nil, errors.Wrap(sdkerrors.ErrInvalidRequest, "Guess Must Be A 5 Letter Word!")
MSevey marked this conversation as resolved.
Show resolved Hide resolved
}

// Check String Contains Alphabet Letters Only
if !(IsLetter(msg.Word)) {
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Guess Must Only Consist of Alphabet Letters!")
return nil, errors.Wrap(sdkerrors.ErrInvalidRequest, "Guess Must Only Consist of Alphabet Letters!")
MSevey marked this conversation as resolved.
Show resolved Hide resolved
}

// Get Current Day to Pull Up Wordle of That Day As A Hash
Expand All @@ -439,7 +441,7 @@ func (k msgServer) SubmitGuess(goCtx context.Context, msg *types.MsgSubmitGuess)
var currentTimeHashString = hex.EncodeToString(currentTimeHash[:])
wordle, isFound := k.GetWordle(ctx, currentTimeHashString)
if !isFound {
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Wordle of The Day Hasn't Been Submitted Yet. Feel Free to Submit One!")
return nil, errors.Wrap(sdkerrors.ErrInvalidRequest, "Wordle of The Day Hasn't Been Submitted Yet. Feel Free to Submit One!")
}

// We Convert Current Day and Guesser to A Hash To Use As An Index For Today's Guesses For That Guesser
Expand All @@ -457,7 +459,7 @@ func (k msgServer) SubmitGuess(goCtx context.Context, msg *types.MsgSubmitGuess)
if isFound {
// Check if Submitter Reached 6 Tries
if guess.Count == strconv.Itoa(6) {
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "You Have Guessed The Maximum Amount of Times for The Day! Try Again Tomorrow With A New Wordle.")
return nil, errors.Wrap(sdkerrors.ErrInvalidRequest, "You Have Guessed The Maximum Amount of Times for The Day! Try Again Tomorrow With A New Wordle.")
MSevey marked this conversation as resolved.
Show resolved Hide resolved
}
currentCount, err := strconv.Atoi(guess.Count)
if err != nil {
Expand Down
Loading
Loading