Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: launch tool to specify the ibcfee version at chain link #113

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading