Skip to content

Commit

Permalink
Merge branch 'main' into chore/new-network-path
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani authored Dec 17, 2024
2 parents ef565e0 + 3fec17a commit 46c4e89
Show file tree
Hide file tree
Showing 77 changed files with 2,216 additions and 1,505 deletions.
4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
- [#4300](https://github.com/ignite/cli/pull/4300) Only panics the module in the most top function level
- [#4327](https://github.com/ignite/cli/pull/4327) Use the TxConfig from simState instead create a new one
- [#4326](https://github.com/ignite/cli/pull/4326) Add `buf.build` version to `ignite version` command
- [#4289](https://github.com/ignite/cli/pull/4289), [#4423](https://github.com/ignite/cli/pull/4423) Cosmos SDK v0.52 support
- [#4436](https://github.com/ignite/cli/pull/4436) Return tx hash to the faucet API
- [#4437](https://github.com/ignite/cli/pull/4437) Remove module placeholders
- [#4289](https://github.com/ignite/cli/pull/4289), [#4423](https://github.com/ignite/cli/pull/4423), [#4432](https://github.com/ignite/cli/pull/4432) Cosmos SDK v0.52 support

### Changes

Expand Down
170 changes: 85 additions & 85 deletions docs/docs/02-guide/04-ibc.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,48 +223,48 @@ the `msg.Creator` value to the IBC `packet`.
package keeper

func (k msgServer) SendIbcPost(goCtx context.Context, msg *types.MsgSendIbcPost) (*types.MsgSendIbcPostResponse, error) {
// validate incoming message
if _, err := k.addressCodec.StringToBytes(msg.Creator); err != nil {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, fmt.Sprintf("invalid address: %s", err))
}

if msg.Port == "" {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid packet port")
}

if msg.ChannelID == "" {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid packet channel")
}

if msg.TimeoutTimestamp == 0 {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid packet timeout")
}

// TODO: logic before transmitting the packet

// Construct the packet
var packet types.IbcPostPacketData

packet.Title = msg.Title
packet.Content = msg.Content
// highlight-next-line
packet.Creator = msg.Creator

// Transmit the packet
ctx := sdk.UnwrapSDKContext(goCtx)
_, err := k.TransmitIbcPostPacket(
ctx,
packet,
msg.Port,
msg.ChannelID,
clienttypes.ZeroHeight(),
msg.TimeoutTimestamp,
)
if err != nil {
return nil, err
}

return &types.MsgSendIbcPostResponse{}, nil
// validate incoming message
if _, err := k.addressCodec.StringToBytes(msg.Creator); err != nil {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, fmt.Sprintf("invalid address: %s", err))
}

if msg.Port == "" {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid packet port")
}

if msg.ChannelID == "" {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid packet channel")
}

if msg.TimeoutTimestamp == 0 {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid packet timeout")
}

// TODO: logic before transmitting the packet

// Construct the packet
var packet types.IbcPostPacketData

packet.Title = msg.Title
packet.Content = msg.Content
// highlight-next-line
packet.Creator = msg.Creator

// Transmit the packet
ctx := sdk.UnwrapSDKContext(goCtx)
_, err := k.TransmitIbcPostPacket(
ctx,
packet,
msg.Port,
msg.ChannelID,
clienttypes.ZeroHeight(),
msg.TimeoutTimestamp,
)
if err != nil {
return nil, err
}

return &types.MsgSendIbcPostResponse{}, nil
}
```

Expand Down Expand Up @@ -315,11 +315,11 @@ Then modify the `OnRecvIbcPostPacket` keeper function with the following code:
package keeper

func (k Keeper) OnRecvIbcPostPacket(ctx sdk.Context, packet channeltypes.Packet, data types.IbcPostPacketData) (packetAck types.IbcPostPacketAck, err error) {
packetAck.PostId, err = k.PostSeq.Next(ctx)
if err != nil {
return packetAck, err
}
return packetAck, k.Post.Set(ctx, packetAck.PostId, types.Post{Title: data.Title, Content: data.Content})
packetAck.PostId, err = k.PostSeq.Next(ctx)
if err != nil {
return packetAck, err
}
return packetAck, k.Post.Set(ctx, packetAck.PostId, types.Post{Title: data.Title, Content: data.Content})
}
```

Expand All @@ -339,33 +339,33 @@ from the packet.
package keeper

func (k Keeper) OnAcknowledgementIbcPostPacket(ctx sdk.Context, packet channeltypes.Packet, data types.IbcPostPacketData, ack channeltypes.Acknowledgement) error {
switch dispatchedAck := ack.Response.(type) {
case *channeltypes.Acknowledgement_Error:
// We will not treat acknowledgment error in this tutorial
return nil
case *channeltypes.Acknowledgement_Result:
// Decode the packet acknowledgment
var packetAck types.IbcPostPacketAck
if err := types.ModuleCdc.UnmarshalJSON(dispatchedAck.Result, &packetAck); err != nil {
// The counter-party module doesn't implement the correct acknowledgment format
return errors.New("cannot unmarshal acknowledgment")
}

seq, err := k.SentPostSeq.Next(ctx)
if err != nil {
return err
}

return k.SentPost.Set(ctx, seq,
types.SentPost{
PostId: packetAck.PostId,
Title: data.Title,
Chain: packet.DestinationPort + "-" + packet.DestinationChannel,
},
)
default:
return errors.New("the counter-party module does not implement the correct acknowledgment format")
}
switch dispatchedAck := ack.Response.(type) {
case *channeltypes.Acknowledgement_Error:
// We will not treat acknowledgment error in this tutorial
return nil
case *channeltypes.Acknowledgement_Result:
// Decode the packet acknowledgment
var packetAck types.IbcPostPacketAck
if err := types.ModuleCdc.UnmarshalJSON(dispatchedAck.Result, &packetAck); err != nil {
// The counter-party module doesn't implement the correct acknowledgment format
return errors.New("cannot unmarshal acknowledgment")
}

seq, err := k.SentPostSeq.Next(ctx)
if err != nil {
return err
}

return k.SentPost.Set(ctx, seq,
types.SentPost{
PostId: packetAck.PostId,
Title: data.Title,
Chain: packet.DestinationPort + "-" + packet.DestinationChannel,
},
)
default:
return errors.New("the counter-party module does not implement the correct acknowledgment format")
}
}
```

Expand All @@ -376,17 +376,17 @@ posts. This logic follows the same format as `sentPost`.

```go title="x/blog/keeper/ibc_post.go"
func (k Keeper) OnTimeoutIbcPostPacket(ctx sdk.Context, packet channeltypes.Packet, data types.IbcPostPacketData) error {
seq, err := k.TimeoutPostSeq.Next(ctx)
if err != nil {
return err
}

return k.TimeoutPost.Set(ctx, seq,
types.TimeoutPost{
Title: data.Title,
Chain: packet.DestinationPort + "-" + packet.DestinationChannel,
},
)
seq, err := k.TimeoutPostSeq.Next(ctx)
if err != nil {
return err
}

return k.TimeoutPost.Set(ctx, seq,
types.TimeoutPost{
Title: data.Title,
Chain: packet.DestinationPort + "-" + packet.DestinationChannel,
},
)
}
```

Expand Down
45 changes: 41 additions & 4 deletions docs/docs/08-references/01-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ To get started, create a blockchain:
* [ignite network](#ignite-network) - Launch a blockchain in production
* [ignite relayer](#ignite-relayer) - Connect blockchains with an IBC relayer
* [ignite scaffold](#ignite-scaffold) - Create a new blockchain, module, message, query, and more
* [ignite testnet](#ignite-testnet) - Start a testnet local
* [ignite testnet](#ignite-testnet) - Simulate (Fuzz) the chain or start a testnet, either in place (using mainnet data) or with multiple nodes.
* [ignite version](#ignite-version) - Print the current build information


Expand Down Expand Up @@ -3261,7 +3261,7 @@ ignite scaffold type NAME [field:type] ... [flags]

## ignite testnet

Start a testnet local
Simulate (Fuzz) the chain or start a testnet, either in place (using mainnet data) or with multiple nodes.

**Options**

Expand All @@ -3274,6 +3274,7 @@ Start a testnet local
* [ignite](#ignite) - Ignite CLI offers everything you need to scaffold, test, build, and launch your blockchain
* [ignite testnet in-place](#ignite-testnet-in-place) - Create and start a testnet from current local net state
* [ignite testnet multi-node](#ignite-testnet-multi-node) - Initialize and provide multi-node on/off functionality
* [ignite testnet simulate](#ignite-testnet-simulate) - Run simulation testing for the blockchain


## ignite testnet in-place
Expand Down Expand Up @@ -3305,7 +3306,7 @@ ignite testnet in-place [flags]

**SEE ALSO**

* [ignite testnet](#ignite-testnet) - Start a testnet local
* [ignite testnet](#ignite-testnet) - Simulate (Fuzz) the chain or start a testnet, either in place (using mainnet data) or with multiple nodes.


## ignite testnet multi-node
Expand Down Expand Up @@ -3357,7 +3358,43 @@ ignite testnet multi-node [flags]

**SEE ALSO**

* [ignite testnet](#ignite-testnet) - Start a testnet local
* [ignite testnet](#ignite-testnet) - Simulate (Fuzz) the chain or start a testnet, either in place (using mainnet data) or with multiple nodes.


## ignite testnet simulate

Run simulation testing for the blockchain

**Synopsis**

Run simulation testing for the blockchain. It sends many randomized-input messages of each module to a simulated node and checks if invariants break

```
ignite testnet simulate [flags]
```

**Options**

```
--blockSize int operations per block (default 30)
--exportParamsHeight int height to which export the randomly generated params
--exportParamsPath string custom file path to save the exported params JSON
--exportStatePath string custom file path to save the exported app state JSON
--exportStatsPath string custom file path to save the exported simulation statistics JSON
--genesis string custom simulation genesis file; cannot be used with params file
--genesisTime int override genesis UNIX time instead of using a random UNIX time
-h, --help help for simulate
--initialBlockHeight int initial block to start the simulation (default 1)
--lean lean simulation log output
--numBlocks int number of new blocks to simulate from the initial block height (default 200)
--params string custom simulation params file which overrides any random params; cannot be used with genesis
--period uint run slow invariants only once every period assertions
--seed int simulation random seed (default 42)
```

**SEE ALSO**

* [ignite testnet](#ignite-testnet) - Simulate (Fuzz) the chain or start a testnet, either in place (using mainnet data) or with multiple nodes.


## ignite version
Expand Down
6 changes: 3 additions & 3 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5432,9 +5432,9 @@ mz@^2.7.0:
thenify-all "^1.0.0"

nanoid@^3.3.6:
version "3.3.6"
resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz"
integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==
version "3.3.8"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.8.tgz#b1be3030bee36aaff18bacb375e5cce521684baf"
integrity sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==

[email protected]:
version "0.6.3"
Expand Down
Loading

0 comments on commit 46c4e89

Please sign in to comment.