Skip to content

Commit

Permalink
Merge branch 'main' into tkulik/update_wasmer
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed Sep 23, 2024
2 parents 4e2c27b + 82f3567 commit 1856990
Show file tree
Hide file tree
Showing 140 changed files with 3,359 additions and 496 deletions.
29 changes: 29 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ workflows:
- contract_ibc_callbacks
- contract_ibc_reflect
- contract_ibc_reflect_send
- contract_nested_contracts
- contract_queue
- contract_reflect
- contract_staking
Expand Down Expand Up @@ -763,6 +764,34 @@ jobs:
- target/wasm32-unknown-unknown/release/deps
key: cargocache-v2-contract_floaty-rust:1.74-{{ checksum "Cargo.lock" }}

contract_nested_contracts:
docker:
- image: rust:1.75
environment:
RUST_BACKTRACE: 1
working_directory: ~/cosmwasm/contracts/nested-contracts
steps:
- checkout:
path: ~/cosmwasm
- run:
name: Version information
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-v2-contract_nested_contracts-rust:1.75-{{ checksum "Cargo.lock" }}
- check_contract:
min_version: "1.4"
- save_cache:
paths:
- /usr/local/cargo/registry
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
- target/wasm32-unknown-unknown/release/.fingerprint
- target/wasm32-unknown-unknown/release/build
- target/wasm32-unknown-unknown/release/deps
key: cargocache-v2-contract_nested_contracts-rust:1.75-{{ checksum "Cargo.lock" }}

contract_queue:
docker:
- image: rust:1.74
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,17 @@ jobs:

# Get latest version from https://autofix.ci/setup
- uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a

autofix-toml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install taplo
run: |
curl -fsSL https://github.com/tamasfe/taplo/releases/latest/download/taplo-full-linux-x86_64.gz \
| gzip -d - | install -m 755 /dev/stdin /usr/local/bin/taplo
- run: |
taplo fmt
# Get latest version from https://autofix.ci/setup
- uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a
26 changes: 26 additions & 0 deletions .github/workflows/toml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "TOML checks"

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

