Skip to content

feat: integrate wasm 08 #184

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

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
99b7ccc
Add wasm type support for tendermint clients
misko9 Apr 20, 2023
ea42d28
Move wasm enablement from provider config to create client / link cmd as
misko9 Apr 21, 2023
75f4a98
fix: wasm code adjustment
viveksharmapoudel Oct 10, 2023
daa50df
fix: exported wasm
viveksharmapoudel Oct 10, 2023
972f5f5
fix: update client setup
viveksharmapoudel Oct 10, 2023
98153f6
fix: issue
viveksharmapoudel Oct 10, 2023
97f066b
fix: multiple wasm module register issue
viveksharmapoudel Oct 27, 2023
23a0472
feat: wasm client creation of icon on cosmos native module
viveksharmapoudel Oct 27, 2023
fa05d10
fix: update ibc-integration repo
viveksharmapoudel Oct 30, 2023
738b6a5
fix: adjust clientState of cosmos native module for icon-ibc
viveksharmapoudel Oct 30, 2023
21becb3
chore: remove println
viveksharmapoudel Oct 30, 2023
ae12a8b
wip: fix made changes
viveksharmapoudel Dec 11, 2023
f5bed17
wip: proof shouldnt be empty
viveksharmapoudel Dec 11, 2023
60827eb
wip: change new height with revision name
viveksharmapoudel Dec 11, 2023
4e4b235
chore: remove old changes and handle some more for revision number
viveksharmapoudel Jan 10, 2024
be9894a
chore: handle revision number properly
viveksharmapoudel Jan 17, 2024
56d6a91
chore: wasm refractor revision Number
viveksharmapoudel Jan 17, 2024
d1cf219
chore: fix wasm
viveksharmapoudel Jan 17, 2024
ae01a5d
Merge branch 'main' of github.com:icon-project/ibc-relay into feat/in…
viveksharmapoudel Jan 23, 2024
79ca147
fix: after merge
viveksharmapoudel Jan 23, 2024
7762af9
fix: cleanup to handle both contract and ICS
viveksharmapoudel Jan 26, 2024
8561523
chore: remove fmt logs and comment test cmds
viveksharmapoudel Jan 28, 2024
0876502
chore: msgConnection icon client check remove
viveksharmapoudel Jan 31, 2024
e8f9f37
chore: remove println
viveksharmapoudel Oct 30, 2023
91ca51d
fix: resolve conflicts
sherpalden Feb 12, 2024
90eaff8
fix: resolve merge conflicts
sherpalden Feb 12, 2024
ce6d3e9
chore: remove redundant import for tm client
sherpalden Feb 12, 2024
60f0880
chore: log messages properly while sending to mempool in cosmos
sherpalden Feb 12, 2024
0212896
chore: log messages properly while sending to icon
sherpalden Feb 12, 2024
f2704f9
chore: ensure non empty proof in cosmos
sherpalden Feb 12, 2024
f5cb239
chore: update comments and variable names
sherpalden Feb 12, 2024
4d15911
chore: remove unnecessary comments
sherpalden Feb 12, 2024
a73500f
fix: relay start not working when more than two chains are in the con…
sherpalden Feb 13, 2024
8b96fec
feat: add method to check for invalid path
sherpalden Feb 13, 2024
26691fe
chore: add pathname while logging invaid path
sherpalden Feb 14, 2024
bf34eea
fix: recover from panic while waiting for tx result in cosmos chain
sherpalden Feb 23, 2024
6bdecff
chore: add event detection log in cosmos provider & invalidate packet…
sherpalden Feb 25, 2024
3ea6855
fix: improper error handling while broadcasting tx in cosmos
sherpalden Mar 20, 2024
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 .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

[submodule ".github/scripts/IBC-Integration"]
path = .github/scripts/IBC-Integration
url = https://github.com/icon-project/IBC-Integration.git
url = https://github.com/icon-project/ibc-integration.git
[submodule ".github/scripts/archway"]
path = .github/scripts/archway
url = https://github.com/archway-network/archway.git
Expand Down
4 changes: 4 additions & 0 deletions cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const (
flagSrcConnID = "src-connection-id"
flagDstConnID = "dst-connection-id"
flagBtpBlockHeight = "btp-block-height"
flagSrcWasmCodeID = "src-wasm-code-id"
flagDstWasmCodeID = "dst-wasm-code-id"
)

