Skip to content

Commit 5c46e2d

Browse files
authored
Merge pull request #51 from scrtlabs/cosmwasm-v1.0
Cosmwasm v1.0
2 parents 0d5f2bf + 284a56b commit 5c46e2d

35 files changed

+1457
-1414
lines changed

.github/workflows/Static.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
rust: [stable]
1414
make:
1515
- name: Clippy
16-
task: "cargo clippy"
16+
task: "cargo clippy --all --all-features -- -D warnings"
1717
- name: Unit tests
1818
task: "cargo test --all --all-features"
1919
include:

Releases.md

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
# Release notes for the Secret Toolkit
22

3+
## v0.6.0
4+
5+
This release upgrades all `secret-toolkit` packages to be compatible with Cosmwasm v1.0 (Secret Network v1.4).
6+
The APIs remains the same, but it is necessary to upgrade the contract's `cosmwasm` dependencies to `v1.0.0`.
7+
8+
### Breaking
9+
10+
- This version will not work with `cosmwasm v0.10`. It is necessary to upgrade to `cosmwasm v1` in order to use this release.
11+
312
## v0.5.0
13+
414
This release includes some minor fixed to the storage package which required some breaking changes.
515
We are releasing these breaking changes because we reached the conclusion that the current interfaces
616
are prone to bugs, or inefficient. Unless you are using these specific interfaces, you should be able to upgrade from 0.4 without issues.
717

818
### Breaking
19+
920
- Removed the implementations of Clone for storage types which are not useful and may cause data corruption if used incorrectly.
1021
- Changed `Keymap::insert` to take the item by reference rather than by value. This should reduce the cost of calling that function by avoiding cloning.
1122

1223
### Features
24+
1325
- Changed the implementation of the `add_prefix` methods in the storage package to use length prefixing, which should help avoid namespace collisions.
1426

1527
## secret-toolkit-storage v0.4.2
@@ -65,28 +77,28 @@ A full guide to using the new `storage` types can be found
6577
* docs.rs documentation now includes all sub-crates.
6678
* BUGFIX: `secret-toolkit::snip721::Metadata` was severely out of date with the SNIP-721 specification, and not useful.
6779
It is now compatible with deployed SNIP-721 contracts.
68-
* Added `types` module under the `util` package, to standardize often used types.
69-
* Added `secret-toolkit::viewing_key`, which can be imported by enabling the `viewing-key` feature.
70-
* Added `secret-toolkit::permit::PubKey::canonical_address()`.
71-
* Types in `secret-toolkit::permit::Permit` are now generic over the type of permissions they accept.
72-
* Added the `maxheap` type to the incubator.
73-
* Added `secret-toolkit::utils::feature_toggle` which allow managing feature flags in your contract.
80+
- Added `types` module under the `util` package, to standardize often used types.
81+
- Added `secret-toolkit::viewing_key`, which can be imported by enabling the `viewing-key` feature.
82+
- Added `secret-toolkit::permit::PubKey::canonical_address()`.
83+
- Types in `secret-toolkit::permit::Permit` are now generic over the type of permissions they accept.
84+
- Added the `maxheap` type to the incubator.
85+
- Added `secret-toolkit::utils::feature_toggle` which allow managing feature flags in your contract.
7486

7587
### Breaking
7688

7789
* `secret-toolkit::permit::validate()` Now supports validating any type of Cosmos address.
7890
Interface changes: Now takes a reference to the current token address instead
7991
of taking it by value and an optional hrp string.
8092
In addition, it returns a String and not HumanAddr.
81-
* Renamed `secret-toolkit::permit::Permission` to `secret-toolkit::permit::TokenPermission`.
82-
* `secret-toolkit-crypto` now has features `["hash", "rng" and "ecc-secp256k1"]` which are all off by default - enable those you need.
83-
* `secret-toolkit-crypto::secp256k1::PublicKey::parse` now returns `StdResult<Self>`.
84-
* Changes to `secret-toolkit::crypto::secp256k1::PrivateKey::sign`:
85-
* The `data` argument is now any slice of bytes, and not the hash of a slice of data.
86-
* the `Api` from `deps.api` is now required as the second argument as we now use the precompiled implementation.
87-
* Changes to `secret-toolkit::crypto::secp256k1::PublicKey::verify`:
88-
* the `Api` from `deps.api` is now required as the third argument as we now use the precompiled implementation.
89-
* `secret-toolkit-incubator` now has features `["cashmap", "generational-store"]` which are all off by default.
93+
- Renamed `secret-toolkit::permit::Permission` to `secret-toolkit::permit::TokenPermission`.
94+
- `secret-toolkit-crypto` now has features `["hash", "rng" and "ecc-secp256k1"]` which are all off by default - enable those you need.
95+
- `secret-toolkit-crypto::secp256k1::PublicKey::parse` now returns `StdResult<Self>`.
96+
- Changes to `secret-toolkit::crypto::secp256k1::PrivateKey::sign`:
97+
- The `data` argument is now any slice of bytes, and not the hash of a slice of data.
98+
- the `Api` from `deps.api` is now required as the second argument as we now use the precompiled implementation.
99+
- Changes to `secret-toolkit::crypto::secp256k1::PublicKey::verify`:
100+
- the `Api` from `deps.api` is now required as the third argument as we now use the precompiled implementation.
101+
- `secret-toolkit-incubator` now has features `["cashmap", "generational-store"]` which are all off by default.
90102

91103
## v0.2.0
92104

