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

local-interchain: Rust Driver #785

Merged
merged 57 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
1114e6d
cli: add app overrides for port and address
Reecepbcups Sep 13, 2023
64cae53
init: rust client base
Reecepbcups Sep 15, 2023
9067f0d
request resp: use JSON
Reecepbcups Sep 16, 2023
2bbbc92
minor: fmt
Reecepbcups Sep 16, 2023
6a7bc92
bin builder
Reecepbcups Sep 18, 2023
b47513f
feat: add query & binary actions + simple examples
Reecepbcups Sep 18, 2023
c0ea2b3
Add cw_std
Reecepbcups Sep 18, 2023
8468a32
feat: tx, get_tx_hash, and query_tx_hash
Reecepbcups Sep 18, 2023
81263d4
add: localic-std library
Reecepbcups Sep 18, 2023
7274737
condense main.rs to use new std lib
Reecepbcups Sep 18, 2023
afd0a41
use file_path for uploader instead
Reecepbcups Sep 18, 2023
97de464
lib misc: bank_send, errors, libs, bals
Reecepbcups Sep 18, 2023
1a8ab94
CW: Store, Init, Query, Better ActionBuilder
Reecepbcups Sep 19, 2023
dc39199
minor: test path cleanup
Reecepbcups Sep 19, 2023
21cccfd
ci: attempt basic local-ic + rust e2e
Reecepbcups Sep 19, 2023
551b829
ci: set manifest-path to sub-dir
Reecepbcups Sep 19, 2023
602c1e8
ci: fix manifest path
Reecepbcups Sep 19, 2023
428fbd9
cw: get_contract_address
Reecepbcups Sep 19, 2023
1ea9220
cw store: if err, return exact (may not be JSON)
Reecepbcups Sep 19, 2023
4a1611c
add execute_contract
Reecepbcups Sep 19, 2023
355cb40
feat: Upload-Type for cosmwasm contracts
Reecepbcups Sep 20, 2023
3aab50a
better uploader error handling for debugging
Reecepbcups Sep 20, 2023
7cc68d1
more test, get_files func,
Reecepbcups Sep 20, 2023
aeaaaa4
backup; more info queries
Reecepbcups Sep 20, 2023
759388e
move GetInfo into their own funcs
Reecepbcups Sep 20, 2023
2eb359b
query: get ibc config (denom, bin, etc)
Reecepbcups Sep 20, 2023
de00a1e
minor: more general test for node name
Reecepbcups Sep 20, 2023
19b9777
recover-key, overwrite genesis, add-full-node
Reecepbcups Sep 20, 2023
a5f5eef
format
Reecepbcups Sep 20, 2023
718f109
add relayer support
Reecepbcups Sep 24, 2023
3a4a82a
upgrade old docker values
Reecepbcups Sep 24, 2023
3879fea
tweaks, relayer Channel type
Reecepbcups Sep 25, 2023
b48837a
CW: instantiate, execute, and query with mut CW object
Reecepbcups Sep 25, 2023
75afc15
move CW & Bank -> a modules mod
Reecepbcups Sep 25, 2023
ec38a6b
on Tx, poll for Tx hash resp. 5x before failure
Reecepbcups Sep 25, 2023
4450463
codebase lint
Reecepbcups Sep 26, 2023
fa997a9
ci: clippy lint workflow
Reecepbcups Sep 26, 2023
8821088
Move dump-contract-state to POST
Reecepbcups Sep 26, 2023
ff7fec1
ci: fix lint
Reecepbcups Sep 26, 2023
d152dc1
add: `get_sdk_status_code`
Reecepbcups Sep 26, 2023
60d44d1
ci: change clippy working-directory
Reecepbcups Sep 26, 2023
3b33e12
`query_value`, Debug for CRBuilder
Reecepbcups Sep 27, 2023
b4520b2
remove old println, add err to fet_files
Reecepbcups Sep 27, 2023
824489a
migrate to a workspace
Reecepbcups Sep 28, 2023
cb780e8
Merge branch 'main' into reece/rust
Reecepbcups Sep 28, 2023
51b4db5
mod tidy
Reecepbcups Sep 28, 2023
06ba828
add back flags to start_chain
Reecepbcups Sep 28, 2023
c513971
abstract away required flags
Reecepbcups Sep 28, 2023
5323cb5
remove old panic, fmt
Reecepbcups Sep 28, 2023
d243509
move old rest server to be cli arg only
Reecepbcups Sep 28, 2023
8f9b2c1
Add setup documentation
Reecepbcups Sep 28, 2023
87d4dba
simplify default api host & port
Reecepbcups Oct 10, 2023
4211fd0
Uploader: KeyName omitempty
Reecepbcups Oct 10, 2023
65222f4
generalize relayer create_connection
Reecepbcups Oct 10, 2023
1291b2a
cargo updaet
Reecepbcups Oct 10, 2023
5a9b437
rename: create_connection -> create_channel to avoid confusion
Reecepbcups Oct 10, 2023
8591a73
Merge branch 'main' into reece/rust
Reecepbcups Oct 11, 2023
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
21 changes: 21 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,24 @@ jobs:
version: v1.54
only-new-issues: true
args: --timeout=5m

