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

feat: cw cluster connection #398

Merged
merged 26 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ebdbede
feat: add signature verification
sherpalden Oct 9, 2024
1e23d81
feat: add method to set relayers
sherpalden Oct 15, 2024
5ecbc6e
fix: update interfaces
sherpalden Oct 17, 2024
2c83a97
test: add unit tests
sherpalden Oct 21, 2024
cc5545b
test: test claim_fees
sherpalden Oct 22, 2024
4678082
fix: remove reply handling from xcall
sherpalden Oct 23, 2024
26e947b
fix: sign nid,sn,msg
sherpalden Oct 23, 2024
311570e
fix: recovery code issue
sherpalden Nov 7, 2024
727ec1f
fix: use rlp encoding for signable msg
sherpalden Nov 8, 2024
788df3e
fix: store validators as list of byte array
sherpalden Nov 8, 2024
7abd8f9
fix: recovery code parsing
sherpalden Nov 11, 2024
bdd5f01
fix: use uncompressed pubkey
sherpalden Nov 11, 2024
b12625a
fix: resolve merge conflict
sherpalden Nov 29, 2024
f47af0e
Merge branch 'main' into feature/cw_cluster_connection
sherpalden Nov 29, 2024
76e8f8a
ci: update deprecated github action version
DeepakBomjan Nov 29, 2024
30b30ec
fix: add dstnetwork in signature
sherpalden Dec 4, 2024
34dd284
fix: unit tests
sherpalden Dec 4, 2024
a5fa0dc
fix: resolve merge conflicts
sherpalden Dec 4, 2024
b8bceed
fix: remove dstNetwork in recv_message cluster connection
sherpalden Dec 6, 2024
69914b2
fix: add two signatures in recv_message cluster connection
sherpalden Dec 9, 2024
e0c8c69
fix: do not ignore err
sherpalden Dec 9, 2024
3cd2b68
fix: removed xcall lib from connection
gcranju Dec 10, 2024
db3f811
fix: signable message encoding to utf8 bytes
sherpalden Dec 10, 2024
e90a4e1
fix: signable msg encoding updated
sherpalden Dec 10, 2024
361dcaf
chore: unused function removed
gcranju Dec 11, 2024
2d9a77a
Merge branch 'main' into feature/cw_cluster_connection
ibrizsabin Dec 13, 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
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
4 changes: 2 additions & 2 deletions .github/workflows/build-and-publish-cosmwasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -25,7 +25,7 @@ jobs:
bash ./scripts/optimize-cosmwasm.sh

- name: Archive artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: cosmwasm-contracts
path: artifacts
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-and-publish-javascore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Build Javascore
working-directory: contracts/javascore
Expand All @@ -21,7 +21,7 @@ jobs:
./gradlew zipOutputOptimizedJars
- name: Archive artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: javascore-contracts
path: ./contracts/javascore/build/javascore-contracts.zip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codecov-javascore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
- name: Javascore contracts coverage
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cosmwasm-contracts-code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
CARGO_TERM_COLOR: always
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-cosmwasm-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/java-contracts-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build jar
working-directory: contracts/javascore
run: ./gradlew clean build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-tag-manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: '0'
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .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 All @@ -83,7 +83,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
- name: Install stable toolchain
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/solidity-cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
CARGO_TERM_COLOR: always
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stellar-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sui-move-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
REPO_OWNER: MystenLabs
REPO_NAME: sui
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/uat-deploy-java-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Retrieve the secret and decode it to a file
working-directory: contracts/javascore
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
Loading