Skip to content

Commit 17707be

Browse files
authored
Merge pull request #2330 from samdotola/main
fix typos
2 parents 2e23bfb + aacf4c0 commit 17707be

File tree

3 files changed

+47
-47
lines changed

3 files changed

+47
-47
lines changed

MIGRATING.md

+22-22
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ major releases of `cosmwasm`. Note that you can also view the
148148
+CosmosMsg::Any(AnyMsg { type_url, value })
149149
```
150150

151-
- Replace all direct construction of `StdError` with use of the corresponding
152-
constructor:
151+
- Replace all direct construction of `StdError` with the use of the
152+
corresponding constructor:
153153

154154
```diff
155155
-StdError::GenericErr { msg }
@@ -259,7 +259,7 @@ major releases of `cosmwasm`. Note that you can also view the
259259

260260
The payload data will then be available in the new field `Reply.payload` in
261261
the `reply` entry point. This functionality is an optional addition introduced
262-
in 2.0. To keep the CosmWasm 1.x behaviour, just set payload to
262+
in 2.0. To keep the CosmWasm 1.x behavior, just set payload to
263263
`Binary::default()`.
264264

265265
- In test code, replace calls to `mock_info` with `message_info`. This takes a
@@ -393,7 +393,7 @@ major releases of `cosmwasm`. Note that you can also view the
393393
# ...
394394
```
395395

396-
- There are changes to how we generate schemas, resulting in less boilerplace
396+
- There are changes to how we generate schemas, resulting in less boilerplate
397397
maintenance for smart contract devs. Old contracts will continue working for a
398398
while, but it's highly recommended to migrate now.
399399

@@ -570,9 +570,9 @@ arbitrary ones.
570570
annotations. See the [0.13 -> 0.14 entry](#013---014) where `#[entry_point]`
571571
was introduced.
572572

573-
- If your chain provides a custom queries, add the custom query type as a
574-
generic argument to `cosmwasm_std::Deps`, `DepsMut`, `OwnedDeps` and
575-
`QuerierWrapper`. Otherwise it defaults to `Empty`. E.g.
573+
- If your chain provides a custom query, add the custom query type as a generic
574+
argument to `cosmwasm_std::Deps`, `DepsMut`, `OwnedDeps` and `QuerierWrapper`.
575+
Otherwise, it defaults to `Empty`. E.g.
576576

577577
```diff
578578
#[entry_point]
@@ -1313,30 +1313,30 @@ arbitrary ones.
13131313
which a compact binary representation is desired. For JSON state this does not
13141314
save much data (e.g. the bech32 address
13151315
cosmos1pfq05em6sfkls66ut4m2257p7qwlk448h8mysz takes 45 bytes as direct ASCII
1316-
and 28 bytes when its canonical representation is base64 encoded). For fixed
1317-
length database keys `CanonicalAddr` remains handy though.
1316+
and 28 bytes when its canonical representation is base64 encoded). For
1317+
fixed-length database keys `CanonicalAddr` remains handy though.
13181318

13191319
- Replace `StakingMsg::Withdraw` with `DistributionMsg::SetWithdrawAddress` and
13201320
`DistributionMsg::WithdrawDelegatorReward`. `StakingMsg::Withdraw` was a
13211321
shorthand for the two distribution messages. However, it was unintuitive
1322-
because it did not set the address for one withdraw only but for all following
1323-
withdrawls. Since withdrawls are [triggered by different
1322+
because it did not set the address for one withdrawal only but for all
1323+
following withdrawals. Since withdrawals are [triggered by different
13241324
events][distribution docs] such as validators changing their commission rate,
13251325
an address that was set for a one-time withdrawal would be used for future
1326-
withdrawls not considered by the contract author.
1326+
withdrawals not considered by the contract author.
13271327

1328-
If the contract never set a withdraw address other than the contract itself
1328+
If the contract never set a withdrawal address other than the contract itself
13291329
(`env.contract.address`), you can simply replace `StakingMsg::Withdraw` with
13301330
`DistributionMsg::WithdrawDelegatorReward`. It is then never changed from the
1331-
default. Otherwise you need to carefully track what the current withdraw
1332-
address is. A one-time change can be implemented by emitted 3 messages:
1331+
default. Otherwise, you need to carefully track what the current withdrawal
1332+
address is. A one-time change can be implemented by emitting 3 messages:
13331333

13341334
1. `SetWithdrawAddress { address: recipient }` to temporarily change the
13351335
recipient
13361336
2. `WithdrawDelegatorReward { validator }` to do a manual withdrawal from the
13371337
given validator
13381338
3. `SetWithdrawAddress { address: env.contract.address.into() }` to change it
1339-
back for all future withdrawls
1339+
back for all future withdrawals
13401340

13411341
[distribution docs]: https://docs.cosmos.network/v0.42/modules/distribution/
13421342

@@ -1534,7 +1534,7 @@ arbitrary ones.
15341534
}
15351535
```
15361536

