Skip to content

Commit

Permalink
feat: cw cluster connection (#398)
Browse files Browse the repository at this point in the history
* feat: add signature verification

* feat: add method to set relayers

* fix: update interfaces

* test: add unit tests

* test: test claim_fees

* fix: remove reply handling from xcall

* fix: sign nid,sn,msg

* fix: recovery code issue

* fix: use rlp encoding for signable msg

* fix: store validators as list of byte array

* fix: recovery code parsing

* fix: use uncompressed pubkey

* ci: update deprecated github action version

* fix: add dstnetwork in signature

* fix: unit tests

* fix: remove dstNetwork in recv_message cluster connection

* fix: add two signatures in recv_message cluster connection

* fix: do not ignore err

* fix: removed xcall lib from connection

* fix: signable message encoding to utf8 bytes

* fix: signable msg encoding updated

* chore: unused function removed

---------

Co-authored-by: DeepakBomjan <[email protected]>
Co-authored-by: gcranju <[email protected]>
Co-authored-by: ibrizsabin <[email protected]>
  • Loading branch information
4 people authored Dec 13, 2024
1 parent 04ccaa5 commit 106a5f3
Show file tree
Hide file tree
Showing 16 changed files with 1,571 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/basic-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
Expand All @@ -42,7 +42,7 @@ jobs:
working-directory: contracts/cosmwasm-vm
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
- name: Install Foundry
Expand Down
35 changes: 24 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 18 additions & 18 deletions contracts/cosmwasm-vm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ This Repo contains the smart contracts for ICON-IBC in rust.

### Standard Libraries

| Crate | Usage | Download |
|----------------|--------------------|-------------------------|
|cosmwasm-schema |Contract Development| [![cosmwasm-schema on crates.io](https://img.shields.io/crates/v/cosmwasm-schema.svg)](https://crates.io/crates/cosmwasm-schema) |
|cosmwasm-std |Contract Development| [![cosmwasm-std on crates.io](https://img.shields.io/crates/v/cosmwasm-std.svg)](https://crates.io/crates/cosmwasm-std) |
|cosmwasm-storage|Contract Development| [![cosmwasm-storage on crates.io](https://img.shields.io/crates/v/cosmwasm-storage.svg)](https://crates.io/crates/cosmwasm-storage)

| Specification | Crates.io | Coverage |
|--------------- |-------------------------------|----------------------------|
| cw-ibc-core |[![ibc on crates.io](https://img.shields.io/crates/v/ibc.svg)](https://crates.io/crates/ibc)| [![codecov](https://codecov.io/gh/icon-project/IBC-Integration/branch/main/graph/badge.svg?token=8KX6y8aGom)](https://codecov.io/gh/icon-project/IBC-Integration)|
|cw-icon-light-client|[![ibc on crates.io](https://img.shields.io/crates/v/ibc.svg)](https://crates.io/crates/ibc)| [![codecov](https://codecov.io/gh/icon-project/IBC-Integration/branch/main/graph/badge.svg?token=8KX6y8aGom)](https://codecov.io/gh/icon-project/IBC-Integration)|
| cw-xcall |[![ibc on crates.io](https://img.shields.io/crates/v/ibc.svg)](https://crates.io/crates/ibc)| [![codecov](https://codecov.io/gh/icon-project/IBC-Integration/branch/main/graph/badge.svg?token=8KX6y8aGom)](https://codecov.io/gh/icon-project/IBC-Integration)|
| Crate | Usage | Download |
| ---------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| cosmwasm-schema | Contract Development | [![cosmwasm-schema on crates.io](https://img.shields.io/crates/v/cosmwasm-schema.svg)](https://crates.io/crates/cosmwasm-schema) |
| cosmwasm-std | Contract Development | [![cosmwasm-std on crates.io](https://img.shields.io/crates/v/cosmwasm-std.svg)](https://crates.io/crates/cosmwasm-std) |
| cosmwasm-storage | Contract Development | [![cosmwasm-storage on crates.io](https://img.shields.io/crates/v/cosmwasm-storage.svg)](https://crates.io/crates/cosmwasm-storage) |

| Specification | Crates.io | Coverage |
| -------------------- | -------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| cw-ibc-core | [![ibc on crates.io](https://img.shields.io/crates/v/ibc.svg)](https://crates.io/crates/ibc) | [![codecov](https://codecov.io/gh/icon-project/IBC-Integration/branch/main/graph/badge.svg?token=8KX6y8aGom)](https://codecov.io/gh/icon-project/IBC-Integration) |
| cw-icon-light-client | [![ibc on crates.io](https://img.shields.io/crates/v/ibc.svg)](https://crates.io/crates/ibc) | [![codecov](https://codecov.io/gh/icon-project/IBC-Integration/branch/main/graph/badge.svg?token=8KX6y8aGom)](https://codecov.io/gh/icon-project/IBC-Integration) |
| cw-xcall | [![ibc on crates.io](https://img.shields.io/crates/v/ibc.svg)](https://crates.io/crates/ibc) | [![codecov](https://codecov.io/gh/icon-project/IBC-Integration/branch/main/graph/badge.svg?token=8KX6y8aGom)](https://codecov.io/gh/icon-project/IBC-Integration) |

### Prerequiste

- To install Rust in Linux/Mac,

First, [install rustup](https://rustup.rs/). Once installed, make sure you have the wasm32 target:

```shell
rustup default stable
cargo version
Expand All @@ -38,27 +38,27 @@ Download and run, [rustup-init.exe](https://static.rust-lang.org/rustup/dist/i68
### Build Contracts

- Execute the following command to compile the contract

```
cargo wasm
```

- Optimise using cargo, by giving the following command

```
RUSTFLAGS='-C link-arg=-s' cargo wasm
```

- Deploy the contract on testnet

```
// add the wasm binary file path in <path>
RES=$(archwayd tx wasm store <path> --from wallet --chain-id constantine-2 --node https://rpc.constantine-2.archway.tech:443/ --fees 3397uconst --gas auto -y --output json -b block)
```

- Getting CodeId from RES

```
CODE_ID=$(echo $RES | jq -r '.logs[0].events[-1].attributes[1].value')
```
Expand Down Expand Up @@ -110,7 +110,7 @@ The xCall contract in Inter-Blockchain Communication (IBC) protocol facilitate c
IBC-Core is the reference implementation of the Inter-Blockchain Communication (IBC) protocol, which is a standardized protocol for enabling communication and interoperability between independent blockchain networks.

- [ics02_client](./cw-ibc-core/src/ics02_client/) :

ICS02-Client is a module in the IBC-Core that provides a standard interface and protocol for verifying the state of a remote chain in the Inter-Blockchain Communication (IBC) protocol.

- [ics03_connection](./cw-ibc-core/src/ics03_connection/) :
Expand Down Expand Up @@ -147,4 +147,4 @@ cargo test
### References

- [cosmwasm_book](https://book.cosmwasm.com/)
- [ibc-rs](https://github.com/cosmos/ibc-rs/tree/main/crates/ibc)
- [ibc-rs](https://github.com/cosmos/ibc-rs/tree/main/crates/ibc)
48 changes: 48 additions & 0 deletions contracts/cosmwasm-vm/cw-cluster-connection/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[package]
name = "cluster-connection"
version = "0.1.0"
edition = "2021"

exclude = [
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
"contract.wasm",
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
library = []

[package.metadata.scripts]
optimize = """docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.10
"""

[dependencies]
cosmwasm-schema = {workspace=true}
cosmwasm-std = { workspace=true}
cw-storage-plus = {workspace=true}
cw2 = {workspace=true}
schemars = {workspace=true}
serde = { workspace=true}
thiserror = { workspace=true}
common ={ workspace=true}
cw-xcall-lib = { path="../cw-xcall-lib" }
hex = "0.4.3"
serde-json-wasm = {workspace=true}
sha2 = { version = "0.10.6", default-features = false }
sha3 = { version = "0.10.6", default-features = false }
k256 = "0.13.3"

[dev-dependencies]
cosmwasm = "0.7.2"
getrandom = {version = "0.2", default-features = false, features = ["custom"]}

Loading

0 comments on commit 106a5f3

Please sign in to comment.