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

Float support #1864

Merged
merged 23 commits into from
Sep 26, 2023
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: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ workflows:
- contract_hackatom
- contract_ibc_reflect
- contract_ibc_reflect_send
- contract_floaty
# - contract_floaty # This contract needs nightly Rust to compile
chipshort marked this conversation as resolved.
Show resolved Hide resolved
- contract_queue
- contract_reflect
- contract_staking
Expand Down Expand Up @@ -1030,13 +1030,14 @@ jobs:
name: Build development contracts
command: |
echo "Building all contracts under ./contracts"
export GLOBIGNORE="./contracts/floaty/"
docker run --volumes-from with_code cosmwasm/rust-optimizer:0.12.13 ./contracts/*/
- run:
name: Check development contracts
command: |
echo "Checking all contracts under ./artifacts"
docker run --volumes-from with_code rust:1.67.0 \
/bin/bash -e -c 'export GLOBIGNORE="artifacts/floaty.wasm"; cd ./code; cargo run --bin cosmwasm-check artifacts/*.wasm'
/bin/bash -e -c 'cd ./code; cargo run --bin cosmwasm-check artifacts/*.wasm'
docker cp with_code:/code/artifacts .
- run:
name: Publish artifacts on GitHub
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ and this project adheres to
`to_{vec,binary}` in favor of `to_json_{vec,binary}` and `from_{slice,binary}`
in favor of `from_json`. ([#1886])
- cosmwasm-std: Add `SignedDecimal` and `SignedDecimal256` ([#1807]).
- cosmwasm-vm: Allow float operations with NaN canonicalization ([#1864]).

[#1854]: https://github.com/CosmWasm/cosmwasm/pull/1854
[#1861]: https://github.com/CosmWasm/cosmwasm/pull/1861
Expand All @@ -31,6 +32,7 @@ and this project adheres to
[#1870]: https://github.com/CosmWasm/cosmwasm/pull/1870
[#1886]: https://github.com/CosmWasm/cosmwasm/pull/1886
[#1807]: https://github.com/CosmWasm/cosmwasm/pull/1807
[#1864]: https://github.com/CosmWasm/cosmwasm/pull/1864

## [1.4.0] - 2023-09-04

Expand Down
6 changes: 6 additions & 0 deletions contracts/floaty/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"rust-analyzer.cargo.target": "wasm32-unknown-unknown",
"rust-analyzer.cargo.extraEnv": {
"RUSTFLAGS": "-C target-feature=+nontrapping-fptoint"
}
}
26 changes: 21 additions & 5 deletions contracts/floaty/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contracts/floaty/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ cosmwasm-schema = { path = "../../packages/schema" }
cosmwasm-std = { path = "../../packages/std" }
schemars = "0.8.3"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
thiserror = "1.0.26"
rand_chacha = { version = "0.3.1", default-features = false }

[dev-dependencies]
cosmwasm-vm = { path = "../../packages/vm", default-features = false, features = ["iterator"] }
13 changes: 13 additions & 0 deletions contracts/floaty/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Floaty Contract

This contract contains all WebAssembly floating point instructions. It is used
for testing the floating point support.

In order to compile it, you need a nightly version of Rust and enable the
`nontrapping-fptoint` target-feature. This allows the usage of
[some more conversion instructions](https://github.com/WebAssembly/spec/blob/main/proposals/nontrapping-float-to-int-conversion/Overview.md).
To do this, run:

```sh
RUSTFLAGS="-C link-arg=-s -C target-feature=+nontrapping-fptoint" cargo wasm
```
Loading
Loading