@@ -103,11 +115,11 @@ This version is also the first released to [crates.io](https://crates.io)!
103115
which are wrappers that automatically deserializes base64 strings to `T`.
104116
It can be used in message types' fields instead of `Binary` when the contents of the string
105117
should have more specific contents.
106-
* Added `storage::DequeStore` - Similar to `AppendStore` but allows pushing and popping on both ends
107-
* Added the `secret-toolkit::incubator` package intended for experimental features. It contains:
108-
* `CashMap` - A hashmap like storage abstraction
109-
* `GenerationalIndex` - A generational index storage abstraction
110-
* The various subpackages can now be selected using feature flags. The default flags are `["serialization", "snip20", "snip721", "storage", "utils"]`
118+
- Added `storage::DequeStore` - Similar to `AppendStore` but allows pushing and popping on both ends
119+
- Added the `secret-toolkit::incubator` package intended for experimental features. It contains:
120+
- `CashMap` - A hashmap like storage abstraction
121+
- `GenerationalIndex` - A generational index storage abstraction
122+
- The various subpackages can now be selected using feature flags. The default flags are `["serialization", "snip20", "snip721", "storage", "utils"]`
111123
while `["crypto", "permit", "incubator"]` are left disabled by default.
112124

113125
## v0.1.1
@@ -118,16 +130,16 @@ This version is also the first released to [crates.io](https://crates.io)!
118130

119131
This is the first release of `secret-toolkit`. It supports:
120132

121-
* `secret-toolkit::snip20` - Helper types and functions for interaction with
133+
- `secret-toolkit::snip20` - Helper types and functions for interaction with
122134
SNIP-20 contracts.
123-
* `secret-toolkit::snip721` - Helper types and functions for interaction with
135+
- `secret-toolkit::snip721` - Helper types and functions for interaction with
124136
SNIP-721 contracts.
125-
* `secret-toolkit::crypto` - Wrappers for known-to-work crypto primitives from
137+
- `secret-toolkit::crypto` - Wrappers for known-to-work crypto primitives from
126138
ecosystem libraries. We include implementations for Sha256, Secp256k1 keys,
127139
and ChaChaRng.
128-
* `secret-toolkit::storage` - Types implementing useful storage managements
140+
- `secret-toolkit::storage` - Types implementing useful storage managements
129141
techniques: `AppendStore` and `TypedStore`, using `bincode2` by default.
130-
* `secret-toolkit::serialization` - marker types for overriding the storage
142+
- `secret-toolkit::serialization` - marker types for overriding the storage
131143
format used by types in `secret-toolkit::storage`. `Json` and `Bincode2`.
132144
* `secret-toolkit::utils` - General utilities for writing contract code.
133145
* `padding` - tools for padding queries and responses.

packages/crypto/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secret-toolkit-crypto"
3-
version = "0.3.0"
3+
version = "0.6.0"
44
edition = "2018"
55
authors = ["SCRT Labs <[email protected]>"]
66
license-file = "../../LICENSE"
@@ -23,7 +23,7 @@ rand_chacha = { version = "0.2.2", default-features = false, optional = true }
2323
rand_core = { version = "0.5.1", default-features = false, optional = true }
2424
sha2 = { version = "0.9.1", default-features = false, optional = true }
2525
secp256k1 = { version = "0.21.3", optional = true }
26-
cosmwasm-std = { package = "secret-cosmwasm-std", version = "0.10" }
26+
cosmwasm-std = { package = "secret-cosmwasm-std", version = "1.0.0" }
2727

2828
[dev-dependencies]
2929
secp256k1-test = { package = "secp256k1", version = "0.17", features = [

packages/crypto/src/secp256k1.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,20 @@ mod tests {
112112
}
113113

114114
#[test]
115-
#[ignore] // Crypto functions are not implemented in `MockApi`
116115
fn test_sign() {
117116
let s = Secp256k1::new();
118117
let (secp_privkey, _) = s.generate_keypair(&mut thread_rng());
119-
let mock_api = MockApi::new(20);
118+
let mock_api = MockApi::default();
120119

121120
let mut privkey = [0u8; PRIVATE_KEY_SIZE];
122121
privkey.copy_from_slice(&secp_privkey[..]);
123122

124-
let data = sha_256(b"test");
123+
let data = b"test";
124+
let data_hash = sha_256(data);
125125
let pk = PrivateKey::parse(&privkey).unwrap();
126-
let signature = pk.sign(&data, mock_api);
126+
let signature = pk.sign(data, mock_api);
127127

128128
let pubkey = pk.pubkey();
129-
assert!(pubkey.verify(&data, signature, mock_api));
129+
assert!(pubkey.verify(&data_hash, signature, mock_api));
130130
}
131131
}

packages/incubator/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secret-toolkit-incubator"
3-
version = "0.4.0"
3+
version = "0.6.0"
44
edition = "2018"
55
authors = ["SCRT Labs <[email protected]>"]
66
license-file = "../../LICENSE"
@@ -15,9 +15,9 @@ all-features = true
1515

1616
[dependencies]
1717
serde = { version = "1.0", optional = true }
18-
cosmwasm-std = { package = "secret-cosmwasm-std", version = "0.10", optional = true }
19-
cosmwasm-storage = { package = "secret-cosmwasm-storage", version = "0.10", optional = true }
20-
secret-toolkit-serialization = { version = "0.3", path = "../serialization", optional = true }
18+
cosmwasm-std = { package = "secret-cosmwasm-std", version = "1.0.0", optional = true }
19+
cosmwasm-storage = { package = "secret-cosmwasm-storage", version = "1.0.0", optional = true }
20+
secret-toolkit-serialization = { version = "0.6", path = "../serialization", optional = true }
2121

2222
[features]
2323
generational-store = ["secret-toolkit-serialization", "serde", "cosmwasm-std"]

0 commit comments

Comments
 (0)