Skip to content

Commit

Permalink
Merge pull request #581 from CosmWasm/co/add-typo-check
Browse files Browse the repository at this point in the history
Add typo check
  • Loading branch information
chipshort authored Dec 20, 2024
2 parents bb5b8c1 + bdbeadc commit f849192
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 24 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/typo-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Check for typos

on:
merge_group:
pull_request:
push:
branches:
- main
workflow_dispatch:

jobs:
check-typos:
name: "Spell-check repository source"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run spell-check
uses: crate-ci/typos@master
2 changes: 2 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[default]
extend-ignore-re = ["(?Rm)^.*(#|//)\\s*spellchecker:disable-line$"]
2 changes: 1 addition & 1 deletion builders/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ See those DockerHub repos for all available versions of the builder images.

## Usage

Create the Docker images, capable of cross-compling Linux and MacOS dynamic
Create the Docker images, capable of cross-compiling Linux and MacOS dynamic
libs. As the builder images are all x86_64, it can be slow and memory intense to
do this on a different architecture:

Expand Down
2 changes: 1 addition & 1 deletion docs/COMPILER_VERSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ supported by cosmwasm-std/cosmwasm-vm.

## Tooling Rust compiler

This Rust version is not related to our codebase directy. It's sufficiently
This Rust version is not related to our codebase directly. It's sufficiently
modern to install and execute tools like `cargo-audit`.

