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(interchain-token-service): add its hub contract #572

Merged
merged 106 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
53bd42a
feat(axelarnet-gateway): add axelarnet gateway
milapsheth Jul 29, 2024
94c12bb
remove error
milapsheth Aug 6, 2024
2dfba4d
cleanup
milapsheth Aug 6, 2024
180bff3
simplify execute API
milapsheth Aug 6, 2024
3530aa6
add axelar executable client
milapsheth Aug 6, 2024
1f464b8
use structured message id
milapsheth Aug 6, 2024
8ba8592
fail if incoming already exists
milapsheth Aug 6, 2024
2ddbfe8
rename message -> msg in state
milapsheth Aug 6, 2024
995dd1f
address comments
milapsheth Aug 7, 2024
1999c52
switch to expect
milapsheth Aug 7, 2024
0a3979e
emit routing event on call contract
milapsheth Aug 7, 2024
0c95a22
feat(its): add its hub
milapsheth Aug 7, 2024
6a8b091
feat(its): add balance tracking
milapsheth Aug 7, 2024
98a61bb
use option type
milapsheth Aug 7, 2024
7473ec6
refactor(its)!: use explicit balance tracking
milapsheth Aug 7, 2024
3b05301
expose inner axelar executable msg struct publicly
milapsheth Aug 7, 2024
7d5f502
Merge branch 'feat/axelarnet-gateway' into feat/its-hub
milapsheth Aug 7, 2024
0b3a8e3
use block height as placeholder
milapsheth Aug 7, 2024
9b323db
address comments, split query into another PR
milapsheth Aug 7, 2024
d05b4a2
feat(axelarnet-gateway): add gmp example for axelarnet gateway
milapsheth Aug 7, 2024
556510b
Merge branch 'feat/axelarnet-gateway' into feat/its-hub-middleware
milapsheth Aug 7, 2024
3e346bf
cleanup
milapsheth Aug 7, 2024
8336d75
remove token balance logic
milapsheth Aug 7, 2024
ee0aa0a
remove examples
milapsheth Aug 7, 2024
49821d0
move ignore_empty into a util
milapsheth Aug 7, 2024
9205c14
lint
milapsheth Aug 7, 2024
894959b
remove examples
milapsheth Aug 7, 2024
00e450e
Merge branch 'main' into feat/axelarnet-gateway
milapsheth Aug 7, 2024
e98c432
address comments
milapsheth Aug 8, 2024
0a165f1
add tests
milapsheth Aug 8, 2024
8f357ef
Merge branch 'main' into feat/axelarnet-gateway
milapsheth Aug 8, 2024
d34e400
use workspace rust edition
milapsheth Aug 8, 2024
038f8ef
address remaining comment
milapsheth Aug 8, 2024
3284e4e
additional coverage
milapsheth Aug 8, 2024
06c225a
Merge branch 'feat/axelarnet-gateway' into feat/its-hub-middleware
milapsheth Aug 9, 2024
f2bad2e
Merge branch 'main' into feat/its-hub-middleware
milapsheth Aug 9, 2024
26491dc
address comments
milapsheth Aug 9, 2024
9ecc421
rename trusted address
milapsheth Aug 9, 2024
c848fb7
remove extra var
milapsheth Aug 9, 2024
22642d7
fix action
milapsheth Aug 9, 2024
fd05208
Merge branch 'main' into feat/its-hub-middleware
milapsheth Aug 9, 2024
32e36ca
feat(ampd): integrate ampd queued broadcaster with the axelar batch r…
fish-sammy Aug 10, 2024
179af0d
ci: cancel ongoing checks on push (#580)
milapsheth Aug 12, 2024
893c73b
chore: upgrade and unify k256 dependency (#581)
cgorenflo Aug 12, 2024
8c9706a
chore(gateway): remove v0.2.3 migration (#568)
cgorenflo Aug 12, 2024
16f06dc
refactor: move cosmwasm address validation into axelar-wasm-std (#567)
cgorenflo Aug 12, 2024
2d5ec03
feat: add only tx hash message id (#528)
raress96 Aug 15, 2024
9627885
fix(contracts): restrict crate visibility (#582)
milapsheth Aug 15, 2024
fee9fe7
feat(ampd): add support for multiversx blockchain (#466)
raress96 Aug 16, 2024
0dd8edc
feat: integrate address format with SuiAddress (#585)
fish-sammy Aug 16, 2024
da2dc7b
feat(minor-rewards)!: set params per pool (#576)
cjcobb23 Aug 16, 2024
c71c881
feat(minor-ampd): add command to send tokens from verifier address (#…
cjcobb23 Aug 19, 2024
db9a355
feat(rewards): add event for rewards distribution (#584)
cjcobb23 Aug 19, 2024
688d697
chore(ampd): include libssl3 in docker image (#592)
jcs47 Aug 20, 2024
7cf0727
feat(minor-ampd): add commands to unbond and claim stake (#587)
cjcobb23 Aug 20, 2024
0a37b8e
feat(ampd): add uri to connection errors (#590)
cgorenflo Aug 21, 2024
212f831
feat(minor-multisig-prover): stellar xdr encoding message to sign (#589)
haiyizxx Aug 21, 2024
14b9db2
fix(ampd): copy external-gateways folder to dockerfile (#594)
haiyizxx Aug 21, 2024
ed6c02b
fix(minor-service-registry): prevent zero bond (#588)
cjcobb23 Aug 21, 2024
fdd8044
fix(ampd): fix nonce for multiversx being keccak256 hash instead of c…
raress96 Aug 23, 2024
9c8902e
fix(ampd): ensure that txs get confirmed when broadcast with an ampd …
cgorenflo Aug 23, 2024
3d96d2d
refactor error
milapsheth Aug 26, 2024
3531096
remove query wrappers
milapsheth Aug 26, 2024
3fcab8b
cleanup state.rs
milapsheth Aug 26, 2024
56a85d5
use error macros
milapsheth Aug 26, 2024
e50a104
improve execute.rs
milapsheth Aug 26, 2024
0909146
fmt
milapsheth Aug 26, 2024
f43d4a8
simplify execute
milapsheth Aug 26, 2024
6565ceb
use ChainNameRaw for ITS chains
milapsheth Aug 26, 2024
00108bc
chain name casing
milapsheth Aug 26, 2024
e38843b
Merge branch 'main' into feat/its-hub-middleware
milapsheth Aug 26, 2024
da65435
remove chain name
milapsheth Aug 27, 2024
14db61e
address comment
milapsheth Aug 27, 2024
aadec89
add integration tests
milapsheth Aug 27, 2024
d429629
simplify tests
milapsheth Aug 27, 2024
1234c4e
add query tests
milapsheth Aug 27, 2024
7d5d096
rename
milapsheth Aug 27, 2024
4a94af8
fmt
milapsheth Aug 28, 2024
f188a39
rename
milapsheth Aug 28, 2024
ee43691
Merge branch 'main' into feat/its-hub-middleware
milapsheth Aug 30, 2024
7ae46f6
fix test
milapsheth Aug 30, 2024
9efa2fa
use chain name for destination
milapsheth Aug 30, 2024
65575fa
address comments
milapsheth Sep 3, 2024
3ebd394
rename
milapsheth Sep 3, 2024
228d740
rename tests
milapsheth Sep 3, 2024
99e2844
improve tests
milapsheth Sep 4, 2024
a856528
err macro
milapsheth Sep 4, 2024
7b1db1f
move tests
milapsheth Sep 4, 2024
8045e17
Merge branch 'main' into feat/its-hub-middleware
milapsheth Sep 5, 2024
d32b9fb
test coverage
milapsheth Sep 5, 2024
2cbd23f
clippy
milapsheth Sep 5, 2024
96a89ca
comment
milapsheth Sep 5, 2024
5c439e7
Merge branch 'main' into feat/its-hub-middleware
milapsheth Sep 5, 2024
89eedf4
fmt
milapsheth Sep 5, 2024
91e896f
fix naming
milapsheth Sep 5, 2024
51d7509
rename message types
milapsheth Sep 6, 2024
0b7cb9d
prevent overwrite
milapsheth Sep 6, 2024
447e314
switch to chain name raw
milapsheth Sep 6, 2024
d45a50e
doc
milapsheth Sep 6, 2024
298cb76
rename to its_contract
milapsheth Sep 6, 2024
321af7d
testdata
milapsheth Sep 6, 2024
196c19f
testdata
milapsheth Sep 6, 2024
d19bfe1
Merge branch 'main' into feat/its-hub-middleware
fish-sammy Sep 9, 2024
3ec0c11
Merge branch 'main' into feat/its-hub-middleware
fish-sammy Sep 10, 2024
f65d81b
Merge branch 'main' into feat/its-hub-middleware
milapsheth Sep 10, 2024
a9b1290
deregistration test
milapsheth Sep 10, 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 .github/workflows/basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:

- name: Build ITS release
working-directory: ./interchain-token-service
milapsheth marked this conversation as resolved.
Show resolved Hide resolved
run: cargo build --release --target wasm32-unknown-unknown --locked
run: cargo build --release --lib --target wasm32-unknown-unknown --locked

# cosmwasm-check v1.3.x is used to check for compatibility with wasmvm v1.3.x used by Axelar
# Older rust toolchain is required to install cosmwasm-check v1.3.x
Expand Down
8 changes: 8 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion contracts/axelarnet-gateway/tests/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::str::FromStr;
use assert_ok::assert_ok;
use axelar_wasm_std::assert_err_contains;
use axelar_wasm_std::error::ContractError;
use axelar_wasm_std::response::inspect_response_msg;
use axelarnet_gateway::contract::{self, ExecuteError};
use axelarnet_gateway::msg::ExecuteMsg;
use axelarnet_gateway::StateError;
Expand All @@ -12,7 +13,6 @@ use router_api::msg::ExecuteMsg as RouterExecuteMsg;
use router_api::{Address, ChainName, CrossChainId, Message};

use crate::utils::messages;
use crate::utils::messages::inspect_response_msg;

mod utils;

Expand Down
2 changes: 1 addition & 1 deletion contracts/axelarnet-gateway/tests/query.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use assert_ok::assert_ok;
use axelar_wasm_std::response::inspect_response_msg;
use axelarnet_gateway::msg::QueryMsg;
use axelarnet_gateway::{contract, ExecutableMessage};
use cosmwasm_std::testing::{mock_dependencies, mock_env, MockApi, MockQuerier, MockStorage};
Expand All @@ -7,7 +8,6 @@ use router_api::msg::ExecuteMsg as RouterExecuteMsg;
use router_api::{ChainName, CrossChainId, Message};
use sha3::{Digest, Keccak256};

use crate::utils::messages::inspect_response_msg;
use crate::utils::params;

mod utils;
Expand Down
20 changes: 0 additions & 20 deletions contracts/axelarnet-gateway/tests/utils/messages.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use cosmwasm_std::{from_json, CosmosMsg, Response, WasmMsg};
use router_api::{CrossChainId, Message};
use serde::de::DeserializeOwned;
use sha3::Digest;

use crate::utils::params;
Expand All @@ -24,21 +22,3 @@ pub fn dummy_to_router(payload: &impl AsRef<[u8]>) -> Message {
payload_hash: sha3::Keccak256::digest(payload).into(),
}
}

pub fn inspect_response_msg<T>(response: Response) -> Result<T, ()>
where
T: DeserializeOwned,
{
let mut followup_messages = response.messages.into_iter();

let msg = followup_messages.next().ok_or(())?.msg;

if followup_messages.next().is_some() {
return Err(());
}

match msg {
CosmosMsg::Wasm(WasmMsg::Execute { msg, .. }) => from_json(msg).map_err(|_| ()),
_ => Err(()),
}
}
34 changes: 34 additions & 0 deletions interchain-token-service/Cargo.toml
milapsheth marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,56 @@ version = "0.1.0"
rust-version = { workspace = true }
edition = { workspace = true }

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",
]

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

[[bin]]
name = "interchain-token-service-schema"
path = "src/bin/schema.rs"

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all instantiate/execute/query exports
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/optimizer:0.16.0
"""

[dependencies]
alloy-primitives = { workspace = true }
alloy-sol-types = { workspace = true }
axelar-wasm-std = { workspace = true, features = ["derive"] }
axelarnet-gateway = { workspace = true, features = ["library"] }
client = { workspace = true }
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
cw-storage-plus = { workspace = true }
cw2 = { workspace = true }
error-stack = { workspace = true }
hex = { workspace = true }
msgs-derive = { workspace = true }
report = { workspace = true }
router-api = { workspace = true }
schemars = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
sha3 = { workspace = true }
strum = { workspace = true }
thiserror = { workspace = true }

[dev-dependencies]
assert_ok = { workspace = true }
goldie = { workspace = true }

[lints]
Expand Down
15 changes: 15 additions & 0 deletions interchain-token-service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Interchain Token Service Hub
milapsheth marked this conversation as resolved.
Show resolved Hide resolved

## Overview

The Interchain Token Service (ITS) Hub contract is a crucial component of a cross-chain ITS protocol. It facilitates the transfer of tokens between different blockchains, manages token deployments, and maintains balance integrity across chains. It connects to ITS edge contracts on different chains (e.g. EVM ITS [contract](https://github.com/axelarnetwork/interchain-token-service)).

## Key Components

1. **ITS Message Processing**: Processes incoming ITS messages from trusted sources.
2. **Balance Tracking**: Ensures accurate token balances are maintained during cross-chain operations.
3. **ITS Address Registry**: Tracks the trusted ITS address for each chain for routing.

### Cross-chain messaging

The ITS Hub makes use of the Axelarnet gateway [contract](../contracts/axelarnet-gateway/) to facilitate sending or receiving cross-chain messages. Messages are sent via `CallContract`, and received when the Axelarnet gateway is executed (by a relayer / user) through `Execute`, which in turn executes ITS Hub's `Execute` method.
Loading
Loading