Skip to content

Commit

Permalink
fix: launch tool to specify the ibcfee version at chain link (#113)
Browse files Browse the repository at this point in the history
* fix launch tool to specify the ibcfee version at chain link

* apply coderabbit comment
  • Loading branch information
beer-1 authored Oct 4, 2024
1 parent df0bd2c commit 77b18cb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contrib/launchtools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ minitiad launch $TARGET_NETWORK --with-config [path-to-config]
"l1_config": {
"chain_id": "initiation-1",
"rpc_url": "https://rpc.initiation-1.initia.xyz:443",
"gas_prices": "0.15uinit"
"gas_prices": "0.015uinit"
},
"l2_config": {
"chain_id": "minitia-XDzNjd-1",
Expand Down
2 changes: 1 addition & 1 deletion contrib/launchtools/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (l1config *L1Config) Finalize(buf *bufio.Reader) error {
}

if l1config.GasPrices == "" {
l1config.GasPrices = "0.15uinit"
l1config.GasPrices = "0.015uinit"
}

_, err := sdk.ParseDecCoins(l1config.GasPrices)
Expand Down
28 changes: 25 additions & 3 deletions contrib/launchtools/steps/ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import (
relayertypes "github.com/cosmos/relayer/v2/relayer"
relayerconfig "github.com/cosmos/relayer/v2/relayer/chains/cosmos"

ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"

"github.com/initia-labs/OPinit/contrib/launchtools"
)

Expand Down Expand Up @@ -235,21 +238,40 @@ func initializeRelayerKeyring(config *launchtools.Config) func(*Relayer) error {
}
}

func marshalIBCFeeMetadata(appVersion string) ([]byte, error) {
return json.Marshal(ibcfeetypes.Metadata{
FeeVersion: ibcfeetypes.Version,
AppVersion: appVersion,
})
}

// link creates a default transfer channel between the chains
// it does all the heavy lifting of creating the channel, connection, and client
func link(r *Relayer) error {
r.logger.Info("linking chains for relayer...")
versionBz, err := marshalIBCFeeMetadata(ibctransfertypes.Version)
if err != nil {
return err
}

r.logger.Info("linking chains for relayer...", "version", string(versionBz))
return r.run([]string{
"tx",
"link",
RelayerPathName,
"--version",
string(versionBz),
})
}

// linkWithports is the same as link, however ports are specified
func linkWithPorts(srcPort string, dstPort string, version string) func(*Relayer) error {
return func(r *Relayer) error {
r.logger.Info("linking chains for relayer...")
versionBz, err := marshalIBCFeeMetadata(version)
if err != nil {
return err
}

r.logger.Info("linking chains for relayer...", "version", string(versionBz))
return r.run([]string{
"tx",
"link",
Expand All @@ -259,7 +281,7 @@ func linkWithPorts(srcPort string, dstPort string, version string) func(*Relayer
"--dst-port",
dstPort,
"--version",
version,
string(versionBz),
})
}
}
Expand Down

0 comments on commit 77b18cb

Please sign in to comment.