1537-
Once you got familiar with the concept, you can create different error types
1537+
Once you get familiar with the concept, you can create different error types
15381538
for each of the contract's functions.
15391539

15401540
You can also try a different error library than
@@ -1786,8 +1786,8 @@ Contract code and uni tests:
17861786
- `cosmwasm_storage::get_with_prefix`, `cosmwasm_storage::set_with_prefix`,
17871787
`cosmwasm_storage::RepLog::commit`, `cosmwasm_std::ReadonlyStorage::get`,
17881788
`cosmwasm_std::ReadonlyStorage::range`, `cosmwasm_std::Storage::set` and
1789-
`cosmwasm_std::Storage::remove` now return the value directly that was wrapped
1790-
in a result before.
1789+
`cosmwasm_std::Storage::remove` now returns the value directly that was
1790+
wrapped in a result before.
17911791
- Error creator functions are now in type itself, e.g.
17921792
`StdError::invalid_base64` instead of `invalid_base64`. The free functions are
17931793
deprecated and will be removed before 1.0.
@@ -1876,7 +1876,7 @@ Contract Code:
18761876

18771877
- Complete overhaul of `cosmwasm::Error` into `cosmwasm_std::StdError`:
18781878
- Auto generated snafu error constructor structs like `NotFound`/`ParseErr`/…
1879-
have been privatized in favour of error generation helpers like
1879+
have been privatized in favor of error generation helpers like
18801880
`not_found`/`parse_err`/…
18811881
- All error generator functions now return errors instead of results, such
18821882
that e.g. `return unauthorized();` becomes `return Err(unauthorized());`
@@ -1911,7 +1911,7 @@ Both:
19111911
- `dependencies` was renamed to `mock_dependencies`. `mock_dependencies` and
19121912
`mock_instance` take a 2nd argument to set the contract balance (visible for
19131913
the querier). If you need to set more balances, use `mock_XX_with_balances`.
1914-
The follow code block explains:
1914+
The following code block explains:
19151915

19161916
```rust
19171917
// before: balance as last arg in mock_env
@@ -1933,7 +1933,7 @@ Integration Tests:
19331933
- Before:
19341934
`match err { ContractResult::Err(msg) => assert_eq!(msg, "Unauthorized"), ... }`
19351935
- After: `match err { Err(StdError::Unauthorized{ .. }) => {}, ... }`
1936-
- Remove all imports / use of `ContractResult`
1936+
- Remove all imports/use of `ContractResult`
19371937
- You must specify `CosmosMsg::Native` type when calling
19381938
`cosmwasm_vm::testing::{handle, init}`. You will want to
19391939
`use cosmwasm_std::{HandleResult, InitResult}` or

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ repo.
129129

130130
We also recommend you review our [documentation site](https://book.cosmwasm.com)
131131
which contains a few tutorials to guide you in building your first contracts.
132-
You can find past recordings of hackathon / conference workshops and
133-
presentations on our [YouTube channel](https://www.youtube.com/@CosmWasm), or
132+
You can find past recordings of hackathon/conference workshops and presentations
133+
on our [YouTube channel](https://www.youtube.com/@CosmWasm), or
134134
[join our Discord server](https://chat.cosmwasm.com) to ask for help.
135135

136136
## Minimum Supported Rust Version (MSRV)
@@ -190,7 +190,7 @@ extern "C" fn ibc_packet_ack(env_ptr: u32, msg_ptr: u32) -> u32;
190190
extern "C" fn ibc_packet_timeout(env_ptr: u32, msg_ptr: u32) -> u32;
191191
```
192192