## Versions in use
Expand Down
4 changes: 2 additions & 2 deletions docs/MIGRATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ where the old name was deprecated.
| `SubcallResponse` | `SubMsgResponse` | Contracts do not "call" each other but send messages around |
| `HumanizeAddress` | `HumanizeAddressFunc` | Follow [best practice for naming function types][ft] |
| `CanonicalizeAddress` | `CanonicalizeAddressFunc` | Follow [best practice for naming function types][ft] |
| `GoAPI.HumanAddress` | `GoAPI.HumanizeAddress` | Perfer verbs for converters |
| `GoAPI.CanonicalAddress` | `GoAPI.CanonicalizeAddress` | Perfer verbs for converters |
| `GoAPI.HumanAddress` | `GoAPI.HumanizeAddress` | Prefer verbs for converters |
| `GoAPI.CanonicalAddress` | `GoAPI.CanonicalizeAddress` | Prefer verbs for converters |
| `CosmosMsg.Stargate` | `CosmosMsg.Any` | The message has nothing to do with Stargate |
| `StargateMsg` | `AnyMsg` | The message has nothing to do with Stargate |
| `QueryResponse` | `QueryResult` | Brings consistency with the naming of the other results |
Expand Down
4 changes: 2 additions & 2 deletions internal/api/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ typedef struct ByteSliceView {
* ```
*
*
* If you want to mutate data, you need to comsume the vector and create a new one:
* If you want to mutate data, you need to consume the vector and create a new one:
*
* ```rust
* # use wasmvm::{UnmanagedVector};
Expand Down Expand Up @@ -308,7 +308,7 @@ typedef struct GoIter {
struct gas_meter_t *gas_meter;
/**
* A reference which identifies the iterator and allows finding and accessing the
* actual iterator instance in Go. Once fully initalized, this is immutable.
* actual iterator instance in Go. Once fully initialized, this is immutable.
*/
struct IteratorReference reference;
struct IteratorVtable vtable;
Expand Down
2 changes: 1 addition & 1 deletion internal/api/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestCreateAndDestroyUnmanagedVector(t *testing.T) {
var original []byte
unmanaged := newUnmanagedVector(original)
require.Equal(t, cbool(true), unmanaged.is_none)
// We must not make assumtions on the other fields in this case
// We must not make assumptions on the other fields in this case
copy := copyAndDestroyUnmanagedVector(unmanaged)
require.Nil(t, copy)
}
Expand Down
10 changes: 5 additions & 5 deletions internal/api/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func (l *Lookup) WithGasMeter(meter MockGasMeter) *Lookup {
}
}

// Get wraps the underlying DB's Get method panicing on error.
// Get wraps the underlying DB's Get method panicking on error.
func (l Lookup) Get(key []byte) []byte {
l.meter.ConsumeGas(GetPrice, "get")
v, err := l.db.Get(key)
Expand All @@ -288,23 +288,23 @@ func (l Lookup) Get(key []byte) []byte {
return v
}

// Set wraps the underlying DB's Set method panicing on error.
// Set wraps the underlying DB's Set method panicking on error.
func (l Lookup) Set(key, value []byte) {
l.meter.ConsumeGas(SetPrice, "set")
if err := l.db.Set(key, value); err != nil {
panic(err)
}
}

// Delete wraps the underlying DB's Delete method panicing on error.
// Delete wraps the underlying DB's Delete method panicking on error.
func (l Lookup) Delete(key []byte) {
l.meter.ConsumeGas(RemovePrice, "remove")
if err := l.db.Delete(key); err != nil {
panic(err)
}
}

// Iterator wraps the underlying DB's Iterator method panicing on error.
// Iterator wraps the underlying DB's Iterator method panicking on error.
func (l Lookup) Iterator(start, end []byte) types.Iterator {
l.meter.ConsumeGas(RangePrice, "range")
iter, err := l.db.Iterator(start, end)
Expand All @@ -315,7 +315,7 @@ func (l Lookup) Iterator(start, end []byte) types.Iterator {
return iter
}

// ReverseIterator wraps the underlying DB's ReverseIterator method panicing on error.
// ReverseIterator wraps the underlying DB's ReverseIterator method panicking on error.
func (l Lookup) ReverseIterator(start, end []byte) types.Iterator {
l.meter.ConsumeGas(RangePrice, "range")
iter, err := l.db.ReverseIterator(start, end)
Expand Down
2 changes: 1 addition & 1 deletion lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func LibwasmvmVersion() (string, error) {

// CreateChecksum performs the hashing of Wasm bytes to obtain the CosmWasm checksum.
//
// Ony Wasm blobs are allowed as inputs and a magic byte check will be performed
// Only Wasm blobs are allowed as inputs and a magic byte check will be performed
// to avoid accidental misusage.
func CreateChecksum(wasm []byte) (Checksum, error) {
if len(wasm) == 0 {
Expand Down
4 changes: 2 additions & 2 deletions libwasmvm/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ typedef struct ByteSliceView {
* ```
*
*
* If you want to mutate data, you need to comsume the vector and create a new one:
* If you want to mutate data, you need to consume the vector and create a new one:
*
* ```rust
* # use wasmvm::{UnmanagedVector};
Expand Down Expand Up @@ -308,7 +308,7 @@ typedef struct GoIter {
struct gas_meter_t *gas_meter;
/**
* A reference which identifies the iterator and allows finding and accessing the
* actual iterator instance in Go. Once fully initalized, this is immutable.
* actual iterator instance in Go. Once fully initialized, this is immutable.
*/
struct IteratorReference reference;
struct IteratorVtable vtable;
Expand Down
2 changes: 1 addition & 1 deletion libwasmvm/src/examples/wasmvmstatic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This is an entry point into the library in order to set
// crate-type = ["staticlib"] via a command line arument.
// crate-type = ["staticlib"] via a command line argument.
// See `--example wasmvmstatic`

pub use wasmvm::*;
2 changes: 1 addition & 1 deletion libwasmvm/src/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Vtable for IteratorVtable {}
pub struct GoIter {
pub gas_meter: *mut gas_meter_t,
/// A reference which identifies the iterator and allows finding and accessing the
/// actual iterator instance in Go. Once fully initalized, this is immutable.
/// actual iterator instance in Go. Once fully initialized, this is immutable.
pub reference: IteratorReference,
pub vtable: IteratorVtable,
}
Expand Down
2 changes: 1 addition & 1 deletion libwasmvm/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl U8SliceView {
/// ```
///
///
/// If you want to mutate data, you need to comsume the vector and create a new one:
/// If you want to mutate data, you need to consume the vector and create a new one:
///
/// ```rust
/// # use wasmvm::{UnmanagedVector};
Expand Down
2 changes: 1 addition & 1 deletion libwasmvm/src/vtables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/// In fact, in Go we create a single global vtable variable holding and owning the
/// function the vtables in Rust point to.
///
/// The `Vtable` trait is created to find those vtables troughout the codebase.
/// The `Vtable` trait is created to find those vtables throughout the codebase.
///
/// ## Nullability
///
Expand Down
2 changes: 1 addition & 1 deletion types/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package types

// Env defines the state of the blockchain environment this contract is
// running in. This must contain only trusted data - nothing from the Tx itself
// that has not been verfied (like Signer).
// that has not been verified (like Signer).
//
// Env are json encoded to a byte slice before passing to the wasm contract.
type Env struct {
Expand Down
2 changes: 1 addition & 1 deletion types/ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ const (
// Ordering is (revision_number, timeout_height)
type IBCTimeoutBlock struct {
// the version that the client is currently on
// (eg. after reseting the chain this could increment 1 as height drops to 0)
// (eg. after resetting the chain this could increment 1 as height drops to 0)
Revision uint64 `json:"revision"`
// block height after which the packet times out.
// the height within the given revision
Expand Down
2 changes: 1 addition & 1 deletion types/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type queryResultImpl struct {
// A custom serializer that allows us to map QueryResult instances to the Rust
// enum `ContractResult<Binary>`
func (q QueryResult) MarshalJSON() ([]byte, error) {
// In case both Ok and Err are empty, this is interpreted and seralized
// In case both Ok and Err are empty, this is interpreted and serialized
// as an Ok case with no data because errors must not be empty.
if len(q.Ok) == 0 && len(q.Err) == 0 {
return []byte(`{"ok":""}`), nil
Expand Down
4 changes: 2 additions & 2 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ type DenomUnit struct {
// Modeled after the Cosmos SDK's [DecCoin] type.
// However, in contrast to the Cosmos SDK the `amount` string MUST always have a dot at JSON level,
// see <https://github.com/cosmos/cosmos-sdk/issues/10863>.
// Also if Cosmos SDK choses to migrate away from fixed point decimals
// Also if Cosmos SDK chooses to migrate away from fixed point decimals
// (as shown [here](https://github.com/cosmos/cosmos-sdk/blob/v0.47.4/x/group/internal/math/dec.go#L13-L21) and discussed [here](https://github.com/cosmos/cosmos-sdk/issues/11783)),
// wasmd needs to truncate the decimal places to 18.
//
Expand Down Expand Up @@ -210,7 +210,7 @@ func (pm *PinnedMetrics) UnmarshalMessagePack(data []byte) error {
}

// Array is a wrapper around a slice that ensures that we get "[]" JSON for nil values.
// When unmarshaling, we get an empty slice for "[]" and "null".
// When unmarshalling, we get an empty slice for "[]" and "null".
//
// This is needed for fields that are "Vec<C>" on the Rust side because `null` values
// will result in an error there.
Expand Down

0 comments on commit f849192

Please sign in to comment.