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

ci: link checks + typos #1032

Merged
merged 8 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[codespell]
skip = *.pulsar.go,*.pb.go,*.pb.gw.go,*.json,*.git,*.bin,*.sum,*.mod,query_test.go
ignore-words-list = usera,pres,crate
count =
quiet-level = 3
35 changes: 35 additions & 0 deletions .github/workflows/chores.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: chores

on:
pull_request:

jobs:
link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gaurav-nelson/[email protected]

typos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run codespell
continue-on-error: true
run: |
# .codespellrc is used
sudo apt-get install codespell -y
codespell -w --config .codespellrc
exit $?

pr-title-format:
name: Lint PR Title
permissions:
pull-requests: read
statuses: write
contents: read
runs-on: ubuntu-latest
steps:
- uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
Formerly known as `ibctest`.

[![Go Reference](https://pkg.go.dev/badge/github.com/strangelove-ventures/[email protected])](https://pkg.go.dev/github.com/strangelove-ventures/interchaintest@main)
[![License: Apache-2.0](https://img.shields.io/github/license/strangelove-ventures/interchaintest.svg?style=flat-square)](https://github.com/strangelove-ventures/interchaintest/blob/main/create-test-readme/LICENSE)
[![License: Apache-2.0](https://img.shields.io/github/license/strangelove-ventures/interchaintest.svg?style=flat-square)](https://github.com/strangelove-ventures/interchaintest/blob/main/LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/strangelove-ventures/interchaintest)](https://goreportcard.com/report/github.com/strangelove-ventures/interchaintest)
[![Conforms to README.lint](https://img.shields.io/badge/README.lint-conforming-brightgreen)](https://github.com/strangelove-ventures/readme-dot-lint)
</div>


Expand Down
3 changes: 2 additions & 1 deletion chain/cosmos/08-wasm-types/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/types/module"

//grpc "github.com/cosmos/gogoproto/grpc"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -38,7 +39,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return nil
}

// ValidateGenesis performs a no-op. Genesis is not supported for the tendermint light cilent.
// ValidateGenesis performs a no-op. Genesis is not supported for the tendermint light client.
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion chain/cosmos/chain_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ func (tn *ChainNode) StartContainer(ctx context.Context) error {
if err != nil {
return err
}
// TODO: reenable this check, having trouble with it for some reason
// TODO: re-enable this check, having trouble with it for some reason
if stat != nil && stat.SyncInfo.CatchingUp {
return fmt.Errorf("still catching up: height(%d) catching-up(%t)",
stat.SyncInfo.LatestBlockHeight, stat.SyncInfo.CatchingUp)
Expand Down
2 changes: 1 addition & 1 deletion chain/internal/tendermint/tendermint_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func (tn *TendermintNode) StartContainer(ctx context.Context) error {
// tn.t.Log(err)
return err
}
// TODO: reenable this check, having trouble with it for some reason
// TODO: re-enable this check, having trouble with it for some reason
if stat != nil && stat.SyncInfo.CatchingUp {
return fmt.Errorf("still catching up: height(%d) catching-up(%t)",
stat.SyncInfo.LatestBlockHeight, stat.SyncInfo.CatchingUp)
Expand Down
2 changes: 1 addition & 1 deletion chain/penumbra/penumbra_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (c *PenumbraChain) RecoverKey(ctx context.Context, name, mnemonic string) e
func (c *PenumbraChain) GetAddress(ctx context.Context, keyName string) ([]byte, error) {
fn := c.getFullNode()
if fn.PenumbraAppNode == nil {
return nil, fmt.Errorf("no penumbra app nodes configured to retreive an address from")
return nil, fmt.Errorf("no penumbra app nodes configured to retrieve an address from")
}
return fn.PenumbraAppNode.GetAddress(ctx, keyName)
}
Expand Down
2 changes: 1 addition & 1 deletion contract/cosmwasm/rust_optimizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c *Contract) Compile() *Contract {
// Form the path to the artifacts directory, used for checksum.txt and package.wasm
artifactsPath := filepath.Join(repoPathFull, "artifacts")

// Parse the checksums.txt for the crate/wasm binary name
// Parse the checksums.txt for the create/wasm binary name
checksumsPath := filepath.Join(artifactsPath, "checksums.txt")
checksumsBz, err := os.ReadFile(checksumsPath)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ To get started, follow these steps:
git clone https://github.com/<Username>/interchaintest.git
```

3. Crate a new branch on your fork
3. Create a new branch on your fork

```sh
git checkout -b name/broad-description-of-feature
git checkout -b name/broad-description-of-feature
```

4. Make your changes and commit them with descriptive commit messages.
Expand Down Expand Up @@ -74,7 +74,7 @@ We welcome bug reports, feature requests, and other contributions to our project

## Pull requests

In almost all cases, you should target branch `main` with your work. In the event it spans multiple releases, we will backport to the previous release branch as well. This can be found in our [READMEs maintained branches](./README.md#maintained-branches).
In almost all cases, you should target branch `main` with your work. In the event it spans multiple releases, we will backport to the previous release branch as well. This can be found in our [READMEs maintained branches](../README.md#maintained-branches).

For internal branches, branch names should be prefixed with the author's name followed by a short description of the feature, eg. `name/feature-x`.

Expand Down
10 changes: 5 additions & 5 deletions docs/ciTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ It's important to realize the image will be named using the arg from the `-c` fl
**Goal:** When a PR is created, have a GitHub workflow that:

1. Builds a Docker image with the latest code changes to the binary.
2. Synchronously spin up runners (one for each test), load Docker image, and run tests.
2. Synchronously spin up runners (one for each test), load Docker image, and run tests.

We recommend having this workflow run only on PR's.

Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
strategy:
matrix:
# names of `make` commands to run tests
test:
test:
- ictest-tkn-factory
- ictest-packet-forward
- ictest-paramauthority
Expand All @@ -132,7 +132,7 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: 1.19

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

Expand Down Expand Up @@ -224,7 +224,7 @@ The example below will spin up 9 runners, one for each test.
strategy:
matrix:
# names of `make` commands to run tests
test:
test:
- ictest-tkn-factory
- ictest-packet-forward
- ictest-paramauthority
Expand All @@ -241,7 +241,7 @@ The example below will spin up 9 runners, one for each test.
uses: actions/setup-go@v3
with:
go-version: 1.19

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

Expand Down
2 changes: 1 addition & 1 deletion docs/conformance-tests-bin.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ By passing in a matrix file you can customize these aspects of the environment:
**Pre-Configured Chains**

`interchaintest` comes with [pre-configured chains](../configuredChains.yaml).
In the matrix file, if `Name` matches the name of any pre-configured chain, `interchaintest` will use standard settings UNLESS overriden in the matrix file. [example_matrix_custom.json](../cmd/interchaintest/example_matrix_custom.json) is an example of overriding all options.
In the matrix file, if `Name` matches the name of any pre-configured chain, `interchaintest` will use standard settings UNLESS overridden in the matrix file. [example_matrix_custom.json](../cmd/interchaintest/example_matrix_custom.json) is an example of overriding all options.


**Custom Binaries**
Expand Down
2 changes: 1 addition & 1 deletion examples/cosmos/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# More Examples

[State Sync](https://github.com/CosmosContracts/juno/blob/reece/add-state-sync-test/interchaintest/state_sync_test.go)
[State Sync](https://github.com/CosmosContracts/juno/blob/v21.0.0/interchaintest/state_sync_test.go)
4 changes: 2 additions & 2 deletions examples/ibc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Interchain Queries

Packet Forward Middleware Test:

* [Noble](https://github.com/strangelove-ventures/noble/blob/main/interchaintest/packet_forward_test.go)
* [Juno](https://github.com/CosmosContracts/juno/blob/main/interchaintest/module_pfm_test.go)
* [Noble](https://github.com/noble-assets/noble/blob/v4.0.3/interchaintest/packet_forward_test.go)
* [Juno](https://github.com/CosmosContracts/juno/blob/v21.0.0/interchaintest/module_pfm_test.go)

IBC Client Update

Expand Down
2 changes: 1 addition & 1 deletion examples/ibc/wasm/wasm_ibc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func TestWasmIbc(t *testing.T) {
func() {
err := r.StopRelayer(ctx, eRep)
if err != nil {
t.Logf("an error occured while stopping the relayer: %s", err)
t.Logf("an error occurred while stopping the relayer: %s", err)
}
},
)
Expand Down
2 changes: 1 addition & 1 deletion examples/ibc/wasm/wasm_icq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func TestInterchainQueriesWASM(t *testing.T) {
func() {
err := r.StopRelayer(ctx, eRep)
if err != nil {
t.Logf("an error occured while stopping the relayer: %s", err)
t.Logf("an error occurred while stopping the relayer: %s", err)
}
},
)
Expand Down
2 changes: 1 addition & 1 deletion ibc/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (o Order) Validate() error {

// CreateClientOptions contains the configuration for creating a client.

// a zero value is the same as not specifying the flag and will use the relayer defauls
// a zero value is the same as not specifying the flag and will use the relayer defaults
type CreateClientOptions struct {
TrustingPeriod string
TrustingPeriodPercentage int64 // only available for Go Relayer
Expand Down
4 changes: 2 additions & 2 deletions internal/blockdb/tui/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ func TestModel_Update(t *testing.T) {

update(runeKey('c'))

_, primative := model.mainContentView().GetFrontPage()
_, primitive := model.mainContentView().GetFrontPage()
// TODO (nix - 6/22/22) Can't get text from a tview.Modal. We could use a tview.TextView but it does not render
// properly with the nested flex views.
require.IsType(t, &tview.Modal{}, primative.(*tview.Flex).GetItem(1).(*tview.Flex).GetItem(1))
require.IsType(t, &tview.Modal{}, primitive.(*tview.Flex).GetItem(1).(*tview.Flex).GetItem(1))
})
}
2 changes: 1 addition & 1 deletion internal/dockerutil/ports.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func openListener(port int) (*net.TCPListener, error) {
}

// getPort generates a docker PortBinding by using the port provided.
// If port is set to 0, the next avaliable port will be used.
// If port is set to 0, the next available port will be used.
// The listener will be closed in the case of an error, otherwise it will be left open.
// This allows multiple getPort calls to find multiple available ports
// before closing them so they are available for the PortBinding.
Expand Down
2 changes: 1 addition & 1 deletion internal/dockerutil/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type DockerSetupTestingT interface {

// CleanupLabel is a docker label key targeted by DockerSetup when it cleans up docker resources.
//
// "interchaintest" is perhaps a better name. However, for backwards compatability we preserve the original name of "ibc-test"
// "interchaintest" is perhaps a better name. However, for backwards compatibility we preserve the original name of "ibc-test"
// with the hyphen. Otherwise, we run the risk of causing "container already exists" errors because DockerSetup
// is unable to clean old resources from docker engine.
const CleanupLabel = "ibc-test"
Expand Down
4 changes: 2 additions & 2 deletions local-interchain/cmd/local-ic/new_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var newChainCmd = &cobra.Command{
name := strings.TrimSuffix(args[0], ".json")
filePath := path.Join(GetDirectory(), "chains", fmt.Sprintf("%s.json", name))

// while loop to allow for IBC conncetions to work as expected. Else set IBC as []string{}
// while loop to allow for IBC connections to work as expected. Else set IBC as []string{}

text, _ := os.ReadFile(filePath)
if len(text) > 0 {
Expand All @@ -55,7 +55,7 @@ var newChainCmd = &cobra.Command{
ChainID: getOrDefault("chain_id", "local-1"),
Binary: getOrDefault("App Binary", "junod"),
Bech32Prefix: getOrDefault("Bech32 Prefix", "juno"),
GasPrices: getOrDefault("gas_prices (comma seperated)", "0ujuno,0other"),
GasPrices: getOrDefault("gas_prices (comma separated)", "0ujuno,0other"),
GasAdjustment: getOrDefault("gas_adjustment", 2.5),

// IBCPaths should be unique chain ids?
Expand Down
16 changes: 9 additions & 7 deletions local-interchain/docs/REST_API.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Interacting with the chains

Since local-interchain exposes a REST API, you can interact with the chains using any language that supports HTTP requests. A default python client example can be found in the [scripts folder here](../scripts/).
Since local-interchain exposes a REST API, you can interact with the chains using any language that supports HTTP requests. A default python client example can be found in the [python folder](../python/) and [rust](../rust/README.md).

# Contents

Expand All @@ -19,15 +19,15 @@ Since local-interchain exposes a REST API, you can interact with the chains usin
- [Get Channels](#get-channels)
- [Using Actions](#using-actions)
- [Unix Curl Command](#unix-curl-command)
- [Python](#python)
- [Python](#python-client) <!-- markdown-link-check-disable-line -->

---

# REST API

## Defaults

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`.
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`. <!-- markdown-link-check-disable-line -->

## Environment Variables

Expand Down Expand Up @@ -88,6 +88,7 @@ The following examples use the [chains/base.json](../chains/base.json) chain exa

### Unix Curl Command

<!-- markdown-link-check-disable -->
```bash
# Get the total supply
curl -X POST -H "Content-Type: application/json" -d '{
Expand All @@ -107,7 +108,7 @@ curl -X POST -H "Content-Type: application/json" -d '{
}' http://127.0.0.1:8080/


# Execute a Tx sending funds
# Execute a Tx sending funds
# The key here 'acc0' was set by name in the genesis section of the chain's config.
curl -X POST -H "Content-Type: application/json" -d '{
"chain_id": "localjuno-1",
Expand All @@ -117,7 +118,7 @@ curl -X POST -H "Content-Type: application/json" -d '{


# Querying said Tx hash returned from above.
# NOTE:
# NOTE:
# - the cmd does not require 'query' (or 'q') as it is added automatically.
# - This Tx hash will not be available on your machine.
curl -X POST -H "Content-Type: application/json" -d '{
Expand All @@ -127,9 +128,9 @@ curl -X POST -H "Content-Type: application/json" -d '{
}' http://127.0.0.1:8080/
```

### Python
### Python Client

A full Python client can be found in the [scripts folder](../scripts/). This is just a snippet of code for example purposes.
A full Python client can be found in the [python folder](../python/). This is just a snippet of code for example purposes.

```python
# local-ic start juno_ibc
Expand Down Expand Up @@ -165,3 +166,4 @@ print(
# {'chain_id': 'localjuno-1', 'channel_id': 'channel-0', 'client_id': '07-tendermint-0', 'connection_hops': ['connection-0'], 'counterparty': {'chain_id': 'localjuno-2', 'channel_id': 'channel-0', 'client_id': '07-tendermint-0', 'connection_id': 'connection-0', 'port_id': 'transfer'}, 'ordering': 'ORDER_UNORDERED', 'port_id': 'transfer', 'state': 'STATE_OPEN', 'version': 'ics20-1'}

```
<!-- markdown-link-check-enable -->
8 changes: 4 additions & 4 deletions local-interchain/docs/WINDOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ If your Windows system is missing Hyper-V, you can follow [this guide](https://w
## Environment Setup

### 1. Installing Docker
Make sure you have wsl installed, you can check by running **Windows PowerShell** as adminstrator and running `wsl --install` which would install wsl2 if missing.
Make sure you have wsl installed, you can check by running **Windows PowerShell** as administrator and running `wsl --install` which would install wsl2 if missing.

For Win 10 and Win 11, follow [this guide](https://docs.docker.com/desktop/install/windows-install/) to setup and install Docker Desktop on your Windows system.

Expand Down Expand Up @@ -83,7 +83,7 @@ GCC does not come with Windows, and the best compatible setup I've found was usi
![](https://i.imgur.com/EeZUeJU.png)

4. Choose installation folder and click Install.

![](https://i.imgur.com/D25unIm.png)

5. After installation, no need to run *Code::Blocks* and click Next then Finish.
Expand All @@ -100,13 +100,13 @@ After finishing the steps above, open a new cmd or shell, and you will be able t
1. Start the docker daemon by running **Docker Desktop** on Win 10/11 or using [**Docker Quickstart Terminal**](https://github.com/microsoft/docker/blob/master/docs/installation/windows.md#using-the-docker-quickstart-terminal) if you have installed Docker Toolbox.
2. Clone the Local Interchain Repo.
```bash
git clone https://github.com/strangelove-ventures/interchaintest.git
git clone https://github.com/strangelove-ventures/interchaintest.git
cd interchaintest/local-interchain
```
3. Run `make install`
4. Run `local-ic start base.json`

Wait for it to set up and go to *https://127.0.0.1:8080/info*, you should see each local chain running in its own docker container `docker ps`
Wait for it to set up and go to *https://127.0.0.1:8080/info*, you should see each local chain running in its own docker container `docker ps` <!-- markdown-link-check-disable-line -->

Now you are running a complete local wasm IBC-connected environment on a Windows operating system.

Expand Down
4 changes: 2 additions & 2 deletions local-interchain/rust/localic-std/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct ChainRequestBuilder {
impl ChainRequestBuilder {
/// # Errors
///
/// Returns `Err` if the `api` or `chain_id` is empty.
/// Returns `Err` if the `api` or `chain_id` is empty.
pub fn new(
api: String,
chain_id: String,
Expand Down Expand Up @@ -373,7 +373,7 @@ fn set_missing_required_args(cmd: &str, required: Vec<&str>) -> String {
for arg in required {
let parsed_args: String = match arg.split_once('=') {
Some((a, b)) => format!("{a} {b}"),
None => panic!("{arg} must have an '=' sign to be valie in the `required` argument"),
None => panic!("{arg} must have an '=' sign to be value in the `required` argument"),
};

if !command.contains(arg) && !command.contains(parsed_args.as_str()) {
Expand Down
Loading