Skip to content

Commit

Permalink
Add denommetadata check in rollapp genesis event test
Browse files Browse the repository at this point in the history
  • Loading branch information
trinitys7 committed Mar 28, 2024
1 parent a688943 commit 42098aa
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 13 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
cosmossdk.io/math v1.3.0
github.com/cosmos/cosmos-sdk v0.46.16
github.com/cosmos/ibc-go/v6 v6.2.1
github.com/decentrio/rollup-e2e-testing v0.0.0-20240325161106-405e71f46e86
github.com/decentrio/rollup-e2e-testing v0.0.0-20240328103700-ec0ced492b06
github.com/dymensionxyz/dymension-rdk v1.1.0-beta
github.com/dymensionxyz/dymension/v3 v3.0.0-rc02.0.20240321090214-067a132551ab
github.com/evmos/ethermint v0.22.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnG
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/decentrio/rollup-e2e-testing v0.0.0-20240325161106-405e71f46e86 h1:4ZfeMGU0KWbxSGeA0k9jss56DDZ+ddC9HKDYp5Y7Gu4=
github.com/decentrio/rollup-e2e-testing v0.0.0-20240325161106-405e71f46e86/go.mod h1:Hy/8P41OEKrlAatPG5NcD/BOWTa2s+laECwpZpmA9f0=
github.com/decentrio/rollup-e2e-testing v0.0.0-20240328103700-ec0ced492b06 h1:QYPi8aNnU6XWnan4o2Cxd4/fL/brRTU9rogI53Ms27M=
github.com/decentrio/rollup-e2e-testing v0.0.0-20240328103700-ec0ced492b06/go.mod h1:Hy/8P41OEKrlAatPG5NcD/BOWTa2s+laECwpZpmA9f0=
github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4=
github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo=
github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y=
Expand Down
37 changes: 29 additions & 8 deletions tests/rollapp_genesis_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"testing"
"time"

"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -155,18 +154,18 @@ func TestRollappGenesisEvent_EVM(t *testing.T) {
require.Equal(t, new_params.Value, string(deployerWhitelistParams))

channel, err := ibc.GetTransferChannel(ctx, r, eRep, dymension.Config().ChainID, rollapp1.Config().ChainID)
if err != nil {
fmt.Println("error getting transfer channel: ", err)
time.Sleep(3000 * time.Second)
}
txHash, err := dymension.FullNodes[0].ExecTx(ctx, dymensionUserAddr, "rollapp", "genesis-event", rollapp1.GetChainID(), channel.ChannelID)
require.NoError(t, err)

txHash, err := dymension.FullNodes[0].ExecTx(ctx, dymensionUserAddr, "rollapp", "genesis-event", rollapp1.GetChainID(), channel.ChannelID, "--gas=auto")
require.NoError(t, err)

tx, err := dymension.GetTransaction(txHash)
require.NoError(t, err)

recipient, _ := cosmos.AttributeValue(tx.Events, "transfer", "recipient")
coinStr, _ := cosmos.AttributeValue(tx.Events, "transfer", "amount")
recipient, ok := cosmos.AttributeValue(tx.Events, "transfer", "recipient")
require.True(t, ok, "failed to retrieve transfer recipient")
coinStr, ok := cosmos.AttributeValue(tx.Events, "transfer", "amount")
require.True(t, ok, "failed to retrieve transfer amount")

genesisCoin, err := sdk.ParseCoinNormalized(coinStr)
require.NoError(t, err)
Expand Down Expand Up @@ -215,4 +214,26 @@ func TestRollappGenesisEvent_EVM(t *testing.T) {
require.NoError(t, err)

testutil.AssertBalance(t, ctx, rollapp1, escrowAddress, rollapp1.Config().Denom, genesisCoin.Amount)

denommetadata, err := dymension.GetNode().QueryDenomMetadata(ctx, genesisCoin.Denom)
require.NoError(t, err)

require.Equal(t, denommetadata.Description, fmt.Sprintf("auto-generated metadata for %s from rollapp %s", genesisCoin.Denom, rollapp1.GetChainID()))
require.Equal(t, denommetadata.Base, genesisCoin.Denom)
denomUnits := []cosmos.DenomUnit{
{
Denom: genesisCoin.Denom,
Exponent: 0,
Aliases: []string{rollapp1.Config().Denom},
},
{
Denom: "rax",
Exponent: 6,
Aliases: []string{},
},
}
require.Equal(t, denommetadata.DenomUnits, denomUnits)
require.Equal(t, denommetadata.Display, "rax")
require.Equal(t, denommetadata.Symbol, "URAX")
require.Equal(t, denommetadata.Name, fmt.Sprintf("%s %s", rollapp1.GetChainID(), rollapp1.Config().Denom))
}
4 changes: 2 additions & 2 deletions tests/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var (

rollappEVMImage = ibc.DockerImage{
Repository: RollappEVMMainRepo,
Version: "7df6696f",
Version: rollappEVMVersion,
UidGid: "1025:1025",
}

Expand Down Expand Up @@ -276,7 +276,7 @@ func GetDockerImageVersion() (dymensionVersion, rollappEVMVersion, rollappWasmVe

rollappEVMVersion, found = os.LookupEnv("ROLLAPP_EVM_CI")
if !found {
rollappEVMVersion = "7df6696f"
rollappEVMVersion = "latest"
}

rollappWasmVersion, found = os.LookupEnv("ROLLAPP_WASM_CI")
Expand Down

0 comments on commit 42098aa

Please sign in to comment.