Skip to content

Commit 0321e5c

Browse files
authored
Merge pull request #1632 from CosmWasm/discourage-u128
Discourage the use of u128/i128 as message fields
2 parents 479178d + 28471aa commit 0321e5c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/MESSAGE_TYPES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Rust types as well as `cosmwasm_std` types and how they are encoded in JSON.
1414
| bool | `true` or `false` | `true` | |
1515
| u32/i32 | number | `123` | |
1616
| u64/i64 | number | `123456` | Supported in Rust and Go. Other implementations (`jq`, `JavaScript`) do not support the full uint64/int64 range. |
17-
| u128/i128 | string | `"340282366920938463463374607431768211455", "-2766523308300312711084346401884294402"` | |
17+
| u128/i128 | string | `"340282366920938463463374607431768211455", "-2766523308300312711084346401884294402"` | 🚫 Strongly discouraged because the JSON type in serde-json-wasm is wrong and will change. See [Dev Note #4: u128/i128 serialization][dev-note-4]. |
1818
| usize/isize | number | `123456` | 🚫 Don't use this type because it has a different size in unit tests (64 bit) and Wasm (32 bit). Also it tends to issue float instructions such that the contracts cannot be uploaded. |
1919
| String | string | `"foo"` |
2020
| &str | string | `"foo"` | 🚫 Unsuppored since message types must be owned (DeserializeOwned) |
@@ -41,5 +41,7 @@ Rust types as well as `cosmwasm_std` types and how they are encoded in JSON.
4141
[binary]: https://docs.rs/cosmwasm-std/1.1.1/cosmwasm_std/struct.Binary.html
4242
[hexbinary]:
4343
https://docs.rs/cosmwasm-std/1.1.1/cosmwasm_std/struct.HexBinary.html
44+
[dev-note-4]:
45+
https://medium.com/cosmwasm/dev-note-4-u128-i128-serialization-in-cosmwasm-90cb76784d44
4446

4547
[^1]: https://www.json.org/

0 commit comments

Comments
 (0)