const (
Expand Down Expand Up @@ -286,6 +288,8 @@ func clientParameterFlags(v *viper.Viper, cmd *cobra.Command) *cobra.Command {
cmd.Flags().BoolP(flagUpdateAfterMisbehaviour, "m", true,
"allow governance to update the client if misbehaviour freezing occurs")
cmd.Flags().Duration(flagClientTrustingPeriod, 0, "custom light client trusting period ex. 24h (default: 85% of chains reported unbonding time)")
cmd.Flags().String(flagSrcWasmCodeID, "", "src chain's wasm code id for clients (default: empty / not used)")
cmd.Flags().String(flagDstWasmCodeID, "", "dst chain's wasm code id for clients (default: empty / not used)")
if err := v.BindPFlag(flagUpdateAfterExpiry, cmd.Flags().Lookup(flagUpdateAfterExpiry)); err != nil {
panic(err)
}
Expand Down
1 change: 0 additions & 1 deletion cmd/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ $ %s pth fch`, appName, defaultHome, appName)),
client, _, err := client.Repositories.DownloadContents(cmd.Context(), "cosmos", "chain-registry", regPath, nil)
if err != nil {
if errors.As(err, new(*github.RateLimitError)) {
fmt.Println("some paths failed: ", err)
break
}
fmt.Fprintf(cmd.ErrOrStderr(), "failure retrieving: %s: consider adding to cosmos/chain-registry: ERR: %v\n", pthName, err)
Expand Down
60 changes: 35 additions & 25 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,42 +45,52 @@ $ %s start demo-path --max-msgs 3
$ %s start demo-path2 --max-tx-size 10`, appName, appName, appName, appName)),
RunE: func(cmd *cobra.Command, args []string) error {
chains := make(map[string]*relayer.Chain)
paths := make([]relayer.NamedPath, len(args))

var paths []relayer.NamedPath

if len(args) > 0 {
for i, pathName := range args {
for _, pathName := range args {
path := a.config.Paths.MustGet(pathName)
paths[i] = relayer.NamedPath{
Name: pathName,
Path: path,
if err := path.IsInvalid(); err != nil {
a.log.Warn(fmt.Sprintf("Skipping invalid path: [%s] : %s", pathName, err.Error()))
} else {
paths = append(paths, relayer.NamedPath{
Name: pathName,
Path: path,
})
}

// collect unique chain IDs
chains[path.Src.ChainID] = nil
chains[path.Dst.ChainID] = nil
}
} else {
for n, path := range a.config.Paths {
paths = append(paths, relayer.NamedPath{
Name: n,
Path: path,
})

// collect unique chain IDs
chains[path.Src.ChainID] = nil
chains[path.Dst.ChainID] = nil
if err := path.IsInvalid(); err != nil {
a.log.Warn(fmt.Sprintf("Skipping invalid path: [%s] : %s", n, err.Error()))
} else {
paths = append(paths, relayer.NamedPath{
Name: n,
Path: path,
})
}
}
}

chainIDs := make([]string, 0, len(chains))
for chainID := range chains {
chainIDs = append(chainIDs, chainID)
}
for _, p := range paths {
srcChainID := p.Path.Src.ChainID
if _, ok := chains[srcChainID]; !ok {
chain, err := a.config.Chains.Get(srcChainID)
if err != nil {
return err
}
chains[srcChainID] = chain
}

// get chain configurations
chains, err := a.config.Chains.Gets(chainIDs...)
if err != nil {
return err
dstChainID := p.Path.Dst.ChainID
if _, ok := chains[dstChainID]; !ok {
chain, err := a.config.Chains.Get(dstChainID)
if err != nil {
return err
}
chains[dstChainID] = chain
}
}

if err := ensureKeysExist(chains); err != nil {
Expand Down
43 changes: 39 additions & 4 deletions cmd/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ func createClientsCmd(a *appState) *cobra.Command {
return err
}

srcWasmCodeID, err := cmd.Flags().GetString(flagSrcWasmCodeID)
if err != nil {
return err
}

dstWasmCodeID, err := cmd.Flags().GetString(flagDstWasmCodeID)
if err != nil {
return err
}

path := args[0]

c, src, dst, err := a.config.ChainsFromPath(path)
Expand All @@ -111,7 +121,7 @@ func createClientsCmd(a *appState) *cobra.Command {

// TODO: make iconStartHeight compulsory
// if iconStartHeight is not given it can create confusion as starting relay at any time could miss number of btp block update_client
clientSrc, clientDst, err := c[src].CreateClients(cmd.Context(), c[dst], allowUpdateAfterExpiry, allowUpdateAfterMisbehaviour, override, customClientTrustingPeriod, a.config.memo(cmd), iconStartHeight)
clientSrc, clientDst, err := c[src].CreateClients(cmd.Context(), c[dst], allowUpdateAfterExpiry, allowUpdateAfterMisbehaviour, override, customClientTrustingPeriod, a.config.memo(cmd), iconStartHeight, srcWasmCodeID, dstWasmCodeID)
if err != nil {
return err
}
Expand Down Expand Up @@ -166,6 +176,11 @@ func createClientCmd(a *appState) *cobra.Command {
return err
}

srcWasmCodeID, err := cmd.Flags().GetString(flagSrcWasmCodeID)
if err != nil {
return err
}

src, ok := a.config.Chains[args[0]]
if !ok {
return errChainNotFound(args[0])
Expand Down Expand Up @@ -242,7 +257,7 @@ func createClientCmd(a *appState) *cobra.Command {
return err
}

clientID, err := relayer.CreateClient(cmd.Context(), src, dst, srcUpdateHeader, dstUpdateHeader, allowUpdateAfterExpiry, allowUpdateAfterMisbehaviour, override, customClientTrustingPeriod, a.config.memo(cmd), iconStartHeight)
clientID, err := relayer.CreateClient(cmd.Context(), src, dst, srcUpdateHeader, dstUpdateHeader, allowUpdateAfterExpiry, allowUpdateAfterMisbehaviour, override, customClientTrustingPeriod, a.config.memo(cmd), iconStartHeight, srcWasmCodeID)
if err != nil {
return err
}
Expand Down Expand Up @@ -441,6 +456,16 @@ $ %s tx conn demo-path --timeout 5s`,
return err
}

srcWasmCodeID, err := cmd.Flags().GetString(flagSrcWasmCodeID)
if err != nil {
return err
}

dstWasmCodeID, err := cmd.Flags().GetString(flagDstWasmCodeID)
if err != nil {
return err
}

// ensure that keys exist
if exists := c[src].ChainProvider.KeyExists(c[src].ChainProvider.Key()); !exists {
return fmt.Errorf("key %s not found on src chain %s", c[src].ChainProvider.Key(), c[src].ChainID())
Expand All @@ -462,7 +487,7 @@ $ %s tx conn demo-path --timeout 5s`,
}

// ensure that the clients exist
clientSrc, clientDst, err := c[src].CreateClients(cmd.Context(), c[dst], allowUpdateAfterExpiry, allowUpdateAfterMisbehaviour, override, customClientTrustingPeriod, memo, iconStartHeight)
clientSrc, clientDst, err := c[src].CreateClients(cmd.Context(), c[dst], allowUpdateAfterExpiry, allowUpdateAfterMisbehaviour, override, customClientTrustingPeriod, memo, iconStartHeight, srcWasmCodeID, dstWasmCodeID)
if err != nil {
return err
}
Expand Down Expand Up @@ -726,6 +751,16 @@ $ %s tx connect demo-path --src-port mock --dst-port mock --order unordered --ve
return err
}

srcWasmCodeID, err := cmd.Flags().GetString(flagSrcWasmCodeID)
if err != nil {
return err
}

dstWasmCodeID, err := cmd.Flags().GetString(flagDstWasmCodeID)
if err != nil {
return err
}

// ensure that keys exist
if exists := c[src].ChainProvider.KeyExists(c[src].ChainProvider.Key()); !exists {
return fmt.Errorf("key %s not found on src chain %s", c[src].ChainProvider.Key(), c[src].ChainID())
Expand All @@ -747,7 +782,7 @@ $ %s tx connect demo-path --src-port mock --dst-port mock --order unordered --ve
}

// create clients if they aren't already created
clientSrc, clientDst, err := c[src].CreateClients(cmd.Context(), c[dst], allowUpdateAfterExpiry, allowUpdateAfterMisbehaviour, override, customClientTrustingPeriod, memo, iconStartHeight)
clientSrc, clientDst, err := c[src].CreateClients(cmd.Context(), c[dst], allowUpdateAfterExpiry, allowUpdateAfterMisbehaviour, override, customClientTrustingPeriod, memo, iconStartHeight, srcWasmCodeID, dstWasmCodeID)
if err != nil {
return fmt.Errorf("error creating clients: %w", err)
}
Expand Down
Loading