Skip to content

Commit

Permalink
Merge pull request #1864 from CosmWasm/1845-float-support
Browse files Browse the repository at this point in the history
Float support
  • Loading branch information
chipshort authored Sep 26, 2023
2 parents 1e1eb5e + 5538397 commit 2009587
Show file tree
Hide file tree
Showing 27 changed files with 1,440 additions and 254 deletions.
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
- 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

0 comments on commit 2009587

Please sign in to comment.