193-
`allocate`/`deallocate` allow the host to manage data within the Wasm VM. If
193+
`allocate` and `deallocate` allow the host to manage data within the Wasm VM. If
194194
you're using Rust, you can implement them by simply
195195
[re-exporting them from cosmwasm::exports](https://github.com/CosmWasm/cosmwasm/blob/v0.6.3/contracts/hackatom/src/lib.rs#L5).
196196
`instantiate`, `execute` and `query` must be defined by your contract.
@@ -298,7 +298,7 @@ pub struct Region {
298298
## Implementing the Smart Contract
299299

300300
If you followed the [instructions above](#Creating-a-smart-contract), you should
301-
have a runable smart contract. You may notice that all of the Wasm exports are
301+
have a runnable smart contract. You may notice that all of the Wasm exports are
302302
taken care of by `lib.rs`, which you shouldn't need to modify. What you need to
303303
do is simply look in `contract.rs` and implement `instantiate` and `execute`
304304
functions, defining your custom `InstantiateMsg` and `ExecuteMsg` structs for

SEMANTICS.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ semantics apply to any other _mutating_ action - `instantiate`, `migrate`,
1616

1717
Before looking at CosmWasm, we should look at the (somewhat under-documented)
1818
semantics enforced by the blockchain framework we integrate with - the
19-
[Cosmos SDK](https://v1.cosmos.network/sdk). It is based upon the
19+
[Cosmos SDK](https://v1.cosmos.network/sdk). It is based on the
2020
[Tendermint BFT](https://tendermint.com/core/) Consensus Engine. Let us first
21-
look how they process transactions before they arrive in CosmWasm (and after
21+
look at how they process transactions before they arrive in CosmWasm (and after
2222
they leave).
2323

2424
First, the Tendermint engine will seek 2/3+ consensus on a list of transactions
@@ -38,7 +38,7 @@ The Cosmos SDK `BaseApp` handles each transaction in an isolated context. It
3838
first verifies all signatures and deducts the gas fees. It sets the "Gas Meter"
3939
to limit the execution to the amount of gas paid for by the fees. Then it makes
4040
an isolated context to run the transaction. This allows the code to read the
41-
current state of the chain (after the last transaction finished), but it only
41+
current state of the chain (after the last transaction is finished), but it only
4242
writes to a cache, which may be committed or rolled back on error.
4343

4444
A transaction may consist of multiple messages and each one is executed in turn
@@ -116,7 +116,7 @@ to be provable and can return some essential state (although in general client
116116
apps rely on Events more). This result is more commonly used to pass results
117117
between contracts or modules in the sdk. Note that the `ResultHash` includes
118118
only the `Code` (non-zero meaning error) and `Result` (data) from the
119-
transaction. Events and log are available via queries, but there are no
119+
transaction. Events and logs are available via queries, but there are no
120120
light-client proofs possible.
121121

122122
If the contract sets `data`, this will be returned in the `result` field.
@@ -137,7 +137,7 @@ The final result looks like this to the client:
137137

138138
### Dispatching Messages
139139

140-
Now let's move onto the `messages` field. Some contracts are fine only talking
140+
Now let's move on to the `messages` field. Some contracts are fine only talking
141141
with themselves, such as a cw20 contract just adjusting its balances on
142142
transfers. But many want to move tokens (native or cw20) or call into other
143143
contracts for more complex actions. This is where messages come in. We return
@@ -169,8 +169,8 @@ executed in `x/wasm` _with the permissions of the contract_ (meaning
169169
`info.sender` will be the contract not the original caller). If they return
170170
success, they will emit a new event with the custom attributes, the `data` field
171171
will be ignored, and any messages they return will also be processed. If they
172-
return an error, the parent call will return an error, thus rolling back state
173-
of the whole transaction.
172+
return an error, the parent call will return an error, thus rolling back the
173+
state of the whole transaction.
174174

175175
Note that the messages are executed
176176
[_depth-first_](https://en.wikipedia.org/wiki/Depth-first_search). This means if
@@ -192,12 +192,12 @@ graph TD;
192192
```
193193

194194
This may be hard to understand at first. "Why can't I just call another
195-
contract?", you may ask. However, we do this to prevent one of most widespread
196-
and hardest to detect security holes in Ethereum contracts - reentrancy. We do
197-
this by following the actor model, which doesn't nest function calls, but
198-
returns messages that will be executed later. This means all state that is
199-
carried over between one call and the next happens in storage and not in memory.
200-
For more information on this design, I recommend you read
195+
contract?", you may ask. However, we do this to prevent one of the most
196+
widespread and hardest to detect security holes in Ethereum contracts -
197+
reentrancy. We do this by following the actor model, which doesn't nest function
198+
calls, but returns messages that will be executed later. This means all state
199+
that is carried over between one call and the next happens in storage and not in
200+
memory. For more information on this design, I recommend you read
201201
[our docs on the Actor Model](https://book.cosmwasm.com/actor-model.html).
202202

203203
### Submessages
@@ -244,15 +244,15 @@ pub enum ReplyOn {
244244
}
245245
```
246246

247-
What are the semantics of a submessage execution. First, we create a
247+
What are the semantics of a submessage execution? First, we create a
248248
sub-transaction context around the state, allowing it to read the latest state
249249
written by the caller, but write to yet-another cache. If `gas_limit` is set, it
250250
is sandboxed to how much gas it can use until it aborts with `OutOfGasError`.
251251
This error is caught and returned to the caller like any other error returned
252252
from contract execution (unless it burned the entire gas limit of the
253253
transaction). What is more interesting is what happens on completion.
254254

255-
If it return success, the temporary state is committed (into the caller's
255+
If it returns success, the temporary state is committed (into the caller's
256256
cache), and the `Response` is processed as normal (an event is added to the
257257
current EventManager, messages and submessages are executed). Once the
258258
`Response` is fully processed, this may then be intercepted by the calling
@@ -264,12 +264,12 @@ intercepted by the calling contract (for `ReplyOn::Always` and
264264
transaction_
265265

266266
Note, that error doesn't abort the whole transaction _if and only if_ the
267-
`reply` is called - so in case of `ReplyOn::Always` and `ReplyOn::Error`. If the
268-
submessage is called with `ReplyOn::Success` (or `ReplyOn::Never`, which makes
269-
it effectively a normal message), the error in subsequent call would result in
270-
failing whole transaction and not commit the changes for it. The rule here is as
271-
follows: if for any reason you want your message handling to succeed on
272-
submessage failure, you always have to reply on failure.
267+
`reply` is called - so in the case of `ReplyOn::Always` and `ReplyOn::Error`. If
268+
the submessage is called with `ReplyOn::Success` (or `ReplyOn::Never`, which
269+
makes it effectively a normal message), the error in subsequent call would
270+
result in failing the whole transaction and not committing the changes for it.
271+
The rule here is as follows: if for any reason you want your message handling to
272+
succeed on submessage failure, you always have to reply on failure.
273273

274274
Obviously - on the successful processing of sub-message, if the reply is not
275275
called (in particular `ReplyOn::Error`), the whole transaction is assumed to

0 commit comments

Comments
 (0)