Skip to content

Commit

Permalink
fix for Namada v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yito88 committed Dec 5, 2024
1 parent e32e003 commit e62ae09
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion chain/namada/namada_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 11 additions & 7 deletions examples/namada/namada_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e62ae09

Please sign in to comment.