From e62ae095897c2dcaf5dd6ba44763bbd5ce16f651 Mon Sep 17 00:00:00 2001 From: yito88 Date: Thu, 5 Dec 2024 14:58:10 +0100 Subject: [PATCH] fix for Namada v1.0.0 --- chain/namada/namada_chain.go | 2 +- examples/namada/namada_chain_test.go | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/chain/namada/namada_chain.go b/chain/namada/namada_chain.go index 66dcf3c3d..7a5d0e226 100644 --- a/chain/namada/namada_chain.go +++ b/chain/namada/namada_chain.go @@ -477,7 +477,7 @@ func (c *NamadaChain) SendIBCTransfer(ctx context.Context, channelID, keyName st return ibc.Tx{}, fmt.Errorf("the transaction failed: %s", outputStr) } - re = regexp.MustCompile(`Transaction ([0-9A-F]+) was successfully applied at height (\d+), consuming (\d+) gas units`) + re = regexp.MustCompile(`Transaction batch ([0-9A-F]+) was applied at height (\d+), consuming (\d+) gas units`) matchesAll := re.FindAllStringSubmatch(outputStr, -1) if len(matches) == 0 { return ibc.Tx{}, fmt.Errorf("the transaction failed: %s", outputStr) diff --git a/examples/namada/namada_chain_test.go b/examples/namada/namada_chain_test.go index aff90094e..16a0a2388 100644 --- a/examples/namada/namada_chain_test.go +++ b/examples/namada/namada_chain_test.go @@ -38,11 +38,12 @@ func TestNamadaNetwork(t *testing.T) { }}, { Name: "namada", - Version: "v0.44.1", + Version: "v1.0.0", ChainConfig: ibc.ChainConfig{ ChainID: "namada-test", Denom: namadachain.NamAddress, - Gas: "250000", + Gas: "50000", + GasPrices: "0.00001", CoinDecimals: &coinDecimals, Bin: "namada", }, @@ -58,8 +59,8 @@ func TestNamadaNetwork(t *testing.T) { // Relayer Factory r := interchaintest.NewBuiltinRelayerFactory(ibc.Hermes, zaptest.NewLogger(t), relayer.CustomDockerImage( - "ghcr.io/heliaxdev/hermes", - "v1.10.4-namada-beta17-rc2@sha256:a95ede57f63ebb4c70aa4ca0bfb7871a5d43cd76d17b1ad62f5d31a9465d65af", + "ghcr.io/informalsystems/hermes", + "luca_joss-test-namada-docker-action@sha256:3bae7e68fe76647d5dba19982d01d4c33e2eebef17e3506da17129f4e9483b11", "2000:2000", )). Build(t, client, network) @@ -103,9 +104,12 @@ func TestNamadaNetwork(t *testing.T) { initBalance := math.NewInt(1_000_000) - gasSpent, _ := strconv.ParseInt(namada.Config().Gas, 10, 64) - namadaGasSpent := math.NewInt(gasSpent) - tokenDenom := math.NewInt(int64(stdmath.Pow(10, float64(*namada.Config().CoinDecimals)))) + gasSpent, _ := strconv.ParseFloat(namada.Config().Gas, 64) + gasPrice, _ := strconv.ParseFloat(namada.Config().GasPrices, 64) + tokenDenomVal := stdmath.Pow(10, float64(*namada.Config().CoinDecimals)) + // GasSpent should be an integer + namadaGasSpent := math.NewInt(int64(gasSpent * gasPrice * tokenDenomVal)) + tokenDenom := math.NewInt(int64(tokenDenomVal)) namadaInitBalance := initBalance.Mul(tokenDenom) users := interchaintest.GetAndFundTestUsers(t, ctx, "user", initBalance, chain, namada)