CosmWasm / sylvia

CosmWasm smart contract framework
Apache License 2.0
93 stars 14 forks source link

warning: use of deprecated function `cosmwasm_std::to_binary`: use to_json_binary instead #395

Closed 99Kies closed 1 month ago

99Kies commented 2 months ago

how to solve this warning message?

my dependencies

[dependencies]
cosmwasm-schema = "1.3.1"
cosmwasm-std = "1.3.1"
cosmwasm-storage = "1.3.1"
cw-storage-plus = "1.1.0"
cw-utils = "1.0.2"
cw2 = "1.1.0"
schemars = "0.8.12"
serde = { version = "1.0.183", default-features = false, features = ["derive"] }
sylvia = "0.8.1"
thiserror = "1.0.44"

[dev-dependencies]
cw-multi-test = "0.16.2"
sylvia = {version = "0.8.1", features = ["mt"] }

warning log:

warning: use of deprecated function `cosmwasm_std::to_binary`: use to_json_binary instead
  --> src/contract.rs:49:1
   |
49 | #[contract]
   | ^^^^^^^^^^^
   |
   = note: `#[warn(deprecated)]` on by default
   = note: this warning originates in the attribute macro `contract` (in Nightly builds, run with -Z macro-backtrace for more info)
jawoznia commented 1 month ago

Check your Cargo.lock. Most likely you have there the newest compatible version of cosmwasm_std 1.5.5. Sylvia 0.8.1 uses the ^1.3 version as in your project.

You can safely ignore this warning, in following versions we switched from using the to_binary to to_json_binary. Unfortunately we cannot silence this warning since it's not related to the impl block, but rather the generated sv module.

To fix this, consider upgrading to the newest version of Sylvia:

https://crates.io/crates/sylvia/1.1.0 -> Uses CosmWasm 2 https://crates.io/crates/sylvia/0.10.1 -> Uses CosmWasm 1

We recommend using the 1.1.0 version, since CosmWasm 2 contracts can be used on chains using CosmWasm 1.

jawoznia commented 1 month ago

@kulikthebird we can consider adding the ability to forward attributes to generated modules.