jobs:
fmt-check:
name: "Formatting"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install taplo
run: |
curl -fsSL https://github.com/tamasfe/taplo/releases/latest/download/taplo-full-linux-x86_64.gz \
| gzip -d - | install -m 755 /dev/stdin /usr/local/bin/taplo
- run: |
taplo fmt
CHANGES_IN_REPO=$(git status --porcelain)
if [[ -n "$CHANGES_IN_REPO" ]]; then
exit 1
fi
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
3 changes: 3 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[formatting]
indent_string = " "
reorder_arrays = true
4 changes: 2 additions & 2 deletions CHANGELOG-pre1.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ and this project adheres to
with this change, the `backtraces` feature now requires Rust nightly.
- Rename `StdError::ParseErr::source` to `StdError::ParseErr::source_type` and
`StdError::SerializeErr::target` to `StdError::SerializeErr::target_type` to
work around speacial treatment of the field name `source` in thiserror.
work around special treatment of the field name `source` in thiserror.
- Rename `Extern` to `Deps` to unify naming.
- Simplify ownership of calling `handle`, etc. with `Deps` and `DepsMut` struct
that just contains references (`DepsMut` has `&mut Storage` otherwise the
Expand Down Expand Up @@ -1259,7 +1259,7 @@ https://github.com/CosmWasm/cosmwasm/issues/451).
for mock storage and copying a stateless bridge for the external storage,
which are different semantics.
- Remove public `cosmwasm::imports::dependencies`. A user of this library does
not need to call this explicitely. Dependencies are created internally and
not need to call this explicitly. Dependencies are created internally and
passed as an argument in `exports::do_init`, `exports::do_handle` and
`exports::do_query`.
- Make `ExternalStorage` not `Clone`able anymore. This does not copy any data,
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ and this project adheres to
- cosmwasm-vm: Let `mock_env` return a contract address that is valid bech32 and
uses the same bech32 prefix as `MockApi`; Change `MOCK_CONTRACT_ADDR` value to
match the contract address from `mock_env`. ([#2211])
- cosmwasm-derive: Automatically detect whether the package is a dependency or
the primary package, only expanding entrypoints for the primary package. This
effectively deprecates the usage of the `library` feature pattern. ([#2246])
- cosmwasm-std: Deprecate `BankQuery::AllBalances` and `IbcQuery::ListChannels`.
Both are inherently problematic to use because the returned entries are
unbounded. ([#2247])
Expand All @@ -54,6 +57,7 @@ and this project adheres to

[#2118]: https://github.com/CosmWasm/cosmwasm/pull/2118
[#2211]: https://github.com/CosmWasm/cosmwasm/issues/2211
[#2246]: https://github.com/CosmWasm/cosmwasm/pull/2246
[#2247]: https://github.com/CosmWasm/cosmwasm/pull/2247
[#2255]: https://github.com/CosmWasm/cosmwasm/pull/2255

Expand Down Expand Up @@ -771,7 +775,7 @@ and this project adheres to
- all: Bump a few dependency versions to make the codebase compile with
`-Zminimal-versions` ([#1465]).
- cosmwasm-profiler: Package was removed 🪦. It served its job showing us that
we cannot properly measure different runtimes for differet Wasm opcodes.
we cannot properly measure different runtimes for different Wasm opcodes.
- cosmwasm-schema: schema generation is now locked to produce strictly
`draft-07` schemas
- cosmwasm-schema: `QueryResponses` derive now sets the `JsonSchema` trait bound
Expand Down
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
members = ["packages/*"]
exclude = ["contracts"]

# Resolver has to be set explicitely in workspaces
# Resolver has to be set explicitly in workspaces
# due to https://github.com/rust-lang/cargo/issues/9956
resolver = "2"

Expand All @@ -11,7 +11,10 @@ version = "2.1.3"

[workspace.dependencies]
schemars = "0.8.4"
serde = { version = "1.0.192", default-features = false, features = ["derive", "alloc"] }
serde = { version = "1.0.192", default-features = false, features = [
"alloc",
"derive",
] }

[workspace.metadata.release]
shared-version = true
Expand Down
4 changes: 2 additions & 2 deletions IBC.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub enum IbcMsg {
/// We cannot select the port_id, this is whatever the local chain has bound the ibctransfer
/// module to.
Transfer {
/// exisiting channel to send the tokens over
/// existing channel to send the tokens over
channel_id: String,
/// address on the remote chain to receive these tokens
to_address: String,
Expand Down Expand Up @@ -385,7 +385,7 @@ produced 3 suggestions on how to handle errors and rollbacks _inside
`submessage` and capture the error. This approach requires we use _exactly
one_ submessage. If we have multiple, we may commit #1 and rollback #2 (see
example 3 for that case). The main point is moving `messages` to
`submessages` and reformating the error in `reply`. Note that if you set the
`submessages` and reformatting the error in `reply`. Note that if you set the
`Response.data` field in `reply` it will override the acknowledgement
returned from the parent call. (See
[bottom of reply section](./SEMANTICS.md#handling-the-reply)). You can see a
Expand Down
8 changes: 4 additions & 4 deletions MIGRATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ arbitrary ones.

- The block time in `env.block.time` is now a `Timestamp` which stores
nanosecond precision. `env.block.time_nanos` was removed. If you need the
compnents as before, use
components as before, use
```rust
let seconds = env.block.time.nanos() / 1_000_000_000;
let nsecs = env.block.time.nanos() % 1_000_000_000;
Expand Down Expand Up @@ -1456,7 +1456,7 @@ arbitrary ones.
- Contracts now support any custom error type `E: ToString + From<StdError>`.
Previously this has been `StdError`, which you can still use. However, you can
now create a much more structured error experience for your unit tests that
handels exactly the error cases of your contract. In order to get a convenient
handles exactly the error cases of your contract. In order to get a convenient
implementation for `ToString` and `From<StdError>`, we use the crate
[thiserror](https://crates.io/crates/thiserror), which needs to be added to
the contracts dependencies in `Cargo.toml`. To create the custom error, create
Expand Down Expand Up @@ -1492,8 +1492,8 @@ arbitrary ones.
- `fn handle`: `Result<HandleResponse, MyCustomError>`,
- `fn query`: `Result<Binary, MyCustomError>`.

If one of your funtions does not use the custom error, you can continue to use
`StdError` as before. I.e. you can have `handle` returning
If one of your functions does not use the custom error, you can continue to
use `StdError` as before. I.e. you can have `handle` returning
`Result<HandleResponse, MyCustomError>` and `query` returning
`StdResult<Binary>`.

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

[files]
extend-exclude = ["contracts/**/schema/**", "packages/crypto/**/*.json"]
14 changes: 11 additions & 3 deletions contracts/burner/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[package]
name = "burner"
version = "0.0.0"
authors = ["Ethan Frey <[email protected]>", "Simon Warta <[email protected]>"]
authors = [
"Ethan Frey <[email protected]>",
"Simon Warta <[email protected]>",
]
edition = "2021"
publish = false
license = "Apache-2.0"
Expand Down Expand Up @@ -31,9 +34,14 @@ cranelift = ["cosmwasm-vm/cranelift"]

[dependencies]
cosmwasm-schema = { path = "../../packages/schema" }
cosmwasm-std = { path = "../../packages/std", features = ["iterator", "cosmwasm_1_4"] }
cosmwasm-std = { path = "../../packages/std", features = [
"cosmwasm_1_4",
"iterator",
] }
schemars = "0.8.12"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }

[dev-dependencies]
cosmwasm-vm = { path = "../../packages/vm", default-features = false, features = ["iterator"] }
cosmwasm-vm = { path = "../../packages/vm", default-features = false, features = [
"iterator",
] }
2 changes: 1 addition & 1 deletion contracts/burner/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Then running `cargo integration-test` will validate we can properly call into that generated Wasm.
//!
//! You can easily convert unit tests to integration tests.
//! 1. First copy them over verbatum,
//! 1. First copy them over verbatim,
//! 2. Then change
//! let mut deps = mock_dependencies(20, &[]);
//! to
Expand Down
14 changes: 11 additions & 3 deletions contracts/crypto-verify/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,23 @@ cranelift = ["cosmwasm-vm/cranelift"]
[dependencies]
base64 = "0.22.0"
cosmwasm-schema = { path = "../../packages/schema" }
cosmwasm-std = { path = "../../packages/std", features = ["cosmwasm_2_1", "iterator"] }
cosmwasm-std = { path = "../../packages/std", features = [
"cosmwasm_2_1",
"iterator",
] }
hex = "0.4"
p256 = { version = "0.13.2", default-features = false, features = ["alloc", "ecdsa"] }
p256 = { version = "0.13.2", default-features = false, features = [
"alloc",
"ecdsa",
] }
rlp = "0.5"
schemars = "0.8.12"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
sha2 = "0.10"
sha3 = "0.10"

[dev-dependencies]
cosmwasm-vm = { path = "../../packages/vm", default-features = false, features = ["iterator"] }
cosmwasm-vm = { path = "../../packages/vm", default-features = false, features = [
"iterator",
] }
hex-literal = "0.4.1"
2 changes: 1 addition & 1 deletion contracts/crypto-verify/src/webauthn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub fn verify(
//
// - the length of the encoded bytes being correct
// - the point being an element of the curve
// - the conversion from the encoded coorinate to an affine point succeeding
// - the conversion from the encoded coordinate to an affine point succeeding
// - the affine point actually being a valid public key
// - the signature could actually exist like this for a secp256r1 ECDSA key
//
Expand Down
6 changes: 5 additions & 1 deletion contracts/cyberpunk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ cranelift = ["cosmwasm-vm/cranelift"]

[dependencies]
cosmwasm-schema = { path = "../../packages/schema" }
cosmwasm-std = { path = "../../packages/std", default-features = false, features = ["std", "abort", "cosmwasm_1_3"] }
cosmwasm-std = { path = "../../packages/std", default-features = false, features = [
"abort",
"cosmwasm_1_3",
"std",
] }
rust-argon2 = "2.1"
thiserror = "1.0.26"

Expand Down
4 changes: 2 additions & 2 deletions contracts/cyberpunk/schema/cyberpunk.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"instantiate": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InstantiateMsg",
"description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)",
"description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressible in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)",
"type": "object",
"additionalProperties": false
},
Expand Down Expand Up @@ -498,7 +498,7 @@
],
"properties": {
"index": {
"description": "The position of this transaction in the block. The first transaction has index 0.\n\nThis allows you to get a unique transaction indentifier in this chain using the pair (`env.block.height`, `env.transaction.index`).",
"description": "The position of this transaction in the block. The first transaction has index 0.\n\nThis allows you to get a unique transaction identifier in this chain using the pair (`env.block.height`, `env.transaction.index`).",
"type": "integer",
"format": "uint32",
"minimum": 0.0
Expand Down
2 changes: 1 addition & 1 deletion contracts/cyberpunk/schema/raw/instantiate.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InstantiateMsg",
"description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)",
"description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressible in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)",
"type": "object",
"additionalProperties": false
}
2 changes: 1 addition & 1 deletion contracts/cyberpunk/schema/raw/response_to_mirror_env.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
],
"properties": {
"index": {
"description": "The position of this transaction in the block. The first transaction has index 0.\n\nThis allows you to get a unique transaction indentifier in this chain using the pair (`env.block.height`, `env.transaction.index`).",
"description": "The position of this transaction in the block. The first transaction has index 0.\n\nThis allows you to get a unique transaction identifier in this chain using the pair (`env.block.height`, `env.transaction.index`).",
"type": "integer",
"format": "uint32",
"minimum": 0.0
Expand Down
2 changes: 1 addition & 1 deletion contracts/cyberpunk/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn execute_message_loop(env: Env) -> Result<Response, ContractError> {

#[allow(unused_variables)]
fn execute_allocate_large_memory(pages: u32) -> Result<Response, ContractError> {
// We create memory pages explicitely since Rust's default allocator seems to be clever enough
// We create memory pages explicitly since Rust's default allocator seems to be clever enough
// to not grow memory for unused capacity like `Vec::<u8>::with_capacity(100 * 1024 * 1024)`.
// Even with std::alloc::alloc the memory did now grow beyond 1.5 MiB.

Expand Down
4 changes: 3 additions & 1 deletion contracts/empty/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ cosmwasm-std = { path = "../../packages/std", features = ["iterator"] }
schemars = "0.8.12"

[dev-dependencies]
cosmwasm-vm = { path = "../../packages/vm", default-features = false, features = ["iterator"] }
cosmwasm-vm = { path = "../../packages/vm", default-features = false, features = [
"iterator",
] }
2 changes: 1 addition & 1 deletion contracts/empty/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Then running `cargo integration-test` will validate we can properly call into that generated Wasm.
//!
//! You can easily convert unit tests to integration tests.
//! 1. First copy them over verbatum,
//! 1. First copy them over verbatim,
//! 2. Then change
//! let mut deps = mock_dependencies(20, &[]);
//! to
Expand Down
4 changes: 3 additions & 1 deletion contracts/floaty/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ serde = { version = "1.0.103", default-features = false, features = ["derive"] }
rand_chacha = { version = "0.3.1", default-features = false }

[dev-dependencies]
cosmwasm-vm = { path = "../../packages/vm", default-features = false, features = ["iterator"] }
cosmwasm-vm = { path = "../../packages/vm", default-features = false, features = [
"iterator",
] }
2 changes: 1 addition & 1 deletion contracts/floaty/schema/floaty.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"instantiate": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InstantiateMsg",
"description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)",
"description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressible in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)",
"type": "object",
"additionalProperties": false
},
Expand Down
Loading

0 comments on commit 1856990

Please sign in to comment.