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

Add typo check to CI #2032

Merged
merged 2 commits into from
Nov 12, 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
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
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
- Log query error before redacting [\#1593](https://github.com/CosmWasm/wasmd/issues/1593)
- Restrict pagination on all-state-query [\#1619](https://github.com/CosmWasm/wasmd/pull/1619)
- Bug in IbcQuery::ListChannels implementation when port is unset [\#1597](https://github.com/CosmWasm/wasmd/issues/1597)
- Ensure some contraints and limits on pin/unpin code ids [\#1624](https://github.com/CosmWasm/wasmd/pull/1624)
- Ensure some constraints and limits on pin/unpin code ids [\#1624](https://github.com/CosmWasm/wasmd/pull/1624)
- Ensure genesis import works with both address generators [\#1629](https://github.com/CosmWasm/wasmd/issues/1629)
- Set default query limit and ensure constraints [\#1632](https://github.com/CosmWasm/wasmd/pull/1632)

Expand All @@ -174,7 +174,7 @@
- If `port_id` is omitted, all channels bound to the contract's port will be listed.
- Restrict pagination on all-state-query [\#1619](https://github.com/CosmWasm/wasmd/pull/1619)
- Pagination limit is set to 100 for all-state-query. See also [\#1632](https://github.com/CosmWasm/wasmd/pull/1632)
- Ensure some contraints and limits on pin/unpin code ids [\#1624](https://github.com/CosmWasm/wasmd/pull/1624)
- Ensure some constraints and limits on pin/unpin code ids [\#1624](https://github.com/CosmWasm/wasmd/pull/1624)
- Total number of code ids is limited to 50 for pin/unpin operations
- Custom StoreCode Authorization for authz module [\#1584](https://github.com/CosmWasm/wasmd/issues/1584)

Expand Down Expand Up @@ -413,7 +413,7 @@ below to learn more!

[Full Changelog](https://github.com/CosmWasm/wasmd/compare/v0.28.0...v0.29.0)

- Add dependencies for protobuf and remove third_party forlder [/#1030](https://github.com/CosmWasm/wasmd/pull/1030)
- Add dependencies for protobuf and remove third_party folder [/#1030](https://github.com/CosmWasm/wasmd/pull/1030)
- Check wasmvm version on startup [\#1029](https://github.com/CosmWasm/wasmd/pull/1029/)
- Allow AccessConfig to use a list of addresses instead of just a single address [\#945](https://github.com/CosmWasm/wasmd/issues/945)
- Make contract addresses predictable \("deterministic"\) [\#942](https://github.com/CosmWasm/wasmd/issues/942)
Expand Down Expand Up @@ -455,7 +455,7 @@ No

**Fixed Bugs**

- Fix: Make events in reply completely determinisitic by stripping out anything coming from Cosmos SDK (not CosmWasm codebase) [\#917](https://github.com/CosmWasm/wasmd/pull/917) ([assafmo](https://github.com/assafmo))
- Fix: Make events in reply completely deterministic by stripping out anything coming from Cosmos SDK (not CosmWasm codebase) [\#917](https://github.com/CosmWasm/wasmd/pull/917) ([assafmo](https://github.com/assafmo))

Migration notes:

Expand Down
8 changes: 4 additions & 4 deletions EVENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ consistent order (and avoid dictionaries/hashes). Here is a simple Event in JSON
"type": "wasm",
"attributes": [
{"key": "_contract_address", "value": "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6"},
{"key": "transfered", "value": "777000"}
{"key": "transferred", "value": "777000"}
]
}
```
Expand Down Expand Up @@ -321,10 +321,10 @@ action emitting events, so we define a structure to flatten this event tree:
* All events are returned in execution order as [defined by CosmWasm docs](https://github.com/CosmWasm/cosmwasm/blob/main/SEMANTICS.md#dispatching-messages)
* `x/wasm` keeper emits a custom event for each call to a contract entry point. Not just `execute`, `instantiate`,
and `migrate`, but also `reply`, `sudo` and all ibc entry points.
* This means all `wasm*` events are preceeded by the cosmwasm entry point that returned them.
* This means all `wasm*` events are preceded by the cosmwasm entry point that returned them.

To make this more clear, I will provide an example of executing a contract, which returns two messages, one to instantiate a new
contract and the other to set the withdrawl address, while also using `ReplyOnSuccess` for the instantiation (to get the
contract and the other to set the withdrawal address, while also using `ReplyOnSuccess` for the instantiation (to get the
address). It will emit a series of events that looks something like this:

```go
Expand All @@ -335,7 +335,7 @@ sdk.NewEvent(
sdk.NewAttribute("sender", msg.Sender),
),

// top-level exection call
// top-level execution call
sdk.NewEvent(
"execute",
sdk.NewAttribute("_contract_address", contractAddr.String()),
Expand Down
6 changes: 3 additions & 3 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ docker run --rm -it \

## Take majority control of the chain

In genesis we have a valiator with 250 million `ustake` bonded. We want to be easily
In genesis we have a validator with 250 million `ustake` bonded. We want to be easily
able to pass a proposal with our client. Let us bond 700 million `ustake` to ensure
we have > 67% of the voting power and will pass with the validator not voting.

Expand All @@ -167,7 +167,7 @@ docker run --rm -it \
## Vote on the upgrade

Now that we see the chain is running and producing blocks, and our client has
enough token to control the netwrok, let's create a governance
enough token to control the network, let's create a governance
upgrade proposal for the new chain to move to `musselnet-v2` (this must be the
same name as we use in the handler we created above, change this to match what
you put in your handler):
Expand Down Expand Up @@ -298,7 +298,7 @@ docker run --rm -it \
After this, we just let the chain run and open the terminal so you can see the log files.
It should keep producing blocks until it hits height 500 (or whatever you set there),
when the process will print a huge stacktrace and hang. Immediately before the stack trace, you
should see a line like this (burried under tons of tendermint logs):
should see a line like this (buried under tons of tendermint logs):

`8:50PM ERR UPGRADE "musselnet-v2" NEEDED at height: 100:`

Expand Down
8 changes: 8 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[default]
extend-ignore-re = ["(?Rm)^.*(#|//)\\s*spellchecker:disable-line$"]

[default.extend-identifiers]
iNdEx = "iNdEx"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also added this, since it is used as a variable name in legacy_types.go


[files]
extend-exclude = ["**/go.mod", "**/go.sum", "**/*.pb.go"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some excludes here to avoid checking package hashes and generated files. There was already one false-positive in go.sum.

4 changes: 2 additions & 2 deletions app/params/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Package params defines the simulation parameters in the gaia.

It contains the default weights used for each transaction used on the module's
simulation. These weights define the chance for a transaction to be simulated at
any gived operation.
any given operation.

You can repace the default values for the weights by providing a params.json
You can replace the default values for the weights by providing a params.json
file with the weights defined for each of the transaction operations:

{
Expand Down
4 changes: 2 additions & 2 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,15 @@ func TestAppImportExport(t *testing.T) {
failedKVAs, failedKVBs := simtestutil.DiffKVStores(storeA, storeB, skipPrefixes[keyName])
if !assert.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare in %q", keyName) {
for _, v := range failedKVBs {
t.Logf("store missmatch: %q\n", v)
t.Logf("store mismatch: %q\n", v)
}
t.FailNow()
}

t.Logf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), appKeyA, appKeyB)
if !assert.Equal(t, 0, len(failedKVAs), simtestutil.GetSimulationLog(keyName, app.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) {
for _, v := range failedKVAs {
t.Logf("store missmatch: %q\n", v)
t.Logf("store mismatch: %q\n", v)
}
t.FailNow()
}
Expand Down
10 changes: 5 additions & 5 deletions docs/proto/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -746,10 +746,10 @@ a v1 governance proposal.
| ----- | ---- | ----- | ----------- |
| `title` | [string](#string) | | Title is a short summary |
| `description` | [string](#string) | | Description is a human readable text |
| `run_as` | [string](#string) | | RunAs is the address that is passed to the contract's enviroment as sender |
| `run_as` | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender |
| `admin` | [string](#string) | | Admin is an optional address that can execute migrations |
| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code |
| `label` | [string](#string) | | Label is optional metadata to be stored with a constract instance. |
| `label` | [string](#string) | | Label is optional metadata to be stored with a contract instance. |
| `msg` | [bytes](#bytes) | | Msg json encode message to be passed to the contract on instantiation |
| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation |
| `salt` | [bytes](#bytes) | | Salt is an arbitrary value provided by the sender. Size can be 1 to 64. |
Expand All @@ -776,7 +776,7 @@ a v1 governance proposal.
| `run_as` | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender |
| `admin` | [string](#string) | | Admin is an optional address that can execute migrations |
| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code |
| `label` | [string](#string) | | Label is optional metadata to be stored with a constract instance. |
| `label` | [string](#string) | | Label is optional metadata to be stored with a contract instance. |
| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on instantiation |
| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation |

Expand Down Expand Up @@ -847,7 +847,7 @@ the x/gov module via a v1 governance proposal.
| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional |
| `unpin_code` | [bool](#bool) | | UnpinCode code on upload, optional |
| `admin` | [string](#string) | | Admin is an optional address that can execute migrations |
| `label` | [string](#string) | | Label is optional metadata to be stored with a constract instance. |
| `label` | [string](#string) | | Label is optional metadata to be stored with a contract instance. |
| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on instantiation |
| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation |
| `source` | [string](#string) | | Source is the URL where the code is hosted |
Expand Down Expand Up @@ -1762,7 +1762,7 @@ Since: 0.40
| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional |
| `unpin_code` | [bool](#bool) | | UnpinCode code on upload, optional. As default the uploaded contract is pinned to cache. |
| `admin` | [string](#string) | | Admin is an optional address that can execute migrations |
| `label` | [string](#string) | | Label is optional metadata to be stored with a constract instance. |
| `label` | [string](#string) | | Label is optional metadata to be stored with a contract instance. |
| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on instantiation |
| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred from the authority account to the contract on instantiation |
| `source` | [string](#string) | | Source is the URL where the code is hosted |
Expand Down
8 changes: 4 additions & 4 deletions proto/cosmwasm/wasm/v1/proposal_legacy.proto
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ message InstantiateContractProposal {
string admin = 4 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// CodeID is the reference to the stored WASM code
uint64 code_id = 5 [ (gogoproto.customname) = "CodeID" ];
// Label is optional metadata to be stored with a constract instance.
// Label is optional metadata to be stored with a contract instance.
string label = 6;
// Msg json encoded message to be passed to the contract on instantiation
bytes msg = 7 [
Expand Down Expand Up @@ -93,13 +93,13 @@ message InstantiateContract2Proposal {
string title = 1;
// Description is a human readable text
string description = 2;
// RunAs is the address that is passed to the contract's enviroment as sender
// RunAs is the address that is passed to the contract's environment as sender
string run_as = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// Admin is an optional address that can execute migrations
string admin = 4 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// CodeID is the reference to the stored WASM code
uint64 code_id = 5 [ (gogoproto.customname) = "CodeID" ];
// Label is optional metadata to be stored with a constract instance.
// Label is optional metadata to be stored with a contract instance.
string label = 6;
// Msg json encode message to be passed to the contract on instantiation
bytes msg = 7 [
Expand Down Expand Up @@ -330,7 +330,7 @@ message StoreAndInstantiateContractProposal {
bool unpin_code = 6;
// Admin is an optional address that can execute migrations
string admin = 7;
// Label is optional metadata to be stored with a constract instance.
// Label is optional metadata to be stored with a contract instance.
string label = 8;
// Msg json encoded message to be passed to the contract on instantiation
bytes msg = 9 [
Expand Down
4 changes: 2 additions & 2 deletions proto/cosmwasm/wasm/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ message MsgStoreAndInstantiateContract {
bool unpin_code = 5;
// Admin is an optional address that can execute migrations
string admin = 6 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// Label is optional metadata to be stored with a constract instance.
// Label is optional metadata to be stored with a contract instance.
string label = 7;
// Msg json encoded message to be passed to the contract on instantiation
bytes msg = 8 [
Expand Down Expand Up @@ -518,4 +518,4 @@ message MsgUpdateContractLabel {
}

// MsgUpdateContractLabelResponse returns empty data
message MsgUpdateContractLabelResponse {}
message MsgUpdateContractLabelResponse {}
2 changes: 1 addition & 1 deletion scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Scripts

These scripts are copied from the [Cosmos-SDK](https://github.com/cosmos/cosmos-sdk/tree/v0.42.1/scripts) respository
These scripts are copied from the [Cosmos-SDK](https://github.com/cosmos/cosmos-sdk/tree/v0.42.1/scripts) repository
with minor modifications. All credits and big thanks go to the original authors.

Please note that a custom [fork](github.com/regen-network/protobuf) by the Regen network team is used.
Expand Down
2 changes: 1 addition & 1 deletion scripts/contrib/devtools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ $(STATIK):
@(cd /tmp && go install github.com/rakyll/[email protected])

# Install the runsim binary with a temporary workaround of entering an outside
# directory as the "go get" command ignores the -mod option and will polute the
# directory as the "go get" command ignores the -mod option and will pollute the
# go.{mod, sum} files.
#
# ref: https://github.com/golang/go/issues/30515
Expand Down
2 changes: 1 addition & 1 deletion tests/ibctesting/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func NewDefaultEndpoint(chain *TestChain) *Endpoint {
}
}

// QueryProof queries proof associated with this endpoint using the lastest client state
// QueryProof queries proof associated with this endpoint using the latest client state
// height on the counterparty chain.
func (endpoint *Endpoint) QueryProof(key []byte) ([]byte, clienttypes.Height) {
// obtain the counterparty client representing the chain associated with the endpoint
Expand Down
2 changes: 1 addition & 1 deletion tests/system/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ func (s *SystemUnderTest) BuildNewBinary() {
}
}

// AwaitBlockHeight blocks until te target height is reached. An optional timout parameter can be passed to abort early
// AwaitBlockHeight blocks until te target height is reached. An optional timeout parameter can be passed to abort early
func (s *SystemUnderTest) AwaitBlockHeight(t *testing.T, targetHeight int64, timeout ...time.Duration) {
t.Helper()
require.Greater(t, targetHeight, s.currentHeight)
Expand Down
2 changes: 1 addition & 1 deletion x/wasm/keeper/handler_plugin_encoders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ func TestEncodeGovMsg(t *testing.T) {
},
},
},
"Gov weighted vote: splitted": {
"Gov weighted vote: split": {
sender: myAddr,
srcMsg: wasmvmtypes.CosmosMsg{
Gov: &wasmvmtypes.GovMsg{
Expand Down
26 changes: 13 additions & 13 deletions x/wasm/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,58 +239,58 @@ func TestEnforceValidPermissionsOnCreate(t *testing.T) {
onlyOther := types.AccessTypeAnyOfAddresses.With(other)

specs := map[string]struct {
defaultPermssion types.AccessType
defaultPermission types.AccessType
requestedPermission *types.AccessConfig
// grantedPermission is set iff no error
grantedPermission types.AccessConfig
// expError is nil iff the request is allowed
expError *errorsmod.Error
}{
"override everybody": {
defaultPermssion: types.AccessTypeEverybody,
defaultPermission: types.AccessTypeEverybody,
requestedPermission: &onlyCreator,
grantedPermission: onlyCreator,
},
"default to everybody": {
defaultPermssion: types.AccessTypeEverybody,
defaultPermission: types.AccessTypeEverybody,
requestedPermission: nil,
grantedPermission: types.AccessConfig{Permission: types.AccessTypeEverybody},
},
"explicitly set everybody": {
defaultPermssion: types.AccessTypeEverybody,
defaultPermission: types.AccessTypeEverybody,
requestedPermission: &types.AccessConfig{Permission: types.AccessTypeEverybody},
grantedPermission: types.AccessConfig{Permission: types.AccessTypeEverybody},
},
"cannot override nobody": {
defaultPermssion: types.AccessTypeNobody,
defaultPermission: types.AccessTypeNobody,
requestedPermission: &onlyCreator,
expError: sdkerrors.ErrUnauthorized,
},
"default to nobody": {
defaultPermssion: types.AccessTypeNobody,
defaultPermission: types.AccessTypeNobody,
requestedPermission: nil,
grantedPermission: types.AccessConfig{Permission: types.AccessTypeNobody},
},
"only defaults to code creator": {
defaultPermssion: types.AccessTypeAnyOfAddresses,
defaultPermission: types.AccessTypeAnyOfAddresses,
requestedPermission: nil,
grantedPermission: onlyCreator,
},
"can explicitly set to code creator": {
defaultPermssion: types.AccessTypeAnyOfAddresses,
defaultPermission: types.AccessTypeAnyOfAddresses,
requestedPermission: &onlyCreator,
grantedPermission: onlyCreator,
},
"cannot override which address in only": {
defaultPermssion: types.AccessTypeAnyOfAddresses,
defaultPermission: types.AccessTypeAnyOfAddresses,
requestedPermission: &onlyOther,
expError: sdkerrors.ErrUnauthorized,
},
}
for msg, spec := range specs {
t.Run(msg, func(t *testing.T) {
params := types.DefaultParams()
params.InstantiateDefaultPermission = spec.defaultPermssion
params.InstantiateDefaultPermission = spec.defaultPermission
err := keeper.SetParams(ctx, params)
require.NoError(t, err)
codeID, _, err := contractKeeper.Create(ctx, creator, hackatomWasm, spec.requestedPermission)
Expand Down Expand Up @@ -1647,7 +1647,7 @@ func TestIterateContractsByCodeWithMigration(t *testing.T) {

type sudoMsg struct {
// This is a tongue-in-check demo command. This is not the intended purpose of Sudo.
// Here we show that some priviledged Go module can make a call that should never be exposed
// Here we show that some privileged Go module can make a call that should never be exposed
// to end users (via Tx/Execute).
//
// The contract developer can choose to expose anything to sudo. This functionality is not a true
Expand Down Expand Up @@ -1693,7 +1693,7 @@ func TestSudo(t *testing.T) {
// now the community wants to get paid via sudo
msg := sudoMsg{
// This is a tongue-in-check demo command. This is not the intended purpose of Sudo.
// Here we show that some priviledged Go module can make a call that should never be exposed
// Here we show that some privileged Go module can make a call that should never be exposed
// to end users (via Tx/Execute).
StealFunds: stealFundsMsg{
Recipient: community.String(),
Expand Down Expand Up @@ -2498,7 +2498,7 @@ func TestIteratorContractByCreator(t *testing.T) {
creatorAddr: mockAddress2,
contractsAddr: []string{gotAddr2.String(), gotAddr4.String(), gotAddr5.String()},
},
"contractAdress": {
"contractAddress": {
creatorAddr: gotAddr1,
contractsAddr: []string{gotAddr3.String()},
},
Expand Down
Loading
Loading