clippy-lint:
defaults:
run:
working-directory: local-interchain/rust/localic-std
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install stable with clippy and rustfmt
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
- name: Install clippy
run: rustup component add clippy
- name: Update
run: cargo update
- name: Run clippy
run: make lint

54 changes: 53 additions & 1 deletion .github/workflows/local-interchain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
build:
runs-on: ubuntu-latest
name: build
defaults:
run:
working-directory: ./local-interchain
steps:
- name: Checkout interchaintest
uses: actions/checkout@v3
Expand All @@ -24,4 +27,53 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}

- run: cd local-interchain && go mod tidy && make install
- name: build local-interchain
run: go mod tidy && make install

- name: Upload localic artifact
uses: actions/upload-artifact@v3
with:
name: local-ic
path: ~/go/bin/local-ic

# TOOO: put the python workflow here. (https://github.com/strangelove-ventures/interchaintest/pull/775)

rust-e2e:
name: rust e2e
needs: build
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./local-interchain
strategy:
fail-fast: false

steps:
- name: checkout chain
uses: actions/checkout@v3

- name: Install latest toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
override: true

- name: Download Tarball Artifact
uses: actions/download-artifact@v3
with:
name: local-ic
path: /tmp

- name: Make local-ic executable
run: chmod +x /tmp/local-ic

- name: Start background ibc local-interchain
run: /tmp/local-ic start juno_ibc --api-port 8080 &

- name: Run Rust Script
run: cd rust && cargo run --package localic-bin --bin localic-bin

- name: Cleanup
run: killall local-ic && exit 0
1 change: 1 addition & 0 deletions local-interchain/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ configs/logs.json
configs/contracts.json

