-
Notifications
You must be signed in to change notification settings - Fork 122
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: Local-Interchain environment #663
Merged
boojamya
merged 16 commits into
strangelove-ventures:main
from
Reecepbcups:reece/local-interchain
Aug 15, 2023
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
3b9720f
Squashed commit of the following:
Reecepbcups 9d839c1
Upload Local-Interchain
Reecepbcups 9e531e4
Minor readme fix
Reecepbcups 125682d
Remove comma from readme JSON
Reecepbcups 37a3d1b
Remove default events from relayre
Reecepbcups e85b6c5
Better error for root cli execute
Reecepbcups 748a84c
Remove debugging print
Reecepbcups 4306ab8
Add signal & endpoint kill-all (stop & cleanup)
Reecepbcups 188f97a
Remove validation panics for Chain types
Reecepbcups 481e223
Show F32 + 64 in defaults output
Reecepbcups 16f0696
Remove BlocksTTL and use math.MaxInt instead
Reecepbcups 51530bb
Kill relayer & all containers on ctrl+c / kill endpoint
Reecepbcups eff98a1
Require `configs` and `chains` in ICTEST_HOME
Reecepbcups 960a157
`docs`: relative paths
Reecepbcups 4646a31
TODO: cleanup on ctrl+c
Reecepbcups 12962fc
Merge branch 'main' into reece/local-interchain
DavidNix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[flake8] | ||
|
||
plugins = | ||
flake8-simplify | ||
flake8-bandit | ||
flake8-bugbear | ||
flake8-builtins | ||
flake8-comprehensions | ||
flake8-eradicate | ||
flake8-isort | ||
flake8-pytest-style | ||
flakehell | ||
pep8-naming | ||
|
||
spellcheck-targets=comments | ||
|
||
extend-ignore = | ||
E501 | ||
; docstrings | ||
D | ||
; try pass | ||
S110 | ||
; dict(k=v) | ||
C408 | ||
|
||
exclude = | ||
.git, | ||
__pycache__, | ||
.mypy_cache | ||
|
||
max-complexity = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
bin/ | ||
|
||
dist/ | ||
|
||
chains/*_ignored.json | ||
chains/*_ignore.json | ||
|
||
configs/logs.json | ||
configs/contracts.json | ||
|
||
contracts/*.wasm | ||
|
||
|
||
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/make -f | ||
|
||
CWD := $(dir $(abspath $(firstword $(MAKEFILE_LIST)))) | ||
|
||
ldflags = -X main.MakeFileInstallDirectory=$(CWD) | ||
ldflags := $(strip $(ldflags)) | ||
BUILD_FLAGS := -ldflags '$(ldflags)' | ||
|
||
.PHONY: build | ||
build: | ||
go build $(BUILD_FLAGS) -o ../bin/local-ic ./cmd/local-ic | ||
|
||
.PHONY: run | ||
run: | ||
../bin/local-ic $(filter-out $@,$(MAKECMDGOALS)) | ||
|
||
.PHONY: install | ||
install: | ||
go install $(BUILD_FLAGS) ./cmd/local-ic ./interchain | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
# Local Interchain | ||
|
||
A simple way to config and run IBC local chain testing environments with any language of choice for interaction. | ||
|
||
## Installing | ||
|
||
**Install on Mac / Linux** | ||
```bash | ||
git clone https://github.com/strangelove-ventures/interchaintest.git | ||
|
||
cd interchaintest/local-interchain | ||
|
||
# NOTE: your binary will link back to this location of where you install. | ||
# If you rename the folder or move it, you need to `make install` the binary again. | ||
make install | ||
``` | ||
**Install on Windows** | ||
|
||
Follow [this guide](./docs/WINDOWS.md) to setup the Windows OS environment for installing Local Interchain. | ||
|
||
## Running | ||
|
||
- *(optional)* Edit `./configs/relayer.json` | ||
- Copy: `cp ./configs/base_ibc.json ./configs/mytest1_ignored.json` | ||
- Run: `local-ic start mytest1_ignored.json` | ||
- Run in different directory: `ICTEST_HOME=/root/local-interchain local-ic start myother_ignored.json` | ||
|
||
**NOTE** The ICTEST_HOME path must contain the directories `chains` and `configs` to be valid. | ||
|
||
*(Default: `make install` links to the cloned directory. `go install .` will use your home directory /local-interchain)* | ||
|
||
*(Ending the config file with `_ignored.json` or `_ignore.json` will ignore it from git)* | ||
|
||
--- | ||
|
||
## REST API | ||
|
||
A rest API can be found at `curl localhost:8080/` by default. Other actions can take place here such as file uploads, actions, querying chain config information, and more! | ||
|
||
Read more about the API [here](./docs/REST_API.md) | ||
|
||
## Helpful Tips | ||
|
||
- Auto complete: edit ~/.bashrc or ~/.zshrc and add `source <(local-ic completion bash)` or `source <(local-ic completion zsh)`. | ||
(fish & windows powershell is also supported) | ||
|
||
- After starting the chain(s), you can read the `./configs/logs.json` file to get useful information. This includes the chain's id, name, RPC address, and more. | ||
|
||
```json | ||
// ./configs/logs.json | ||
[ | ||
{ | ||
"chain_id": "exampleid-1", | ||
"chain_name": "example", | ||
"rpc_address": "http://localhost:38829", | ||
"grpc_address": "localhost:34917", | ||
"ibc_paths": [] | ||
} | ||
] | ||
``` | ||
|
||
- 'ibc-path' should only be set if you are using 2+ chains. If you are using 1 chain, you can leave it blank. | ||
|
||
- You can use `%DENOM%` anywhere in the chain's config to use the `denom` line. This is useful for gas prices, Genesis accounts, etc. | ||
|
||
- Configuration's have set defaults. The minimum you need to run a single chain is the following | ||
|
||
```json | ||
{ | ||
"name": "juno", | ||
"chain_id": "localjuno-2", | ||
"denom": "ujuno", | ||
"docker_image": { | ||
"version": "v14.1.0" | ||
}, | ||
"gas_prices": "0%DENOM%", | ||
"gas_adjustment": 2.0 | ||
} | ||
``` | ||
|
||
--- | ||
|
||
## Base Chain Template | ||
|
||
Here is a base chain template with every feature the configuration accepts. Accounts have extra data to make it simpler for scripting and read from the file directly. | ||
|
||
```json | ||
{ | ||
"name": "juno", | ||
"chain_id": "localjuno-1", | ||
"denom": "ujuno", | ||
"binary": "junod", | ||
"bech32_prefix": "juno", | ||
"docker_image": { | ||
"repository": "ghcr.io/cosmoscontracts/juno-e2e", | ||
"version": "v14.1.0", | ||
"uid_gid": "1000:1000" | ||
}, | ||
"chain_type": "cosmos", | ||
"coin_type": 118, | ||
"trusting_period": "112h", | ||
"gas_prices": "0%DENOM%", | ||
"gas_adjustment": 2.0, | ||
"number_vals": 1, | ||
"number_node": 0, | ||
"use_new_genesis_command": false, | ||
"ibc_paths": ["juno-ibc-1"], | ||
"debugging": true, | ||
"block_time": "500ms", | ||
"encoding-options": ["juno"], | ||
"genesis": { | ||
"modify": [ | ||
{ | ||
"key": "app_state.gov.voting_params.voting_period", | ||
"value": "15s" | ||
}, | ||
{ | ||
"key": "app_state.gov.deposit_params.max_deposit_period", | ||
"value": "15s" | ||
}, | ||
{ | ||
"key": "app_state.gov.deposit_params.min_deposit.0.denom", | ||
"value": "ujuno" | ||
} | ||
], | ||
"accounts": [ | ||
{ | ||
"name": "acc0", | ||
"address": "juno1efd63aw40lxf3n4mhf7dzhjkr453axurv2zdzk", | ||
"amount": "10000000%DENOM%", | ||
"mnemonic": "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry" | ||
} | ||
] | ||
} | ||
}, | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"chains": [ | ||
{ | ||
"name": "juno", | ||
"chain_id": "localjuno-1", | ||
"denom": "ujuno", | ||
"binary": "junod", | ||
"bech32_prefix": "juno", | ||
"docker_image": { | ||
"repository": "ghcr.io/cosmoscontracts/juno-e2e", | ||
"version": "v14.1.0" | ||
}, | ||
"use_new_genesis_command": false, | ||
"gas_prices": "0%DENOM%", | ||
"chain_type": "cosmos", | ||
"coin_type": 118, | ||
"trusting_period": "112h", | ||
"gas_adjustment": 2.0, | ||
"number_vals": 1, | ||
"number_node": 0, | ||
"debugging": true, | ||
"block_time": "500ms", | ||
"encoding-options": ["juno"], | ||
"genesis": { | ||
"modify": [ | ||
{ | ||
"key": "app_state.gov.voting_params.voting_period", | ||
"value": "15s" | ||
}, | ||
{ | ||
"key": "app_state.gov.deposit_params.max_deposit_period", | ||
"value": "15s" | ||
}, | ||
{ | ||
"key": "app_state.gov.deposit_params.min_deposit.0.denom", | ||
"value": "ujuno" | ||
}, | ||
{ | ||
"key": "app_state.gov.deposit_params.min_deposit.0.amount", | ||
"value": "1" | ||
} | ||
], | ||
"accounts": [ | ||
{ | ||
"name": "acc0", | ||
"address": "juno1hj5fveer5cjtn4wd6wstzugjfdxzl0xps73ftl", | ||
"amount": "10000000000%DENOM%", | ||
"mnemonic": "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry" | ||
}, | ||
{ | ||
"name": "acc1", | ||
"address": "juno1efd63aw40lxf3n4mhf7dzhjkr453axurv2zdzk", | ||
"amount": "10000000000%DENOM%", | ||
"mnemonic": "wealth flavor believe regret funny network recall kiss grape useless pepper cram hint member few certain unveil rather brick bargain curious require crowd raise" | ||
} | ||
], | ||
"startup_commands": [ | ||
"%BIN% keys add example-key-after --keyring-backend test --home %HOME%" | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"chains": [ | ||
{ | ||
"name": "gaia", | ||
"chain_id": "localcosmos-1", | ||
"denom": "uatom", | ||
"binary": "gaiad", | ||
"bech32_prefix": "cosmos", | ||
"docker_image": { | ||
"version": "v9.1.0" | ||
}, | ||
"block_time": "6s", | ||
"gas_prices": "0%DENOM%", | ||
"gas_adjustment": 2.0, | ||
"ibc_paths": ["atom-juno", "atom-terra"], | ||
"genesis": { | ||
"accounts": [ | ||
{ | ||
"name": "acc0", | ||
"address": "cosmos1hj5fveer5cjtn4wd6wstzugjfdxzl0xpxvjjvr", | ||
"amount": "10000000%DENOM%", | ||
"mnemonic": "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"name": "juno", | ||
"chain_id": "localjuno-1", | ||
"binary": "junod", | ||
"bech32_prefix": "juno", | ||
"denom": "ujuno", | ||
"docker_image": { | ||
"repository": "ghcr.io/cosmoscontracts/juno-e2e", | ||
"version": "v14.1.0" | ||
}, | ||
"block_time": "2s", | ||
"encoding-options": ["juno"], | ||
"gas_prices": "0%DENOM%", | ||
"gas_adjustment": 2.0, | ||
"ibc_paths": ["atom-juno", "juno-terra"] | ||
}, | ||
{ | ||
"name": "terra", | ||
"chain_id": "localterra-1", | ||
"binary": "terrad", | ||
"bech32_prefix": "terra", | ||
"denom": "uluna", | ||
"docker_image": { | ||
"version": "v2.3.4" | ||
}, | ||
"block_time": "6s", | ||
"encoding-options": ["wasm"], | ||
"gas_prices": "0%DENOM%", | ||
"gas_adjustment": 2.0, | ||
"ibc_paths": ["atom-terra", "juno-terra"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"chains": [ | ||
{ | ||
"name": "gaia", | ||
"chain_id": "localcosmos-1", | ||
"denom": "uatom", | ||
"binary": "gaiad", | ||
"bech32_prefix": "cosmos", | ||
"docker_image": { | ||
"version": "v10.0.1" | ||
}, | ||
"use_new_genesis_command": false, | ||
"gas_prices": "0%DENOM%", | ||
"chain_type": "cosmos", | ||
"coin_type": 118, | ||
"trusting_period": "112h", | ||
"gas_adjustment": 2.0, | ||
"number_vals": 1, | ||
"number_node": 0, | ||
"debugging": true, | ||
"block_time": "500ms", | ||
"genesis": { | ||
"modify": [ | ||
{ | ||
"key": "app_state.gov.voting_params.voting_period", | ||
"value": "15s" | ||
}, | ||
{ | ||
"key": "app_state.gov.deposit_params.max_deposit_period", | ||
"value": "15s" | ||
}, | ||
{ | ||
"key": "app_state.gov.deposit_params.min_deposit.0.denom", | ||
"value": "uatom" | ||
} | ||
], | ||
"accounts": [ | ||
{ | ||
"name": "acc0", | ||
"address": "cosmos1hj5fveer5cjtn4wd6wstzugjfdxzl0xpxvjjvr", | ||
"amount": "10000000000%DENOM%", | ||
"mnemonic": "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to this PR... but there is no
arm64
image so had to tweak this to get it to work on an m1 mac.https://github.com/CosmosContracts/juno/pkgs/container/juno-e2e/109148503?tag=latest