Skip to content

Commit

Permalink
Feat/hyperspace (#382)
Browse files Browse the repository at this point in the history
* chore: update to 0.47

* bump go

* updates

* updates

* feedback

* Fix BroadcastSync for cosmos broadcaster (#360)

* Fix BroadcastSync for cosmos broadcaster

* Fixing docstring

* public grpc, register tmlightclient codecs as no longer by default, attempt base64 decode on key if string value doesn't match for backwards compatibility

Add test for IBC with chains pre/post SDK 47 upgrade

* Bump ibc-go to latest commit

* deps: upgrade to ibc-go/v7 and bump ibctest go mod (#372)

* bumping ibc-go to v7 branch

* bumping ibctest go mod to v7

* Initial commit for hyperspace relayer

* Add support for creating the core config and modifying chain configs.

* Move hyperspace to its own package

* Populate hyperspace's cosmos config with key information, i.e. KeyEntry

* Add wasm code id and wasm client type to cosmos chain config

* chore: align User interface with CosmosWallet and fix issue with broadcast mode sync (#388)

* Hyperspace create-client is populating client-ids in chain configs.
Reverted to using preset keys for both parachain and cosmos. Added
08-wasm types for codec registry.

* Add CreateConnections, GetClients, and ParseGetClientsOuput.
CreateConnection only commits MsgConnectionOpenInit.
Removes wasm_client_type and counterparty_wasm_code_id from chain
configs.
Increases max rpc body size for a larger contract.
Subs out FindTxs for polkadot chains to not impact cosmos chains block
db functions.

* Temporarily force simd for chain A and rococo-local for chain B

* Create connection working in hyperspace/interchaintest

* Add create channel and get connections. Create channels works.

* Reduce session length to 20 blocks again. Debugging starting the
relayer. And using ibc-go-simd from heighliner.

* Start hyperspace relayer

* IBC transfers working in both directions

* Poll for cosmos chain balance to reduce test time

* Use interchaintest generated relayer wallet in hyperspace's cosmos chain
config.

* add query channels (#397)

* add query channels

* code cleanup from PR commments

* fix channel and portID fork polkadot mint

* Add test for requiring governance on PushNewWasmCode msg

* Fix denom trace param

* Add submitting a proposal for a new wasm contract. Clean up the test
case.

* Bump to ibc-go v7, cosmos-sdk v0.47, polkadot v0.9.36, update parachains
mint funds & send ibc tx msgs

* Refactor hyperspace into more manageable files

* Add GeneratePath() to hyperspace relayer and move hyperspace-specific
relayer functions out of DockerRelayer

* Add LinkPath to hyperspace relayer interface

* Override cosmos chain block time in test

* Scale polkadot/parachain additional wallets by a factor of 1mil relative
to default

* Update test framework with latest changes from ibc-go, hyperspace,
grandpa contract, and parachain.

* Update to gzip the wasm contract and reduce gas wanted now that gas
consumption is better.

* Update codecs, update hyperspace/parachain commits to use, and remove
enabling ib send/receive on parachain. The parachain now defaults to
being enabled for send/receives.

* Merge branch 'main' into feat/hyperspace (#492)

* Param proposals, balance inquiries, and IBC transfer error handling (#393)

* Extract file writing/copying logic to helpers

* Add ParamChangeProposal

* Update file naming for param change proposal

* Use Code to detect errors in IBC transfers

* Add AllBalances and ParamChangeProposal

* Add support for the Hermes relayer (#396)

* adding some scaffolding for hermes relayer

* chore: updating interface to accept create connection options type

* chore: wip

* wip: adding path map to hermes relayer type

* writing mnemonic file

* correctly reading toml config

* ibc test passing with hermes relayer

* learn ibc test passing with hermes relayer

* adding parse client and connection output

* adding hermes test cases

* remove unused types

* undid import change

* reverted import change

* reverted some unintentional changes

* fix linting error

* adding hermes to conformance matrix

* adding default value for matrix file for CI

* pass absolute value for matrix file

* removed extra part of path

* adding hermes to Labels function

* add capabilities for hermes

* temporarily strip down number of tests to verify hermes relayer

* fixing conformance tests

* fixing channel tests in TestRelayerSetup

* revert to go rly to test

* bump hermes version

* extract json response correctly

* extract json result from stdout

* correct channel parsing json stdout

* set field ClearOnStart to true

* switch back to go relayer as default

* add hermes to the default relayers list

* update penumbra chain spin-up (#409)

* Create .github/dependabot.yml

Start dependabot.

* Bump github.com/BurntSushi/toml from 1.2.0 to 1.2.1 (#432)

Bumps [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/BurntSushi/toml/releases)
- [Commits](BurntSushi/toml@v1.2.0...v1.2.1)

---
updated-dependencies:
- dependency-name: github.com/BurntSushi/toml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump modernc.org/sqlite from 1.17.3 to 1.21.0 (#433)

---
updated-dependencies:
- dependency-name: modernc.org/sqlite
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump leonsteinhaeuser/project-beta-automations from 2.0.1 to 2.1.0 (#428)

Bumps [leonsteinhaeuser/project-beta-automations](https://github.com/leonsteinhaeuser/project-beta-automations) from 2.0.1 to 2.1.0.
- [Release notes](https://github.com/leonsteinhaeuser/project-beta-automations/releases)
- [Commits](leonsteinhaeuser/project-beta-automations@v2.0.1...v2.1.0)

---
updated-dependencies:
- dependency-name: leonsteinhaeuser/project-beta-automations
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dan Kanefsky <56059752+boojamya@users.noreply.github.com>

* Bump golangci/golangci-lint-action from 2 to 3 (#429)

Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 2 to 3.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](golangci/golangci-lint-action@v2...v3)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dan Kanefsky <56059752+boojamya@users.noreply.github.com>

* Bump actions/checkout from 1 to 3 (#430)

Bumps [actions/checkout](https://github.com/actions/checkout) from 1 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v1...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dan Kanefsky <56059752+boojamya@users.noreply.github.com>

* Bump github.com/gdamore/tcell/v2 (#434)

Bumps [github.com/gdamore/tcell/v2](https://github.com/gdamore/tcell) from 2.4.1-0.20210905002822-f057f0a857a1 to 2.6.0.
- [Release notes](https://github.com/gdamore/tcell/releases)
- [Commits](https://github.com/gdamore/tcell/commits/v2.6.0)

---
updated-dependencies:
- dependency-name: github.com/gdamore/tcell/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dan Kanefsky <56059752+boojamya@users.noreply.github.com>

* Bump github.com/avast/retry-go/v4 from 4.0.4 to 4.3.3 (#437)

Bumps [github.com/avast/retry-go/v4](https://github.com/avast/retry-go) from 4.0.4 to 4.3.3.
- [Release notes](https://github.com/avast/retry-go/releases)
- [Commits](avast/retry-go@4.0.4...4.3.3)

---
updated-dependencies:
- dependency-name: github.com/avast/retry-go/v4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 (#436)

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](stretchr/testify@v1.8.1...v1.8.2)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Gouin <andrew@gouin.io>

* Bump go.uber.org/zap from 1.21.0 to 1.24.0 (#439)

Bumps [go.uber.org/zap](https://github.com/uber-go/zap) from 1.21.0 to 1.24.0.
- [Release notes](https://github.com/uber-go/zap/releases)
- [Changelog](https://github.com/uber-go/zap/blob/master/CHANGELOG.md)
- [Commits](uber-go/zap@v1.21.0...v1.24.0)

---
updated-dependencies:
- dependency-name: go.uber.org/zap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dan Kanefsky <56059752+boojamya@users.noreply.github.com>

* Cosmos SDK v0.47 (#359)

* chore: update to 0.47

* bump go

* updates

* updates

* feedback

* Fix BroadcastSync for cosmos broadcaster (#360)

* Fix BroadcastSync for cosmos broadcaster

* Fixing docstring

* public grpc, register tmlightclient codecs as no longer by default, attempt base64 decode on key if string value doesn't match for backwards compatibility

Add test for IBC with chains pre/post SDK 47 upgrade

* Bump ibc-go to latest commit

* deps: upgrade to ibc-go/v7 and bump ibctest go mod (#372)

* bumping ibc-go to v7 branch

* bumping ibctest go mod to v7

* chore: align User interface with CosmosWallet and fix issue with broadcast mode sync (#388)

* chore: v0.47 branch merge and bumps (#406)

* Param proposals, balance inquiries, and IBC transfer error handling (#393)

* Extract file writing/copying logic to helpers

* Add ParamChangeProposal

* Update file naming for param change proposal

* Use Code to detect errors in IBC transfers

* Add AllBalances and ParamChangeProposal

* Add support for the Hermes relayer (#396)

* adding some scaffolding for hermes relayer

* chore: updating interface to accept create connection options type

* chore: wip

* wip: adding path map to hermes relayer type

* writing mnemonic file

* correctly reading toml config

* ibc test passing with hermes relayer

* learn ibc test passing with hermes relayer

* adding parse client and connection output

* adding hermes test cases

* remove unused types

* undid import change

* reverted import change

* reverted some unintentional changes

* fix linting error

* adding hermes to conformance matrix

* adding default value for matrix file for CI

* pass absolute value for matrix file

* removed extra part of path

* adding hermes to Labels function

* add capabilities for hermes

* temporarily strip down number of tests to verify hermes relayer

* fixing conformance tests

* fixing channel tests in TestRelayerSetup

* revert to go rly to test

* bump hermes version

* extract json response correctly

* extract json result from stdout

* correct channel parsing json stdout

* set field ClearOnStart to true

* switch back to go relayer as default

* add hermes to the default relayers list

* Update version of ibc-go from v6 to v7 from merge

* Bump sdk and ibc-go

---------

Co-authored-by: bigs <bigswim@gmail.com>
Co-authored-by: Cian Hatton <cianhatton@gmail.com>

* deps: bump SDK to v0.47-rc3 (#414)

Co-authored-by: Carlos Rodriguez <crodveg@gmail.com>

* Consolidate flush command into single command (#417)

* Consolidate flush command into single command

* Updates for hermes

* Bump to rly default with consolidated flush

* Flush with channelID since hermes requires it

* feat: add ReadFile method for reading files from docker fs (#423)

Expose a ReadFile method on ChainNode so that you can read files from the docker filesystem within test cases that exist in downstream repos.

---------

Co-authored-by: Justin Tieri <37750742+jtieri@users.noreply.github.com>

* Add support for genesis sub commands (#384)

* Add support for genesis sub commands

* Remove logging and add some basic documentation for UsingNewGenesisCommand

* Remove UsingNewGenesisCommand from chainspec + add test

---------

Co-authored-by: Julien Robert <julien@rbrt.fr>
Co-authored-by: Cian Hatton <cianhatton@gmail.com>
Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: Gjermund Garaba <gjermund@garaba.net>
Co-authored-by: bigs <bigswim@gmail.com>
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: Carlos Rodriguez <crodveg@gmail.com>
Co-authored-by: Justin Tieri <37750742+jtieri@users.noreply.github.com>

* Add image repo to upgradeVersion (#445)

* add image reop to upgradeVersion

* container repo

* juno container repo

* fix order

* capitalization

* generate explicit port bindings (#444)

* generate explicit port bindings

* Prevent race to open ports between closing tmp listeners and starting containers

* Bump github.com/cosmos/ibc-go/v7 from 7.0.0-rc1 to 7.0.0 (#451)

Bumps [github.com/cosmos/ibc-go/v7](https://github.com/cosmos/ibc-go) from 7.0.0-rc1 to 7.0.0.
- [Release notes](https://github.com/cosmos/ibc-go/releases)
- [Changelog](https://github.com/cosmos/ibc-go/blob/main/CHANGELOG.md)
- [Commits](cosmos/ibc-go@v7.0.0-rc1...v7.0.0)

---
updated-dependencies:
- dependency-name: github.com/cosmos/ibc-go/v7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Gouin <andrew@gouin.io>

* Bump golang.org/x/tools from 0.6.0 to 0.7.0 (#449)

Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](golang/tools@v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Gouin <andrew@gouin.io>

* fix: remove race condition on start container retries (#415)

* fix: increase retry to 15 seconds to avoid retrying a command exec

* chore: increase log tail, simplify start container logic

* chore: cleanup, revert change, add in-code comment

* chore: remove reference to retry

* Bump github.com/libp2p/go-libp2p-core from 0.15.1 to 0.20.1 (#440)

Bumps [github.com/libp2p/go-libp2p-core](https://github.com/libp2p/go-libp2p-core) from 0.15.1 to 0.20.1.
- [Release notes](https://github.com/libp2p/go-libp2p-core/releases)
- [Commits](libp2p/go-libp2p-core@v0.15.1...v0.20.1)

---
updated-dependencies:
- dependency-name: github.com/libp2p/go-libp2p-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Gouin <andrew@gouin.io>

* consolidate create node container (#447)

* generate explicit port bindings

* Prevent race to open ports between closing tmp listeners and starting containers

* Consolidate create node container

* Use RWMutex

* initialize containerLifecycle for penumbra node

* Bump rly to v2.3.0-rc2

* Temporarily modify version

* Bump github.com/centrifuge/go-substrate-rpc-client/v4 (#438)

Bumps [github.com/centrifuge/go-substrate-rpc-client/v4](https://github.com/centrifuge/go-substrate-rpc-client) from 4.0.10 to 4.0.12.
- [Release notes](https://github.com/centrifuge/go-substrate-rpc-client/releases)
- [Commits](centrifuge/go-substrate-rpc-client@v4.0.10...v4.0.12)

---
updated-dependencies:
- dependency-name: github.com/centrifuge/go-substrate-rpc-client/v4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Gouin <andrew@gouin.io>

* Bump actions/setup-go from 3 to 4 (#472)

Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3 to 4.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](actions/setup-go@v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Migrate docker relayer to ContainerLifecycle (#466)

* Bump default rly version to v2.3.0-rc4

* update docker relayer to use ContainerLifecycle

* Add nil check

* Make ICA waits more explicit (#471)

* Make ICA waits more explicit

* Poll for channel close

* Bump modernc.org/sqlite from 1.21.0 to 1.21.1 (#473)

Bumps [modernc.org/sqlite](https://gitlab.com/cznic/sqlite) from 1.21.0 to 1.21.1.
- [Release notes](https://gitlab.com/cznic/sqlite/tags)
- [Commits](https://gitlab.com/cznic/sqlite/compare/v1.21.0...v1.21.1)

---
updated-dependencies:
- dependency-name: modernc.org/sqlite
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Gouin <andrew@gouin.io>

* Bump google.golang.org/grpc from 1.53.0 to 1.54.0 (#463)

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.53.0 to 1.54.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.53.0...v1.54.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Gouin <andrew@gouin.io>

* Bump github.com/cosmos/cosmos-sdk from 0.47.0 to 0.47.1 (#462)

Bumps [github.com/cosmos/cosmos-sdk](https://github.com/cosmos/cosmos-sdk) from 0.47.0 to 0.47.1.
- [Release notes](https://github.com/cosmos/cosmos-sdk/releases)
- [Changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.47.1/CHANGELOG.md)
- [Commits](cosmos/cosmos-sdk@v0.47.0...v0.47.1)

---
updated-dependencies:
- dependency-name: github.com/cosmos/cosmos-sdk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Gouin <andrew@gouin.io>

* Bump github.com/99designs/keyring from 1.2.1 to 1.2.2 (#450)

Bumps [github.com/99designs/keyring](https://github.com/99designs/keyring) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/99designs/keyring/releases)
- [Commits](99designs/keyring@v1.2.1...v1.2.2)

---
updated-dependencies:
- dependency-name: github.com/99designs/keyring
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Gouin <andrew@gouin.io>
Co-authored-by: Dan Kanefsky <56059752+boojamya@users.noreply.github.com>

* Update `ExportState`  (#475)

* update exportstate

* add space

* concatenate stdout and stderr

* use ChainConfig in RestoreKey relayer

* fix mini bug

* fix lint

* use cmd create node same main

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: bigs <bigswim@gmail.com>
Co-authored-by: Cian Hatton <cianhatton@gmail.com>
Co-authored-by: Dan Kanefsky <56059752+boojamya@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Gouin <andrew@gouin.io>
Co-authored-by: Julien Robert <julien@rbrt.fr>
Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: Gjermund Garaba <gjermund@garaba.net>
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: Carlos Rodriguez <crodveg@gmail.com>
Co-authored-by: Justin Tieri <37750742+jtieri@users.noreply.github.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Nguyen Thanh Nhan <thanhnhan98qh@gmail.com>

* Change the UidGid of polkadot node to match what is built into the
container.

* Fix polkadot keys unit tests

* Fix go.sum after merge from main

* style: go fmt

* Update parachain's query ibc balance to match it new api, re-enable
verifications of denom balances of our user accounts.

* Update cli for wasm light client and update the grandpa contract to
support the latest wasm light client interface to contracts.

* refactor how hyperspace commander parses get client and get connection
output. Fix get channels after the hyperspace cli was removed.

* Remove some prints and fix typo

* style: go fmt

* fix lint errors

* update go.mod

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
Co-authored-by: Cian Hatton <cianhatton@gmail.com>
Co-authored-by: Andrew Gouin <andrew@gouin.io>
Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: Eduardo Díaz <edjroz@users.noreply.github.com>
Co-authored-by: ducnt131 <62016666+anhductn2001@users.noreply.github.com>
Co-authored-by: bigs <bigswim@gmail.com>
Co-authored-by: Dan Kanefsky <56059752+boojamya@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Gjermund Garaba <gjermund@garaba.net>
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: Carlos Rodriguez <crodveg@gmail.com>
Co-authored-by: Justin Tieri <37750742+jtieri@users.noreply.github.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Nguyen Thanh Nhan <thanhnhan98qh@gmail.com>
  • Loading branch information
16 people committed Apr 18, 2023
1 parent 9b8f7ae commit 978593a
Show file tree
Hide file tree
Showing 38 changed files with 3,574 additions and 78 deletions.
123 changes: 123 additions & 0 deletions chain/cosmos/08-wasm-types/client_state.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package types

import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
"github.com/cosmos/ibc-go/v7/modules/core/exported"
)

var _ exported.ClientState = (*ClientState)(nil)

func (c ClientState) ClientType() string {
return ""
}

func (c ClientState) GetLatestHeight() exported.Height {
return c.LatestHeight
}

func (c ClientState) Validate() error {
return nil
}

func (c ClientState) Status(ctx sdk.Context, store sdk.KVStore, cdc codec.BinaryCodec) exported.Status {
return exported.Active
}

func (c ClientState) ExportMetadata(store sdk.KVStore) []exported.GenesisMetadata {
return []exported.GenesisMetadata{}
}

func (c ClientState) ZeroCustomFields() exported.ClientState {
return &c
}

func (c ClientState) GetTimestampAtHeight(
ctx sdk.Context,
clientStore sdk.KVStore,
cdc codec.BinaryCodec,
height exported.Height,
) (uint64, error) {
return 0, nil
}

func (c ClientState) Initialize(context sdk.Context, marshaler codec.BinaryCodec, store sdk.KVStore, state exported.ConsensusState) error {
return nil
}

func (c ClientState) VerifyMembership(
ctx sdk.Context,
clientStore sdk.KVStore,
cdc codec.BinaryCodec,
height exported.Height,
delayTimePeriod uint64,
delayBlockPeriod uint64,
proof []byte,
path exported.Path,
value []byte,
) error {
return nil
}

func (c ClientState) VerifyNonMembership(
ctx sdk.Context,
clientStore sdk.KVStore,
cdc codec.BinaryCodec,
height exported.Height,
delayTimePeriod uint64,
delayBlockPeriod uint64,
proof []byte,
path exported.Path,
) error {
return nil
}

// VerifyClientMessage must verify a ClientMessage. A ClientMessage could be a Header, Misbehaviour, or batch update.
// It must handle each type of ClientMessage appropriately. Calls to CheckForMisbehaviour, UpdateState, and UpdateStateOnMisbehaviour
// will assume that the content of the ClientMessage has been verified and can be trusted. An error should be returned
// if the ClientMessage fails to verify.
func (c ClientState) VerifyClientMessage(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, clientMsg exported.ClientMessage) error {
return nil
}

func (c ClientState) CheckForMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, msg exported.ClientMessage) bool {
return true
}

// UpdateStateOnMisbehaviour should perform appropriate state changes on a client state given that misbehaviour has been detected and verified
func (c ClientState) UpdateStateOnMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, clientMsg exported.ClientMessage) {

}

func (c ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, clientMsg exported.ClientMessage) []exported.Height {
return []exported.Height{c.LatestHeight}
}

func (c ClientState) CheckSubstituteAndUpdateState(
ctx sdk.Context, cdc codec.BinaryCodec, subjectClientStore,
substituteClientStore sdk.KVStore, substituteClient exported.ClientState,
) error {
return nil
}

func (c ClientState) VerifyUpgradeAndUpdateState(
ctx sdk.Context,
cdc codec.BinaryCodec,
store sdk.KVStore,
newClient exported.ClientState,
newConsState exported.ConsensusState,
proofUpgradeClient,
proofUpgradeConsState []byte,
) error {
return nil
}

// NewClientState creates a new ClientState instance.
func NewClientState(latestSequence uint64, consensusState *ConsensusState) *ClientState {
return &ClientState{
Data: []byte{0},
CodeId: []byte{},
LatestHeight: clienttypes.Height{},
}
}
32 changes: 32 additions & 0 deletions chain/cosmos/08-wasm-types/codec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package types

import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/ibc-go/v7/modules/core/exported"
)

// RegisterInterfaces registers the tendermint concrete client-related
// implementations and interfaces.
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
registry.RegisterImplementations(
(*exported.ClientState)(nil),
&ClientState{},
)
registry.RegisterImplementations(
(*exported.ConsensusState)(nil),
&ConsensusState{},
)
registry.RegisterImplementations(
(*sdk.Msg)(nil),
&MsgStoreCode{},
)
registry.RegisterImplementations(
(*exported.ClientMessage)(nil),
&Misbehaviour{},
)
registry.RegisterImplementations(
(*exported.ClientMessage)(nil),
&Header{},
)
}
19 changes: 19 additions & 0 deletions chain/cosmos/08-wasm-types/consensus_state.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package types

import (
"github.com/cosmos/ibc-go/v7/modules/core/exported"
)

var _ exported.ConsensusState = (*ConsensusState)(nil)

func (m ConsensusState) ClientType() string {
return ""
}

func (m ConsensusState) GetTimestamp() uint64 {
return m.Timestamp
}

func (m ConsensusState) ValidateBasic() error {
return nil
}
15 changes: 15 additions & 0 deletions chain/cosmos/08-wasm-types/header.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package types

import (
"github.com/cosmos/ibc-go/v7/modules/core/exported"
)

var _ exported.ClientMessage = &Header{}

func (m Header) ClientType() string {
return ""
}

func (m Header) ValidateBasic() error {
return nil
}
17 changes: 17 additions & 0 deletions chain/cosmos/08-wasm-types/misbehavior.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package types

import (
exported "github.com/cosmos/ibc-go/v7/modules/core/exported"
)

var (
_ exported.ClientMessage = &Misbehaviour{}
)

func (m Misbehaviour) ClientType() string {
return ""
}

func (m Misbehaviour) ValidateBasic() error {
return nil
}
57 changes: 57 additions & 0 deletions chain/cosmos/08-wasm-types/module.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package types

import (
"encoding/json"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/types/module"
//grpc "github.com/cosmos/gogoproto/grpc"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
)

var _ module.AppModuleBasic = AppModuleBasic{}

// AppModuleBasic defines the basic application module used by the tendermint light client.
// Only the RegisterInterfaces function needs to be implemented. All other function perform
// a no-op.
type AppModuleBasic struct{}

// Name returns the tendermint module name.
func (AppModuleBasic) Name() string {
return "08-wasm"
}

// RegisterLegacyAminoCodec performs a no-op. The Wasm client does not support amino.
func (AppModuleBasic) RegisterLegacyAminoCodec(*codec.LegacyAmino) {}

// RegisterInterfaces registers module concrete types into protobuf Any. This allows core IBC
// to unmarshal wasm light client types.
func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) {
RegisterInterfaces(registry)
}

// DefaultGenesis performs a no-op. Genesis is not supported for the tendermint light client.
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return nil
}

// ValidateGenesis performs a no-op. Genesis is not supported for the tendermint light cilent.
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error {
return nil
}

// RegisterGRPCGatewayRoutes performs a no-op.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {}

// GetTxCmd performs a no-op. Please see the 02-client cli commands.
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return nil
}

// GetQueryCmd performs a no-op. Please see the 02-client cli commands.
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return nil
}
21 changes: 21 additions & 0 deletions chain/cosmos/08-wasm-types/msgs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package types

import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

var (
_ sdk.Msg = &MsgStoreCode{}
)

func (m MsgStoreCode) ValidateBasic() error {
return nil
}

func (m MsgStoreCode) GetSigners() []sdk.AccAddress {
signer, err := sdk.AccAddressFromBech32(m.Signer)
if err != nil {
panic(err)
}
return []sdk.AccAddress{signer}
}
Loading

0 comments on commit 978593a

Please sign in to comment.