contracts/*.wasm
!contracts/cw_ibc_example.wasm


__pycache__/
9 changes: 6 additions & 3 deletions local-interchain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

A simple way to config and run IBC local chain testing environments with any language of choice for interaction.

## Installing
## Repository CI

- [**Rust**](./rust/README.md)

## Installing Locally

**Install on Mac / Linux**
```bash
Expand Down Expand Up @@ -102,8 +106,7 @@ Here is a base chain template with every feature the configuration accepts. Acco
"gas_prices": "0%DENOM%",
"gas_adjustment": 2.0,
"number_vals": 1,
"number_node": 0,
"use_new_genesis_command": false,
"number_node": 0,
"ibc_paths": ["juno-ibc-1"],
"debugging": true,
"block_time": "500ms",
Expand Down
15 changes: 7 additions & 8 deletions local-interchain/chains/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
"binary": "junod",
"bech32_prefix": "juno",
"docker_image": {
"repository": "ghcr.io/cosmoscontracts/juno-e2e",
"version": "v14.1.0"
},
"use_new_genesis_command": false,
"repository": "ghcr.io/cosmoscontracts/juno",
"version": "v17.0.0"
},
"gas_prices": "0%DENOM%",
"chain_type": "cosmos",
"coin_type": 118,
Expand All @@ -24,19 +23,19 @@
"genesis": {
"modify": [
{
"key": "app_state.gov.voting_params.voting_period",
"key": "app_state.gov.params.voting_period",
"value": "15s"
},
{
"key": "app_state.gov.deposit_params.max_deposit_period",
"key": "app_state.gov.params.max_deposit_period",
"value": "15s"
},
{
"key": "app_state.gov.deposit_params.min_deposit.0.denom",
"key": "app_state.gov.params.min_deposit.0.denom",
"value": "ujuno"
},
{
"key": "app_state.gov.deposit_params.min_deposit.0.amount",
"key": "app_state.gov.params.min_deposit.0.amount",
"value": "1"
}
],
Expand Down
4 changes: 2 additions & 2 deletions local-interchain/chains/base_ibc.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"bech32_prefix": "juno",
"denom": "ujuno",
"docker_image": {
"repository": "ghcr.io/cosmoscontracts/juno-e2e",
"version": "v14.1.0"
"repository": "ghcr.io/cosmoscontracts/juno",
"version": "v17.0.0"
},
"block_time": "2s",
"encoding-options": ["juno"],
Expand Down
3 changes: 1 addition & 2 deletions local-interchain/chains/cosmoshub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"bech32_prefix": "cosmos",
"docker_image": {
"version": "v10.0.1"
},
"use_new_genesis_command": false,
},
"gas_prices": "0%DENOM%",
"chain_type": "cosmos",
"coin_type": 118,
Expand Down
15 changes: 7 additions & 8 deletions local-interchain/chains/juno_ibc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
"binary": "junod",
"bech32_prefix": "juno",
"docker_image": {
"repository": "ghcr.io/cosmoscontracts/juno-e2e",
"version": "v14.1.0"
"repository": "ghcr.io/cosmoscontracts/juno",
"version": "v17.0.0"
},
"use_new_genesis_command": false,
"gas_prices": "0%DENOM%",
"chain_type": "cosmos",
"coin_type": 118,
Expand All @@ -25,15 +24,15 @@
"genesis": {
"modify": [
{
"key": "app_state.gov.voting_params.voting_period",
"key": "app_state.gov.params.voting_period",
"value": "15s"
},
{
"key": "app_state.gov.deposit_params.max_deposit_period",
"key": "app_state.gov.params.max_deposit_period",
"value": "15s"
},
{
"key": "app_state.gov.deposit_params.min_deposit.0.denom",
"key": "app_state.gov.params.min_deposit.0.denom",
"value": "ujuno"
}
],
Expand All @@ -60,8 +59,8 @@
"bech32_prefix": "juno",
"denom": "ujuno",
"docker_image": {
"repository": "ghcr.io/cosmoscontracts/juno-e2e",
"version": "v14.1.0"
"repository": "ghcr.io/cosmoscontracts/juno",
"version": "v17.0.0"
},
"genesis": {
"accounts": [
Expand Down
3 changes: 1 addition & 2 deletions local-interchain/chains/stargaze.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"bech32_prefix": "stars",
"docker_image": {
"version": "v10.0.1"
},
"use_new_genesis_command": false,
},
"gas_prices": "0%DENOM%",
"chain_type": "cosmos",
"coin_type": 118,
Expand Down
18 changes: 17 additions & 1 deletion local-interchain/cmd/local-ic/start_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import (
"github.com/strangelove-ventures/localinterchain/interchain"
)

const (
FlagAPIAddressOverride = "api-address"
FlagAPIPortOverride = "api-port"
)

var startCmd = &cobra.Command{
Use: "start <config.json>",
Aliases: []string{"s", "run"},
Expand All @@ -27,6 +32,17 @@ var startCmd = &cobra.Command{
configPath = filepath.Base(configPath)
}

interchain.StartChain(parentDir, configPath)
apiAddrOverride, _ := cmd.Flags().GetString(FlagAPIAddressOverride)
apiPortOverride, _ := cmd.Flags().GetUint16(FlagAPIPortOverride)

interchain.StartChain(parentDir, configPath, &interchain.AppOverrides{
AddressOverride: apiAddrOverride,
PortOverride: apiPortOverride,
})
},
}

func init() {
startCmd.Flags().String(FlagAPIAddressOverride, "", "override the default API address")
Reecepbcups marked this conversation as resolved.
Show resolved Hide resolved
startCmd.Flags().Uint16(FlagAPIPortOverride, 0, "override the default API port")
}
6 changes: 0 additions & 6 deletions local-interchain/configs/server.json

This file was deleted.

Binary file not shown.
2 changes: 1 addition & 1 deletion local-interchain/docs/REST_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Since local-interchain exposes a REST API, you can interact with the chains usin

## Defaults

By default, the API is served at <http://127.0.0.1:8080/>. You can modify this before starting the chain via [the configs/server.json configuration file](../configs/server.json).
By default, the API is served at <http://127.0.0.1:8080/>. You can modify this before starting the binary with `--api-address` and `--api-port`.

## Environment Variables

Expand Down
Loading
Loading