The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.1.10 - 2023-05-08
- Querier error parsing ([#8]).
- Fix the
backtraces
feature ([#12]).
- Change crates names back to support
crates.io
, while creating a compatability crates to support native libraries ([#17], [#20]).
- Decimal/Uint 256/512 implementations.
- Support for
gas_evaporate()
([#13], [#14]). - Support for
FinalizeTx
([#15], ([#18])). - Support for SecretVRF ([#16]).
1.1.9 - 2022-12-06
- cosmwasm-schema: Fix type fully qualified path to symbol
QueryResponses
in macrocosmwasm_schema::generate_api!
(#1527).
1.1.8 - 2022-11-22f
- cosmwasm-schema: Fix type params on
QueryMsg
causing a compiler error when used with theQueryResponses
derive macro.
1.1.6 - 2022-11-16
- cosmwasm-std: Add
From
implementations to convert betweenCanonicalAddr
/Binary
as well asCanonicalAddr
/HexBinary
(#1463). - cosmwasm-std: Add
From
implementations to convertu8
arrays toCanonicalAddr
(#1463). - cosmwasm-std: Implement
PartialEq
betweenCanonicalAddr
andHexBinary
/Binary
(#1463).
- all: Bump a few dependency versions to make the codebase compile with
-Zminimal-versions
(#1465). - cosmwasm-profiler: Package was removed 🪦. It served its job showing us that we cannot properly measure different runtimes for differet Wasm opcodes.
- cosmwasm-schema: schema generation is now locked to produce strictly
draft-07
schemas - cosmwasm-schema:
QueryResponses
derive now sets theJsonSchema
trait bound on the generatedimpl
block. This allows the contract dev to not add aJsonSchema
trait bound on the type itself.
1.1.5 - 2022-10-17
- cosmwasm-std: Add
wrapping_add
,wrapping_sub
,wrapping_mul
andwrapping_pow
toUint256
/Uint512
. - cosmwasm-schema: Better error messaging when attempting to compile schema
generator for
wasm32
- cosmwasm-vm: In the
secp256k1_verify
,secp256k1_recover_pubkey
,ed25519_verify
anded25519_batch_verify
import implementations we now exit early if the gas left is not sufficient to perform the operation.
- cosmwasm-std: Remove
non_exhaustive
from IBC typesIbcChannelOpenMsg
,IbcChannelConnectMsg
andIbcChannelCloseMsg
in order to allow exhaustive matching over the possible scenarios without an unused fallback case (#1449).
1.1.4 - 2022-10-03
- cosmwasm-schema: Properly analyze schemas generated for
untagged
enums
1.1.3 - 2022-09-29
- cosmwasm-schema:
IntegrityError
is now public
1.1.2 - 2022-09-19
- cosmwasm-std: Add testing macro
assert_approx_eq!
for comparing two integers to be relatively close to each other (#1417). - cosmwasm-std: Add
HexBinary
which is likeBinary
but encodes to hex strings in JSON. AddStdError::InvalidHex
error case. (#1425)
- cosmwasm-vm: Bump
MODULE_SERIALIZATION_VERSION
to "v4" because the module serialization format changed between Wasmer 2.2 and 2.3 (#1426). - cosmwasm-schema: The
QueryResponses
derive macro now supportsQueryMsg
s with generics. (#1429)
1.1.1 - 2022-09-15
-
cosmwasm-schema: Using
QueryResponses
with aQueryMsg
containing a unit-like variant will no longer crash. The different variant types in Rust are:enum QueryMsg { UnitLike, Tuple(), Struct {}, }
It's still recommended to only use struct variants, even if there are no fields.
- cosmwasm-schema: It is no longer necessary to specify
serde
orschemars
as a dependency in order to makecosmwasm-schema
macros work.
1.1.0 - 2022-09-05
- cosmwasm-std: Implement PartialEq for
Binary
andu8
arrays. - cosmwasm-std: Add
Uint{64,128,256,512}::one
. - cosmwasm-std: Add
Uint{64,128,256,512}::abs_diff
andDecimal{,256}::abs_diff
(#1334). - cosmwasm-std: Implement
From<Decimal> for Decimal256
. - cosmwasm-std: Implement
Rem
/RemAssign
forDecimal
/Decimal256
. - cosmwasm-std: Implement
checked_add
/_sub
/_div
/_rem
forDecimal
/Decimal256
. - cosmwasm-std: Implement
pow
/saturating_pow
forDecimal
/Decimal256
. - cosmwasm-std: Implement
ceil
/floor
forDecimal
/Decimal256
. - cosmwasm-std: Implement
PartialEq
for reference on one side and owned value on the other for allUint
andDecimal
types - cosmwasm-std: Implement
saturating_add
/sub
/mul
forDecimal
/Decimal256
. - cosmwasm-std: Implement
BankQuery::Supply
to allow querying the total supply of a native token. In order to use this query in a contract, thecosmwasm_1_1
feature needs to be enabled for thecosmwasm_std
dependency. This makes the contract incompatible with chains running CosmWasm1.0
. (#1356) - cosmwasm-std: Implement
MIN
const value for allUint
andDecimal
types - cosmwasm-std: Implement
checked_div_euclid
forUint256
/Uint512
- cosmwasm-std: Add
QuerierWrapper::query_wasm_contract_info
- this is just a convenience helper for queryingWasmQuery::ContractInfo
. - cosmwasm-check: This is a new binary package that allows running various CosmWasm compatibility checks on compiled .wasm files. See https://crates.io/crates/cosmwasm-check for usage info.
- cosmwasm-vm/cosmwasm-profiler: Upgrade Wasmer to 2.3.0.
- cosmwasm-std: Enable the
abort
feature by default. This provides more helpful panic messages via a custom panic handler. - cosmwasm-std: Make
Decimal{,256}::DECIMAL_PLACES
a publicu32
value. - cosmwasm-crypto: Bumped
k256
0.10.4 -> 0.11
anddigest
0.9 -> 0.10
(#1374). - cosmwasm-vm: Rename features to capabilities, including
features_from_csv
tocapabilities_from_csv
;CacheOptions::supported_features
toCacheOptions::available_capabilities
;MockInstanceOptions::supported_features
toMockInstanceOptions::available_capabilities
Instance::required_features
toInstance::required_capabilities
AnalysisReport::required_features
toAnalysisReport::required_capabilities
.
- cosmwasm-vm: The
check_contract
example was deprecated. Please use the new crate cosmwasm-check instead (#1371).
1.0.0 - 2022-05-14
- cosmwasm-std: Export
DelegationResponse
(#1301). - cosmwasm-std: When the new
abort
feature is enabled, cosmwasm-std installs a panic handler that aborts the contract and passes the panic message to the host. Theabort
feature can only be used when deploying to chains that implement the import. For this reason, it's not yet enabled by default. (#1299) - cosmwasm-vm: A new import
abort
is created to abort contract execution when requested by the contract. (#1299) - cosmwasm-std: Add new
ibc3
feature that allows to use IBC-Go V3 features, like version negotiation and exposing relayer address to the contract. Requires a compatible wasmd runtime (v0.27.0+) (#1302)
1.0.0-rc.0 - 2022-05-05
- cosmwasm-std: Upgrade
serde-json-wasm
to 0.4.0 to fix u128/i128 serialization ofto_vec
/to_binary
in some cases (#1297).
- cosmwasm-std: Implement
checked_multiply_ratio
forUint64
/Uint128
/Uint256
- cosmwasm-std: Implement
checked_from_ratio
forDecimal
/Decimal256
- cosmwasm-std: Implement
Div
/DivAssign
forDecimal
/Decimal256
. - cosmwasm-vm: Add feature
allow_interface_version_7
to run CosmWasm 0.16 contracts in modern hosts. Be careful if you consider using this!
- all: Updated Rust edition to 2021
- cosmwasm-std: Rename
SubMsgExecutionResponse
toSubMsgResponse
. - cosmwasm-crypto: Update dependency
k256
to ^0.10.4. - cosmwasm-vm:
BackendError
was changed tonon_exhaustive
for future extension;BackendError
now implementsPartialEq
for easier test code; themsg
inBackendError::Unknown
became non-optional because it was always set; the argument inBackendError::unknown
/::user_err
was change toimpl Into<String>
to avoid unnecessary clones.
- cosmwasm-std:
SubMsgExecutionResponse
is deprecated in favor of the newSubMsgResponse
.
- cosmwasm-std: Remove
Pair
which was previously deprecated. UseRecord
instead. (#1282)
1.0.0-beta8 - 2022-04-06
- cosmwasm-std: Implement
MulAssign
forDecimal
/Decimal256
. - cosmwasm-std: Implement
is_zero
/atomics
/decimal_places
as const for Uint and Decimal types. - cosmwasm-std: Implement
new
andraw
const constructors forDecimal
/Decimal256
.
- all: Drop support for Rust versions lower than 1.56.1.
- cosmwasm-std:
MockQuerier
now supports adding custom behaviour for handling Wasm queries viaMockQuerier::update_wasm
(#1050).
- cosmwasm-std:
Api::addr_validate
now requires inputs to be normalized. - cosmwasm-vm: The
addr_validate
import now requires inputs to be normalized.
1.0.0-beta7 - 2022-03-22
- cosmwasm-std: Implement
Decimal{,256}::checked_mul
andDecimal{,256}::checked_pow
. - cosmwasm-std: Implement
Sub
/SubAssign
forUint64
. - cosmwasm-std: Implement
Mul
/MulAssign
forUint64
. - cosmwasm-std: Implement
RemAssign
forUint64
/Uint128
/Uint256
/Uint512
. - cosmwasm-std: Implement
pow
/checked_pow
forUint64
/Uint128
/Uint512
. - cosmwasm-std: Implement
SubAssign
/AddAssign
forDecimal
/Decimal256
. - cosmwasm-crypto: Upgrade ed25519-zebra to version 3.
- cosmwasm-vm: Upgrade Wasmer to 2.2.1.
1.0.0-beta6 - 2022-03-07
- cosmwasm-std: Implement
ops::Rem
forUint{64,128,256,512}
.
- cosmwasm-std: Change type of
Reply::result
fromContractResult
to the newSubMsgResult
. Both types are equal when serialized butContractResult
is documented to be the result of a contract execution, which is not the case here. (#1232) - cosmwasm-vm: Upgrade Wasmer to 2.2.0 and bump
MODULE_SERIALIZATION_VERSION
to "v3-wasmer1". (#1224)
1.0.0-beta5 - 2022-02-08
- all: Drop support for Rust versions lower than 1.54.0.
- cosmwasm-std: The
Debug
implementation ofBinary
now produces a hex string instead of a list of bytes (#1199). - cosmwasm-std: Pin uint version to 0.9.1 in order to maintain a reasonably low MSRV.
- cosmwasm-std: Add missing
Isqrt
export (#1214).
- cosmwasm-vm: Fix
AddAssign
implementation ofGasInfo
. - cosmwasm-vm: Bump
MODULE_SERIALIZATION_VERSION
to "v2" because the module serialization format changed between Wasmer 2.0.0 and 2.1.x.
1.0.0-beta4 - 2021-12-23
- cosmwasm-vm:
wasmer
version bumped2.1.0 -> 2.1.1
- cosmwasm-vm: Remove system-dependent stacktrace from
VmError::RuntimeErr
(fixes CWA-2021-003).
- cosmwasm-std: New const methods
Uint64::to_be_bytes
/::to_le_bytes
. - cosmwasm-vm: The check_contracts tool now has a
--supported-features
option that defaults to "iterator,staking,stargate". - cosmwasm-vm: The default
singlepass
compiler is now supported on 64-bit Windows. - cosmwasm-std: Add missing
DivideByZeroError
export. - cosmwasm-std: Implement
std::iter::Sum
forDecimal
andDecimal256
.
- all: Drop support for Rust versions lower than 1.53.0.
- cosmwasm-std: The balance argument from
mock_dependencies
was removed. Remove&[]
if you don't need a contract balance or use the newmock_dependencies_with_balance
if you need a balance. - cosmwasm-vm: Unlock cache mutex before module instantiation.
- cosmwasm-vm:
wasmer
version bumped2.0.0 -> 2.1.0
- cosmwasm-std: Remove the macros
create_entry_points
andcreate_entry_points_with_migration
in favour of the new, more flexible entry point system introduced in CosmWasm 0.14.
1.0.0-beta - 2021-10-11
- cosmwasm-std: Add new
WasmQuery::ContractInfo
variant to get metadata about the contract, likecode_id
andadmin
. - cosmwasm-std: New field
Env::transaction
containing info of the transaction the contract call was executed in. - cosmwasm-std: Implement
ops::Mul
forDecimal
andDecimal256
. - cosmwasm-std: New const methods
Uint128::to_be_bytes
/::to_le_bytes
. - cosmwasm-std: New const conversion methods
Uint256::from_uint128
andUint512::from_uint256
. - cosmwasm-std: New getters
Decimal{,256}::atomics()
andDecimal{,256}::decimal_places()
. - cosmwasm-std: New constructors
Decimal{,256}::from_atomics
. - cosmwasm-std: New
Uint128::checked_pow
. - cosmwasm-std: New macros
ensure!
,ensure_eq!
andensure_ne!
allow requirement checking that return errors instead of panicking (#1103).
- cosmwasm-std: Make
iterator
a required feature if theiterator
feature flag is set (enabled by default). - cosmwasm-vm: Increase
MAX_LENGTH_HUMAN_ADDRESS
from 90 to 256 in order to support longer address formats than bech32. - cosmwasm-std: Make
CustomQuery
a subtrait ofClone
, i.e. types that implementCustomQuery
need to beClone
able. - cosmwasm-std: Add generic for custom query type to
QuerierWrapper
,Deps
,DepsMut
andOwnedDeps
. MergeQuerierWrapper::custom_query
into the now fully typedQuerierWrapper::query
. - cosmwasm-std: Add generic type
Q
for the custom query request type todo_instantiate
,do_execute
,do_migrate
,do_sudo
,do_reply
,do_query
,ibc_channel_open
,ibc_channel_connect
,ibc_channel_close
,ibc_packet_receive
,ibc_packet_ack
andibc_packet_timeout
. - cosmwasm-std: In
Decimal
changeFraction<u128>
toFraction<Uint128>
, such thatDecimal::numerator
and::denominator
now returnUint128
. - cosmwasm-std: Make methods
Uint256::to_be_bytes
/::to_le_bytes
const. - cosmwasm-std: Make methods
Uint512::to_be_bytes
/::to_le_bytes
const. - cosmwasm-std: Make method
Uint512::from_le_bytes
const. - cosmwasm-std: Rename
Pair
toRecord
.Pair
is now an alias forRecord
and deprecated. (#1108) - cosmwasm-vm: Bump required marker export
interface_version_7
tointerface_version_8
. - cosmwasm-vm: Increase cost per Wasm operation from 1 to 150_000 and adjust crypto API gas cost based on the target of 1 Teragas per millisecond.
- cosmwasm-std: Deprecate the macros
create_entry_points
andcreate_entry_points_with_migration
in favour of the new, more flexible entry point system introduced in CosmWasm 0.14.
- cosmwasm-std: Remove
HumanAddr
(deprecated since 0.14). UseString
instead. - cosmwasm-std: Remove
KV
(deprecated since 0.14). UsePair
instead.
0.16.2 - 2021-09-07
- cosmwasm-std: Implement
Mul
andMulAssign
forUint128
. - cosmwasm-std: Implement
FromStr
forUint128
,Uint256
, andUint512
. - cosmwasm-std: Make
Uint256::from_le_bytes
,::from_be_bytes
and::new
const. - cosmwasm-std: Added the
Decimal256
type with 18 decimal places.
- cosmwasm-std: Implement
Decimal::from_ratio
using full uint128 multiplication to support a wider range of input values. - cosmwasm-std:
Decimal::from_ratio
now accepts any types that implementInto<Uint128>
rather thanInto<u128>
. - cosmwasm-crypto: Update dependency
k256
to ^0.9.6. - cosmwasm-std: Add enum cases
Shl
toOverflowOperation
(breaking; #1071).
- cosmwasm-std: Fixed a bug where
Uint*
types wouldn't handle formatting options when formatted withstd::fmt::Display
.
0.16.1 - 2021-08-31
- cosmwasm-std: Added
From<Addr>
andFrom<&Addr>
conversions forCow<Addr>
. - cosmwasm-std: Added new
Uint256
andUint512
types. - cosmwasm-std: Added implementations of
Isqrt
(integer square root) forUint64
,Uint128
,Uint256
, andUint512
. - cosmwasm-std: Exposed
Uint{64, 128, 256}::full_mul
for full multiplication that cannot overflow.
- cosmwasm-std: In
ExternalApi::addr_validate
and::addr_canonicalize
do not send too long inputs to VM to avoid terminating contract execution. Errors are returned instead now. - cosmwasm-std: Add enum cases
Shr
toOverflowOperation
(breaking; #1059).
0.16.0 - 2021-08-05
- cosmwasm-std: Added the
IbcChannelOpenMsg
,IbcChannelConnectMsg
,IbcChannelCloseMsg
,IbcPacketReceiveMsg
,IbcPacketAckMsg
, andIbcPacketTimeoutMsg
types for use with corresponding IBC entrypoints. - cosmwasm-std::testing: New mocking helpers for IBC channel msg types:
mock_ibc_channel_open_init
,mock_ibc_channel_open_try
,mock_ibc_channel_connect_ack
,mock_ibc_channel_connect_confirm
,mock_ibc_channel_close_init
,mock_ibc_channel_close_confirm
. - cosmwasm-std::testing: Added
mock_ibc_packet_timeout
sincemock_ibc_packet_ack
is no longer usable for creating mock data foribc_packet_timeout
. - cosmwasm-std: New
Attribute::new
constructor that does the same thing asattr
. - cosmwasm-std::testing: Added
mock_wasm_attr
when you really need to create anAttribute
with a key starting with_
in test code. - cosmwasm-std: Renamed
IBCAcknowledgementWithPacket
->IbcPacketAckMsg
to remove an unneeded level of indirection. - cosmwasm-std: Added
Event::add_attributes
for bulk adding attributes to anEvent
struct. - cosmwasm-std: Added
Addr::into_string
for explicit conversion
- cosmwasm-vm: The
Checksum::to_hex
function signature was changed fromto_hex(&self) -> String
toto_hex(self) -> String
. - cosmwasm-std: The
attr
function now accepts types that implementInto<String>
rather thanToString
. - cosmwasm-std, cosmwasm-vm, cosmwasm-storage: The
iterator
feature is now enabled by default. - cosmwasm-std: Make
MockApi::canonical_length
private. - cosmwasm-vm: Make
MockApi::canonical_length
private. - cosmwasm-vm: Bump required marker export
interface_version_6
tointerface_version_7
. - cosmwasm-std, cosmwasm-vm: Entrypoints
ibc_channel_open
,ibc_channel_connect
,ibc_channel_close
,ibc_packet_receive
,ibc_packet_ack
,ibc_packet_timeout
now each accept a correspondingMsg
value that wraps around channels, packets and acknowledgements. - cosmwasm-std/cosmwasm-vm: Increase canonical address lengths up to 64 bytes.
- cosmwasm-std/cosmwasm-vm: In
MockApi
, increase max length of supported human addresses from 24 bytes to 54 bytes by using a longer canonical representation. This allows you to insert typical bech32 addresses in tests. (#995) - cosmwasm-std::testing:
mock_ibc_packet_recv
function now returns anIbcPacketReceiveMsg
,mock_ibc_packet_ack
requires an acknowledgement to be passed and returns anIbcPacketAckMsg
. - cosmwasm-std:
IbcBasicResponse
andIbcReceiveResponse
now both support custom events via theevents
field. - cosmwasm-std:
attr
(andAttribute::new
) will now panic in debug builds if the attribute's key starts with an underscore. These names are reserved and could cause problems further down the line. - cosmwasm-std:
Response
,IbcBasicResponse
andIbcReceiveResponse
can no longer be constructed using struct literals. Use constructors likeResponse::new
to construct empty structs and appropriate builder-style methods to set fields (response.add_message
,response.set_data
, etc). - cosmwasm-std:
Event
,IbcChannel
,IbcPacket
,IbcAcknowledgement
have been markednon_exhaustive
(can't be constructed using a struct literal by downstream code). - cosmwasm-std:
Event::attr
has been renamed toEvent::add_attribute
for consistency with other types likeResponse
. - cosmwasm-vm:
Instance::required_features
changed from a property to a getter method. - cosmwasm-vm: Add
required_features
field toAnalysisReport
which is returned byCache::analyze
. - cosmwasm-vm: The VM now checks that exactly one
interface_version_*
marker export is set. Forinterface_version_5
andinterface_version_6
(CosmWasm 0.14–0.15) more specific error messages were added.
- cosmwasm-std::testing:
mock_ibc_channel
is now private. Usemock_ibc_channel_open
,mock_ibc_channel_connect
, ormock_ibc_channel_close
instead.
0.15.2 - 2021-07-21
- cosmwasm-std: Export
VoteOption
as a top-level type.
0.15.1 - 2021-07-20
- cosmwasm-std: Export
GovMsg
as a top-level type of the crate.
0.15.0 - 2021-06-24
- cosmwasm-std: Implement
Sub
andSubAssign
forUint128
- cosmwasm-std: Implement custom events for contract execution results
- cosmwasm-std: Add
CosmosMsg::Gov
for voting on governance proposals. - cosmwasm-storage: Implement
Storage
forPrefixedStorage
andReadonlyPrefixedStorage
. NOTE: Callingset
orremove
onReadonlyPrefixedStorage
will panic!
- cosmwasm-std: Make
Uint128
inner field private (#905) - cosmwasm-std: Remove
Context
- deprecated in previous release - cosmwasm-std: Remove
HandleResponse
,InitResponse
, andMigrateResponse
- deprecated in previous release - cosmwasm-crypto: Remove
ed25519::MESSAGE_MAX_LEN
,ed25519::BATCH_MAX_LEN
and message length verification as this should not be a concern ofcosmwasm-crypto
.
- cosmwasm-std: Rename the
send
function parameter tofunds
inWasmMsg
for consistency with the wasmd message types. - cosmwasm-vm: Increase read limit of contract execution results from 100,000 bytes to 64 MiB. JSON deserializers should have their own limit to protect against large deserializations.
- cosmwasm-vm: Create
VmError::DeserializationLimitExceeded
; Add limit argument tofrom_slice
; Increase deserialization limit of contract execution results from 100,000 bytes to 256 KiB. This probably only affects internal testing as well as integration tests of smart contracts. - cosmwasm-vm: More accurate error messages for op codes related to bulk memory operations, reference types, SIMD and the Threads extension.
- cosmwasm-vm: Update
wasmer
to2.0.0
- cosmwasm-vm: ED25519 message length and batch length limits are now hardcoded
in
cosmwasm-vm
itself instead of being imported fromcosmwasm-crypto
. - cosmwasm-vm: Filesystem storage layout now distinguishes clearly between state and cache.
- cosmwasm-std: Add enum case
ReplyOn::Never
; Remove default implementation ofReplyOn
as there is no natural default case anymore (#961). - cosmwasm-std: Merge
messages
andsubmessages
into one list, usingReplyOn::Never
to model the "fire and forget" semantics (#961). - cosmwasm-std: Add
SubMsg
constructors:::new()
,::reply_on_error()
,::reply_on_success()
,::reply_always()
; Addwith_gas_limit
to add a gas limit to any those constructors (#961). - cosmwasm-std: Change
Event
's constructor - it no longer takes a vector of attributes and instead constructs an empty one - cosmwasm-std: Rename
Event.kind
toEvent.ty
. - cosmwasm-std: Rename
SubcallResponse
toSubMsgExecutionResponse
. - contracts: Rename
ReflectSubCall
toReflectSubMsg
andSubCallResult
toSubCallMsg
in thereflect
contract. - cosmwasm-std: Rename the
subcall
module tosubmessages
. - cosmwasm-vm: Bump required marker export
cosmwasm_vm_version_5
tointerface_version_6
. - cosmwasm-std:
IbcAcknowledgement
is renamed toIbcAcknowledgementWithPacket
as it contains both data elements. (#975) - cosmwasm-std:
IbcAcknowledgementWithPacket.acknowledgement
is no longer simplyBinary
, but a newIbcAcknowledgement
structure, which contains one field -data: Binary
. This change was made to allow us to handle future changes to IBC in a non-contract-breaking way. (#975)
- comswasm-vm: Whitelisted the
i64.extend32_s
operation.
0.14.1 - 2021-06-14
- cosmwasm-std: Add
Timestamp::minus_seconds
and::minus_nanos
. - cosmwasm-std: Add
Addr::as_bytes
- cosmwasm-std: Implement
std::ops::Sub
formath::Decimal
- cosmwasm-std: Add
Timestamp::seconds
andTimestamp::subsec_nanos
. - cosmwasm-std: Implement division for
Decimal / Uint128
- cosmwasm-std: Add
math::Decimal::sqrt
- cosmwasm-std: Fix
Uint64::multiply_ratio
andUint128::multiply_ratio
so that internal multiplication cannot cause an unnecessary overflow. (#920)
0.14.0 - 2021-05-03
- cosmwasm-crypto: Add
ed25519_batch_verify
, EdDSA ed25519 batch signature verification scheme for Tendermint signatures and public keys formats. ([#788]) - cosmwasm-crypto: Add
ed25519_verify
, EdDSA ed25519 signature verification scheme for Tendermint signature and public key formats. ([#771]) - cosmwasm-crypto: New crypto-related crate. Add
secp256k1_verify
, ECDSA secp256k1 signature verification scheme for Cosmos signature and public key formats. ([#780]) - cosmwasm-vm: Add PinnedMemoryCache. (#696)
- cosmwasm-vm: The new
Cache::analyze
provides a static analyzis of the Wasm bytecode. This is used to tell the caller if the contract exposes IBC entry points. (#736) - cosmwasm-vm: Added new
stargate
feature flag to enable new stargate and ibc features (#692, #716) - cosmwasm-vm: (requires
stargate
) call into 6 new ibc entry points if exposed by contract (#692, #716) - cosmwasm-std: Added new
stargate
feature flag to enable new stargate and ibc features (#692, #706) - cosmwasm-std: (requires
stargate
) Added newCosmosMsg::Stargate
message type to dispatch protobuf-encoded message (contract must know proto schema) (#706) - cosmwasm-std: (requires
stargate
) Added newQueryRequest::Stargate
message type to dispatch protobuf-encoded queries (contract must know proto schema for request and response) (#706) - cosmwasm-std: (requires
stargate
) Added newCosmosMsg::Ibc(IbcMsg)
message type to use ibctransfer app or send raw ics packets (if contract has ibc entry points) (#692, #710) - cosmwasm-std: Add mutable helper methods to
InitResponse
,MigrateResponse
andHandleResponse
which makeContext
obsolete. - contracts: added new
ibc-reflect
contract that receives channels and assigns each an account to redispatch. Similar idea to ICS27/Interchain Accounts (but different implementation) (#692, #711, #714) - cosmwasm-std: Added new
WasmMsg::Migrate
variant that allows one contract (eg. multisig) be the admin and migrate another contract (#768) - cosmwasm-std: Added optional
system
entry point that can only be called by native (blockchain) modules to expose admin functionality if desired. (#793) - cosmwasm-std: Add extra field
submessages
toResponse
, such that you can get a callback from these messages after their execution (success or failure). (#796) - cosmwasm-std: Added
reply
entry point that will receive all callbacks from submessages dispatched by this contract. This is only required if contract returns "submessages" (above). (#796) - cosmwasm-std: Implement
From<Uint128> for String
,From<Uint128> for u128
as well asFrom<u{32,16,8}> for Uint128
. - cosmwasm-std: Create new address type
Addr
. This is human readable (likeHumanAddr
) but is immutable and always contains a valid address (#802). - cosmwasm-vm: Add import
addr_validate
(#802). - cosmwasm-std: Add
BankMsg::Burn
variant when you want the tokens to disappear (#860) - cosmwasm-std: Create
Fraction<T>
trait to represent a fractionp
/q
with integersp
andq
.Decimal
now implementsFraction<u128>
, which provides public getters::numerator()
and::denominator()
. - cosmwasm-std: Add
Decimal::inv
that returns1/d
for decimald
. - cosmwasm-vm: Add
Cache::metrics
to expose internal data for monitoring purposes (#763). - cosmwasm-std: Implement
PartialOrd
andOrd
forBinary
using the same lexicographical ordering as implemented byVec<u8>
. - cosmwasm-std: Implement
PartialOrd
andOrd
forAddr
using the same lexicographical ordering as implemented byString
. - cosmwasm-std: Added new
WasmMsg::UpdateAdmin
variant that allows an admin contract (eg. multisig) to set another admin (#900) - cosmwasm-std: Added new
WasmMsg::ClearAdmin
variant that allows an admin contract (eg. multisig) to clear the admin, to prevent future migrations (#900) - cosmwasm-std: Implement
Display for Coin
(#901). - cosmwasm-std: Create
Uint64
analogously toUint128
with string serialization allowing the use of the full uint64 range in JSON clients that use float numbers, such as JavaScript and jq. - cosmwasm-std: Create const functions
Uint64::new
andUint128::new
to create instances in a const context.
- contracts: Rename
HandleMsg
toExecuteMsg
. - all: Rename
handle
entry point toexecute
. - all: Rename
init
entry point toinstantiate
. - all: Rename
system
entry point tosudo
. - all: Drop support for Rust versions lower than 1.51.0.
- all: The
query
andexecute
entry points are now optional. It is still highly recommended to implement and expose them in almost any use case though. - all: Change the encoding of the key/value region of the
db_next
import to a more generic encoding that supports an arbitrary number of sections. This encoding can then be reused for other multi value regions. - all: Remove the
info: MessageInfo
argument from themigrate
entry point (#690). - cosmwasm-std: Remove
from_address
fromBankMsg::Send
, as it always sends from the contract address, and this is consistent with otherCosmosMsg
variants. - cosmwasm-std: Remove the previously deprecated
InitResult
,HandleResult
,MigrateResult
andQueryResult
in order to make error type explicit and encourage migration to custom errors. - cosmwasm-std: Add a
data
field toInitResponse
the same way as inMigrateResponse
andHandleResponse
. - cosmwasm-std: Rename
MessageInfo::sent_funds
toMessageInfo::funds
. - cosmwasm-std: Merge response types
InitResponse
,HandleResponse
andMigrateResponse
into the newResponse
. - cosmwasm-std: Remove
Default
implementation fromHumanAddr
,CanonicalAddr
,ContractInfo
,MessageInfo
,BlockInfo
andEnv
. If you need one of those, you're probably doing something wrong. - cosmwasm-std: Make
label
inWasmMsg::Instantiate
non-optional to better match the Go/database format. - cosmwasm-std: Add new field
admin
toWasmMsg::Instantiate
to fully supportMsgInstantiateContract
fromx/wasm
(#861). - cosmwasm-std:
Binary::to_array
is now generic over the array length instead of the output type. As a consequence the obsolete typeByteArray
was removed. The array length is not restricted to 0-64 anymore. - cosmwasm-std: Use const generics to implement
From<&[u8; LENGTH]> for Binary
andFrom<[u8; LENGTH]> for Binary
, such that the array length is not restricted to 0-64 anymore. - cosmwasm-vm: Avoid serialization of Modules in
InMemoryCache
, for performance. Also, removememory_limit
fromInstanceOptions
, and define it instead atCache
level (same memory limit for all cached instances). (#697) - cosmwasm-std: Rename type
KV
toPair
in order to comply to naming convention as enforced by clippy ruleupper_case_acronyms
from Rust 1.51.0 on. - cosmwasm-std:
ContractInfo::address
andMessageInfo::sender
are now of typeAddr
. The value of those fields is created by the host and thus valid. - cosmwasm-vm: Bump required marker export
cosmwasm_vm_version_4
tointerface_version_5
. - cosmwasm-vm: Rename trait
Api
toBackendApi
to better express this is the API provided by the VM's backend (i.e. the blockchain). - cosmwasm-vm: Rename imports to
addr_canonicalize
andaddr_humanize
(#802). - cosmwasm-vm: Replace types
HumanAddr
/CanonicalAddr
with&str
/String
/&[u8]
/Vec<u8>
in the methods ofBackendApi
. The address types belong in the contract development and the backend operates on raw strings and binary anyways. - contracts:
reflect
contract requiresstargate
feature and supports redispatchingStargate
andIbcMsg::Transfer
messages (#692) - cosmwasm-std: The arithmetic methods of
Uint128
got a huge overhaul, making them more consistent with the behaviour of the Rust primitive types. Thank you @yihuang for bringing this up and for the great implementation. (#853)Uint128
got the new functionschecked_add
,checked_sub
,checked_mul
,checked_div
,checked_div_euclid
,checked_rem
,wrapping_add
,wrapping_sub
,wrapping_mul
,wrapping_pow
,saturating_add
,saturating_sub
,saturating_mul
andsaturating_pow
which match their equivalent in u128 except that instead ofOption
the checked methods return aResult
with anOverflowError
orDivideByZeroError
that carries a few debug information and can directly be converted toStdError
/StdResult
by using the?
operator.StdError::Underflow
andStdError::underflow
were removed in favour ofStdError::Overflow
.StdError::DivideByZeroError
was added.- The
-
operator (impl ops::Sub<Uint128> for Uint128
) was removed because it returned aStdResult
instead of panicking in the case of an overflow. This behaviour was inconsistent with+
and the Rust standard library. Please use the explicit*_sub
methods introduced above. In a couple of releases from now, we want to introduce the operator again with panicking overflow behaviour (#858).
- cosmwasm-std: Replace
HumanAddr
withString
inBankQuery
,StakingQuery
andWasmQuery
query requests (#802). - cosmwasm-std: In staking query response types
Delegation
,FullDelegation
andValidator
the validator address fields were changed fromHumanAddr
toString
. The newAddr
type cannot be used here because it only supports standard account addresses viaApi::addr_*
(#871). - cosmwasm-std: Change address types in
BankMsg
,IbcMsg
andWasmMsg
fromHumanAddr
toString
(#802). - cosmwasm-std:
Api::addr_humanize
now returnsAddr
instead ofHumanAddr
(#802). - cosmwasm-std: Hide
StakingMsg
,CosmosMsg::Staking
,AllDelegationsResponse
,BondedDenomResponse
,Delegation
,FullDelegation
,StakingQuery
,Validator
,ValidatorsResponse
andtesting::StakingQuerier
behind thestaking
feature flag to make those only available in contracts built for PoS chains. - cosmwasm-std: Remove
StakingMsg::Withdraw
in favour ofDistributionMsg::SetWithdrawAddress
andDistributionMsg::WithdrawDelegatorReward
(#848). - cosmwasm-std: Rename
StakingQuery::Validators
,ValidatorsResponse
andQuerierWrapper::query_validators
toStakingQuery::AllValidators
,AllValidatorsResponse
andQuerierWrapper.query_all_validators
. AddStakingQuery::Validator
,ValidatorResponse
andQuerierWrapper::query_validator
to allow querying a single validator. (#879) - cosmwasm-schema: Make first argument non-mutable in
export_schema_with_title
for consistency withexport_schema
. - cosmwasm-std: The block time in
BlockInfo::time
is now aTimestamp
.BlockInfo::time_nanos
was removed.
- cosmwasm-std:
InitResponse
,MigrateResponse
andHandleResponse
are deprecated in favour of the newResponse
. - cosmwasm-std:
Context
is deprecated in favour of the new mutable helpers inResponse
. - cosmwasm-std:
HumanAddr
is not much more than an alias toString
and it does not provide significant safety advantages. With CosmWasm 0.14, we now useString
when there wasHumanAddr
before. There is also the newAddr
, which holds a validated immutable human readable address. (#802)
0.13.2 - 2021-01-14
- cosmwasm-vm: Update Wasmer to 1.0.1.
0.13.1 - 2021-01-12
- cosmwasm-std: Add the new
#[entry_point]
macro attribute that serves as an alternative implementation tocosmwasm_std::create_entry_points!(contract)
andcosmwasm_std::create_entry_points_with_migration!(contract)
. Both ways are supported in the 0.13 series.
0.13.0 – 2021-01-06
- cosmwasm-std: Extend binary to array support to 64 bytes.
- all: Drop support for Rust versions lower than 1.47.0.
- cosmwasm-std: Remove
cosmwasm_std::testing::MockApi::new
. UseMockApi::default
instead. - cosmwasm-vm: Upgrade Wasmer to 1.0 and adapt all the internal workings accordingly.
- cosmwasm-vm: Export method
cosmwasm_vm::Cache::stats
and response typeStats
. - cosmwasm-vm: Remove
cosmwasm_vm::testing::MockApi::new
. UseMockApi::default
instead. - cosmwasm-vm: Convert field
Instance::api
to a method. - cosmwasm-vm: Change order of generic arguments for consistency in
Instance
,Cache
andBackend
to always match<A: Api, S: Storage, Q: Querier>
. - cosmwasm-vm: Remove
Instance::get_memory_size
. UseInstance::memory_pages
instead.
cosmwasm-std
StdError
now implementsPartialEq
(ignoring backtrace if any). This allows simplerassert_eq!()
when testing error conditions (rather than match statements as now).
cosmwasm-std
- Deprecate
InitResult
,HandleResult
,MigrateResult
andQueryResult
in order to make error type explicit and encourage migration to custom errors. - Implement
Deref
forQuerierWrapper
, such thatQuerierWrapper
behaves like a smart pointer toQuerier
allowing you to accessQuerier
methods directly.
cosmwasm-std
- Remove the previously deprecated
StdError::Unauthorized
. Contract specific errors should be implemented using custom error types now (see migration guide 0.10 -> 0.11). - Use dependency
thiserror
instead ofsnafu
to implementStdError
. Along with this change, thebacktraces
feature now requires Rust nightly. - Rename
StdError::ParseErr::source
toStdError::ParseErr::source_type
andStdError::SerializeErr::target
toStdError::SerializeErr::target_type
to work around speacial treatment of the field namesource
in thiserror. - Rename
Extern
toDeps
to unify naming. - Simplify ownership of calling
handle
, etc. withDeps
andDepsMut
struct that just contains references (DepsMut
has&mut Storage
otherwise the same) - Remove unused
Deps::change_querier
. If you need this or similar functionality, create a new struct with the right querier. - Remove
ReadonlyStorage
. You can just useStorage
everywhere. And use&Storage
to provide readonly access. This was only needed to letPrefixedStorage
/ReadonlyPrefixedStorage
implement the common interface, which is something we don't need.
cosmwasm-storage
PrefixedStorage
/ReadonlyPrefixedStorage
do not implement theStorage
/ReadonlyStorage
traits anymore. If you need nested prefixes, you need to construct them directly viaPrefixedStorage::multilevel
andReadonlyPrefixedStorage::multilevel
.- Remove unused
TypedStorage
. If you need this or similar functionality, you probably want to useBucket
orSingleton
. If you really need it, please copy the v0.11 code into your project. - Remove
StorageTransaction
along withtransactional
andRepLog
. This has not been used actively for contract development and is now maintained in a contract testing framework.
cosmwasm-vm
- Remove
Storage::range
andStorageIterator
. The storage implementation is now responsible for maintaining iterators internally and make them accessible via the newStorage::scan
andStorage::next
methods. - Add
FfiError::IteratorDoesNotExist
. Looking at this,FfiError
should probably be renamed to something that includes before, on and behind the FFI boundary to Go. MockStorage
now implements the newStorage
trait and has an additionalMockStorage::all
for getting all elements of an iterator in tests.- Remove unused
Extern::change_querier
. If you need this or similar functionality, create a new struct with the right querier. - Let
Instance::from_code
andCosmCache::get_instance
take options as anInstanceOptions
struct. This containsgas_limit
andprint_debug
for now and can easily be extended.cosmwasm_vm::testing::mock_instance_options
can be used for creating such a struct in integration tests. - Make
FileSystemCache
crate internal. This should be used viaCosmCache
. - Fix return type of
FileSystemCache::load
toVmResult<Option<Module>>
in order to differentiate missing files from errors. - Add in-memory caching for recently used Wasm modules.
- Rename
CosmCache
to justcosmwasm_vm::Cache
and addCacheOptions
to configure it. - Rename
Extern
toBackend
. - Rename
mock_dependencies
tomock_backend
andmock_dependencies_with_balances
tomock_backend_with_balances
. - Rename
FfiError
/FfiResult
toBackendError
/BackendResult
and adaptVmError
accordingly.
cosmwasm-std
- Implement
From<std::str::Utf8Error>
andFrom<std::string::FromUtf8Error>
forStdError
. - Generalize denom argument from
&str
toS: Into<String>
incoin
,coins
andCoin::new
. - Implement
PartialEq
betweenBinary
andVec<u8>
/&[u8]
. - Add missing
PartialEq
implementations betweenHumanAddr
andstr
/&str
. - Add
Binary::to_array
, which allows you to copy binary content into a fixed-lengthu8
array. This is especially useful for creating integers from binary data.
cosmwasm-std
- Implement
Hash
andEq
forBinary
to allow usingBinary
inHashSet
andHashMap
. - Implement
Hash
andEq
forCanonicalAddr
to allow usingCanonicalAddr
inHashSet
andHashMap
. - Implement
Add
,AddAssign
andSub
with references on the right hand side forUint128
. - Implement
Sum<Uint128>
andSum<&'a Uint128>
forUint128
.
all
- Drop support for Rust versions lower than 1.45.2.
- The serialization of the result from
init
/migrate
/handle
/query
changed in an incompatible way. See the newContractResult
andSystemResult
types and their documentation. - Pass
Env
intoquery
as well. As this doesn't haveMessageInfo
, we removedMessageInfo
fromEnv
and pass that as a separate argument toinit
,handle
, andquery
. See the example type definitions in the README to see how to update your contract exports (just add one extra arg each).
cosmwasm-std
- Add
time_nanos
toBlockInfo
allowing access to high precision block times. - Change
FullDelegation::accumulated_rewards
fromCoin
toVec<Coin>
. - Rename
InitResponse::log
,MigrateResponse::log
andHandleResponse::log
toInitResponse::attributes
,MigrateResponse::attributes
andHandleResponse::attributes
. - Rename
LogAttribute
toAttribute
. - Rename
log
toattr
. - Rename
Context::add_log
toContext::add_attribute
. - Add
Api::debug
for emitting debug messages during development. - Fix error type for response parsing errors in
ExternalQuerier::raw_query
. This wasOk(Err(StdError::ParseErr))
instead ofErr(SystemError::InvalidResponse)
, implying an error created in the target contract. - Deprecate
StdError::Unauthorized
andStdError::unauthorized
in favour of custom errors. From now onStdError
should only be created by the standard library and should only contain cases the standard library needs. - Let
impl Display for CanonicalAddr
use upper case hex instead of base64. This also affectsCanonicalAddr::to_string
. - Create trait
CustomQuery
for the generic argument inQueryRequest<C: CustomQuery>
. This allows us to provideimpl<C: CustomQuery> From<C> for QueryRequest<C>
for any custom query. - Implement
From<Binary> for Vec<u8>
. - Implement
From<CanonicalAddr> for Vec<u8>
. - Add
Binary::into_vec
andCanonicalAddr::into_vec
. - The
canonical_length
argument was removed frommock_dependencies
,mock_dependencies_with_balances
. In the now deprecatedMockApi::new
, the argument is unused. Contracts should not need to set this value and usually should not make assumptions about the value. - The canonical address encoding in
MockApi::canonical_address
andMockApi::human_address
was changed to an unpredictable representation of non-standard length that aims to destroy most of the input structure.
cosmwasm-storage
- Change order of arguments such that
storage
is always first followed by namespace inBucket::new
,Bucket::multilevel
,ReadonlyBucket::new
,ReadonlyBucket::multilevel
,bucket
andbucket_read
. - Change order of arguments such that
storage
is always first followed by namespace inPrefixedStorage::new
,PrefixedStorage::multilevel
,ReadonlyPrefixedStorage::new
,ReadonlyPrefixedStorage::multilevel
,prefixed
andprefixed_read
.
cosmwasm-vm
CosmCache::new
,Instance::from_code
andInstance::from_module
now take an additional argument to enable/disable printing debug logs from contracts.- Bump required export
cosmwasm_vm_version_3
tocosmwasm_vm_version_4
. - The
canonical_length
argument was removed frommock_dependencies
,mock_dependencies_with_balances
andMockApi::new_failing
. In the now deprecatedMockApi::new
, the argument is unused. Contracts should not need to set this value and usually should not make assumptions about the value. - The canonical address encoding in
MockApi::canonical_address
andMockApi::human_address
was changed to an unpredictable representation of non-standard length that aims to destroy most of the input structure.
cosmwasm-std
- Fix bug where
ExternalStorage.range()
would cause VM error if either lower or upper bound was set (#508)
all
- Drop support for Rust versions lower than 1.44.1.
cosmwasm-std
- Remove error helpers
generic_err
,invalid_base64
,invalid_utf8
,not_found
,parse_err
,serialize_err
,underflow
,unauthorized
in favour ofStdError::generic_err
and friends. - Implement
From<&[u8; $N]> for Binary
andFrom<[u8; $N]> for Binary
for all$N <= 32
. - Add
Context
object that can be used to build Init/Handle/Migrate response viaadd_log
,add_message
,set_data
and then convert to the proper type viainto
ortry_into
. Option to simplify response construction. - Env uses
HumanAddr
formessage.sender
andcontract_address
- Remove
Api
argument frommock_env
- Implement
From<&[u8]>
andFrom<Vec<u8>>
forCanonicalAddr
cosmwasm-vm
- Remove unused cache size argument from
CosmCache
. set_gas_limit
now panics if the given gas limit exceeds the max. supported value.- Increase the max. supported value for gas limit from 10_000_000_000 to 0x7FFFFFFFFFFFFFFF.
- Add checks to
get_region
for failing early when the contract sends a Region pointer to the VM that is not backed by a plausible Region. This helps development of standard libraries. - Create dedicated
RegionValidationError
andRegionValidationResult
. Api::human_address
andApi::canonical_address
now return a pair of return data and gas usage.- Remove
NextItem
in favour of a more advancedFfiResult<T>
, which is used to store the return result and the gas information consistently across all APIs.FfiResult<T>
was changed to(Result<T, FfiError>, GasInfo)
. - Create error type
FfiError::InvalidUtf8
for the cases where the backend sends invalid UTF-8 in places that expect strings. - Remove
FfiError::Other
in favour ofFfiError::UserErr
andFfiError::Unknown
. - The
canonicalize_address
andhumanize_address
imports now report user errors to the contract. - Bump
cosmwasm_vm_version_2
tocosmwasm_vm_version_3
. Querier::raw_query
andQuerierResult
were removed in favour of the newQuerier::query_raw
, which includes a gas limit parameter for the query.
cosmwasm-vm
- Add
Instance::create_gas_report
returning a gas report including the original limit, the remaining gas and the internally/externally used gas.
cosmwasm-storage
- Add
.remove()
method toBucket
andSingleton
.
- Downgrade wasmer to 0.17.0.
cosmwasm-std
- Replace type
Never
withEmpty
because enums with no cases cannot be expressed in valid JSON Schema.
Note: this version contains an API bug and should not be used (see CosmWasm#451).
all
- Upgrade wasmer to 0.17.1.
- Drop support for Rust versions lower than 1.43.1
cosmwasm-std
-
ReadonlyStorage::get
and all its implementations now returnOption<Vec<u8>>
. -
ReadonlyStorage::range
and all its implementations now always succeed and return an iterator instead of a result. This is now an iterator overOption<KV>
instead ofOption<StdResult<KV>>
. -
Storage::{set, remove}
and all their implementations no longer have a return value. Previously they returnedStdResult<()>
. -
Trait
Querier
is notClone
andSend
anymore. -
consume_region
panics on null pointers and returnsVec<u8>
instead ofStdResult<Vec<u8>>
. -
Added contract migration mechanism. Contracts can now optionally export a
migrate
function with the following definition:extern "C" fn migrate(env_ptr: u32, msg_ptr: u32) -> u32;
-
InitResponse no longer has a data field. We always return the contract address in the data field in the blockchain and don't allow you to override.
handle
can still make use of the field. -
Rename
MockQuerier::with_staking
toMockQuerier::update_staking
to match::update_balance
. -
The obsolete
StdError::NullPointer
andnull_pointer
were removed. -
Error creator functions are now in type itself, e.g.
StdError::invalid_base64
instead ofinvalid_base64
. The free functions are deprecated and will be removed before 1.0.
cosmwasm-storage
- Remove
transactional_deps
. Usetransactional
that just provides a transactional storage instead. get_with_prefix
returnsOption<Vec<u8>>
instead ofStdResult<Option<Vec<u8>>>
.set_with_prefix
andremove_with_prefix
return nothing instead ofStdResult<()>
.RepLog::commit
no longer returns any value (always succeeds).Op::apply
no longer returns any value (always succeeds).
cosmwasm-vm
- The export
allocate
must not return 0 as a valid address. The contract is responsible for avoiding this offset in the linear memory. - The import
db_read
now allocates memory for the return value as part of the call and returns a pointer to the value asu32
. The return value 0 means key does not exist. - The import
db_next
now allocates a memory region for the return key and value as part of the call and returns a pointer to the region asu32
. The data in the region is stored in the formatvalue || key || keylen
. As before, an empty key means no more value. - Remove
Instance::get_gas
in favour ofInstance::get_gas_left
. - All calls from the VM layer to the chain layer also return the amount of gas
used on success. (This is represented by replacing the return value with
(value, used_gas)
). Gas usage across the system is then tracked in the VM layer, which allows us to halt the contract during an import, as soon as we can prove that we used all allocated gas. - Remove instance caching, which is disabled since 0.8.1 as it is not stable.
Remove
CosmCache::store_instance
; you can not callInstance::recylce
directly to get back the external dependencies. - Rename
MockQuerier::with_staking
toMockQuerier::update_staking
to match::update_balance
. - Instead of panicking,
read_region
/write_region
/get_region
/set_region
now return a newCommunicationError::DerefErr
when dereferencing a pointer provided by the contract fails. FfiError::set_message
was removed because errors should be immutable. UseFfiError::other
to create an error with the desired error message.- The import implementation of
db_scan
now errors instead of returning an error code for an invalid order value. The return type was changed tou32
. - Remove
StorageIteratorItem
in favour of the new typesStorageIterator
andNextItem
.StorageIterator
is a custom iterator type that does not implement Rust'sIterator
trait, allowing it to communicate the used gas value of the lastnext
call to the VM. - Don't report any
VmError
back to the contract incanonicalize_address
andhumanize_address
. Only invalid inputs should be reported. - Move error cases
VmError::RegionLengthTooBig
andVmError::RegionTooSmall
intoCommunicationError
. - In the
canonicalize_address
implementation, invalid UTF-8 inputs now result inCommunicationError::InvalidUtf8
, which is not reported back to the contract. A standard library should ensure this never happens by correctly encoding string input values. - Merge trait
ReadonlyStorage
intoStorage
. - The imports
canonicalize_address
andhumanize_address
now return a memory address to an errorRegion
. If this address is 0, the call succeeded. - Bump
cosmwasm_vm_version_1
tocosmwasm_vm_version_2
.
cosmwasm-std
- The arguments of
log
changed from&str
toToString
, allowing to pass various types likeString
,HumanAddr
,Uint128
or primitive integers directly. - Add
From<Vec<u8>>
andInto<Vec<u8>>
implementations forBinary
for zero-copy conversions.
cosmwasm-vm
- Deprecated
Instance::get_gas
in favour ofInstance::get_gas_left
. The old method will remain available for a while but will issue a deprecation warning when used. - Disable instance caching by treating every cache size as 0. Instance caching is not safe as the same Wasm memory is reused across multiple executions.
- The storage of an
Instance
can now be set into readonly mode, which is checked by the writing storage importsdb_write
anddb_remove
. Read-only mode is off by default for backwards compatibility.call_query_raw
now sets the instance's storage to readonly. - The new error case
VmError::WriteAccessDenied
is returned when a contract calls an import that potentially writes to storage during a query.
all
- Upgrade schemars to 0.7.
- Upgrade wasmer to 0.17.
- Update snafu to 0.6.
- Minimal supported Rust version is 1.41.
- Split
Region.len
intoRegion.capacity
andRegion.length
, where the new capacity is the number of bytes available andlength
is the number of bytes used. This is a breaking change in the contract-vm interface, which requires the same memory layout of theRegion
struct on both sides. - Add
remove
method toStorage
trait. - (feature-flagged) Add
range
method toReadonlyStorage
trait. This returns an iterator that covers all or a subset of the items in the db ordered ascending or descending by key. - Add new feature flag
iterator
to both packages to enablerange
functionality. This is used to allow potential porting to chains that use Merkle Tries (which don't allow iterating over ranges). - All serialized JSON types now use snake_case mappings for names. This means
enum fields like
ChangeOwner
will map tochange_owner
in the underlying JSON, notchangeowner
. This is a breaking change for the clients. - Public interface between contract and runtime no longer uses
String
to represent an error, but rather serializesApiError
as a rich JSON error. - Return value from
env.write_db
andenv.remove_db
to allow error reporting. - Query responses are now required to contain valid JSON.
- Renamed all
*_db
wasm imports todb_*
- Merge
cw-storage
repo as subpackage, nowcosmwasm-storage
- Add iterator support to
cosmwasm-storage
Coin.amount
is nowUint128
rather thanString
. Uint128 serializes as a string in JSON, but parses into a u128 data in memory. It also has some operator overloads to allow easy math operations onCoin
types, as well as enforcing valid amounts.Env
no longer has acontract.balance
element. If you need this info, please use theQuerier
to get this info. As of Cosmos-SDK 0.39 this needs extra storage queries to get the balance, so we only do those queries when needed.Env.message.sent_funds
is aVec<Coin>
notOption<Vec<Coin>>
. We will normalize the go response ingo-cosmwasm
before sending it to the contract.Env.message.signer
was renamed toEnv.message.sender
.Env.block.{height,time}
are nowu64
rather thani64
.
cosmwasm-schema
- This new crate now contains the implementations for generating JSON Schema
files from interface types. It exposes the functions
export_schema
,export_schema_with_title
, andschema_for
.
cosmwasm-std
- Make all symbols from
cosmwasm::memory
crate internal, as those symbols are not needed by users of the library. - Rename
cosmwasm::mock::dependencies
->cosmwasm::mock::mock_dependencies
to differentiate between testing and productionExternal
. - Export all symbols from
cosmwasm::mock
as the new non-wasm32 modulecosmwasm::testing
. Export all remaining symbols at top level (e.g.use cosmwasm::traits::{Api, Storage};
+use cosmwasm::encoding::Binary;
becomesuse cosmwasm::{Api, Binary, Storage};
). - Rename package
cosmwasm
tocosmwasm-std
. - The export
allocate
does not zero-fill the allocated memory anymore. - Add
remove_db
to the required imports of a contract. - (feature-flagged) add
scan_db
andnext_db
callbacks from wasm contract to VM. serde::{from_slice, to_vec}
returncosmwasm_std::Result
, no more need to use.context(...)
when calling these functions- Split
Response
intoInitResponse
andHandleResponse
; splitContractResult
intoInitResult
andHandleResult
. - Create explicit
QueryResponse
, analogue toInitResponse
andHandleResponse
. - The exports
cosmwasm_vm_version_1
,allocate
anddeallocate
are now private and can only be called via the Wasm export. Make sure touse
cosmwasm_std
at least once in the contract to pull in the C exports. - Add
Querier
trait andQueryRequest
for query callbacks from the contract, along withSystemError
type for the runtime rejecting messages. QueryRequest
takes a genericCustom(T)
type that is passed opaquely to the end consumer (wasmd
or integration test stubs), allowing custom queries to native code.{Init,Handle,Query}Result
are now just aliases for a concreteApiResult
type.- Support results up to 128 KiB in
ExternalStorage.get
. - The
Storage
trait's.get
,.set
and.remove
now return aResult
to allow propagation of errors. - Move
transactional
,transactional_deps
,RepLog
,StorageTransaction
into cratecosmwasm-storage
. - Rename
Result
toStdResult
to differentiate between the auto-use
dcore::result::Result
. Fix error argument toError
. - Complete overhaul of
Error
intoStdError
:- The
StdError
enum can now be serialized and deserialized (losing its backtrace), which allows us to pass them over the Wasm/VM boundary. This allows using fully structured errors in e.g. integration tests. - Auto generated snafu error constructor structs like
NotFound
/ParseErr
/… have been intenalized in favour of error generation helpers likenot_found
/parse_err
/… - All error generator functions now return errors instead of results.
- Error cases don't contain
source
fields anymore. Instead source errors are converted to standard types likeString
. For this reason, bothsnafu::ResultExt
andsnafu::OptionExt
cannot be used anymore. - Backtraces became optional. Use
RUST_BACKTRACE=1
to enable them. Utf8Err
/Utf8StringErr
merged intoStdError::InvalidUtf8
Base64Err
renamed intoStdError::InvalidBase64
ContractErr
/DynContractErr
merged intoStdError::GeneralErr
- The unused
ValidationErr
was removed StdError
is now non_exhaustive, making new error cases non-breaking changes.
- The
ExternalStorage.get
now returns an empty vector if a storage entry exists but has an empty value. Before, this was normalized toNone
.- Reorganize
CosmosMsg
enum types. They are now split by modules:CosmosMsg::Bank(BankMsg)
,CosmosMsg::Custom(T)
,CosmosMsg::Wasm(WasmMsg)
- CosmosMsg is now generic over the content of
Custom
variant. This allows blockchains to support custom native calls in their Cosmos-SDK apps and developers to make use of them in CosmWasm apps without forking thecosmwasm-vm
andgo-cosmwasm
runtime. - Add
staking
feature flag to expose newStakingMsg
types underCosmosMsg
and newStakingRequest
types underQueryRequest
. - Add support for mocking-out staking queries via
MockQuerier.with_staking
from_slice
/from_binary
now require result type to beDeserializeOwned
, i.e. the result must not contain references such as&str
.
cosmwasm-vm
- Make
Instance.memory
/.allocate
/.deallocate
/.func
crate internal. A user of the VM must not access the instance's memory directly. - The imports
env.canonicalize_address
,env.humanize_address
andenv.read_db
don't return the number of bytes written anymore. This value is now available in the resulting regions. Negative return values are errors, 0 is success and values greater than 0 are reserved for future use. - Change the required interface version guard export from
cosmwasm_api_0_6
tocosmwasm_vm_version_1
. - Provide implementations for
remove_db
and (feature-flagged)scan_db
andnext_db
- Provide custom
serde::{from_slice, to_vec}
implementation separate fromcosmwasm_std
, so we can return cosmwasm-vm specificResult
(only used internally). call_{init,handle,query}
and thecosmwasm_vm::testing
wrappers return standardResult
types now, eg.Result<HandleResponse, ApiError>
.- Add length limit when reading memory from the instance to protect against
malicious contracts creating overly large
Region
s. - Add
Instance.get_memory_size
, giving you the peak memory consumption of an instance. - Remove
cosmwasm_vm::errors::CacheExt
. - Move
cosmwasm_vm::errors::{Error, Result}
tocosmwasm_vm::{VmError, VmResult}
and remove generic error type from result. - The import
db_read
now returns an error code if the storage key does not exist. The latest standard library converts this error code back to aNone
value. This allows differentiating non-existent and empty storage entries. - Make
Instance::from_module
,::from_wasmer
and::recycle
crate-internal. - Create explicit, public
Checksum
type to identify Wasm blobs. CosmCache::new
now takes supported features as an argument.- Rename
VmError::RegionTooSmallErr
toVmError::RegionTooSmall
. - Rename
VmError::RegionLengthTooBigErr
toVmError::RegionLengthTooBig
. - Change property types to owned string in
VmError::UninitializedContextData
,VmError::ConversionErr
,VmError::ParseErr
andVmError::SerializeErr
. - Remove
VmError::IoErr
in favour ofVmError::CacheErr
. - Simplify
VmError::CompileErr
,VmError::ResolveErr
andVmError::WasmerRuntimeErr
to just hold a string with the details instead of the source error. - Remove
VmError::WasmerErr
in favour of the newVmError::InstantiationErr
. - The snafu error builders from
VmError
are now private, i.e. callers can only use the errors, not create them. VmError
is now#[non_exhaustive]
.- Split
VmError::RuntimeErr
inVmError::BackendErr
andVmError::GenericErr
; renameVmError::WasmerRuntimeErr
toVmError::RuntimeErr
. - Add
Instance.with_querier
analogue toInstance.with_storage
.
cosmwasm
- Fix JSON schema type of
Binary
from int array (wrong) to string (right). - Make
Extern
notClone
able anymore. Before cloning led to copying the data for mock storage and copying a stateless bridge for the external storage, which are different semantics. - Remove public
cosmwasm::imports::dependencies
. A user of this library does not need to call this explicitely. Dependencies are created internally and passed as an argument inexports::do_init
,exports::do_handle
andexports::do_query
. - Make
ExternalStorage
notClone
able anymore. This does not copy any data, so a clone could lead to unexpected results.
cosmwasm_vm
- Avoid unnecessary panic when checking corrupted wasm file.
- Support saving the same wasm to cache multiple times.
cosmwasm
- Rename
Slice
toRegion
to simplify differentiation between Wasm memory region and serde'sfrom_slice
- Rename
Params
toEnv
,mock_params
tomock_env
for clearer naming (this is information on the execution environment) Response.log
is not a vector of key/value pairs that can later be indexed by Tendermint.
cosmwasm_vm
- Remove export
cosmwasm_vm::read_memory
. Using this indicates an architectural flaw, since this is a method for host to guest communication inside the VM and not needed for users of the VM. - Create new type
cosmwasm_vm:errors::Error::RegionTooSmallErr
. - Change return type of
cosmwasm_vm::write_memory
toResult<usize, Error>
to make it harder to forget handling errors. - Fix missing error propagation in
do_canonical_address
,do_human_address
andallocate
. - Update error return codes in import
c_read
. - Rename imports
c_read
/c_write
toread_db
/write_db
. - Rename imports
c_canonical_address
/c_human_address
tocanonicalize_address
/humanize_address
. - Add
cosmwasm_vm::testing::test_io
for basic memory allocation/deallocation testing between host and guest. - Make
ValidationErr.msg
a dynamicString
including relevant runtime information. - Remove export
check_api_compatibility
. The VM will take care of calling it. - Let
check_api_compatibility
check imports by fully qualified identifier<module>.<name>
. - Make gas limit immutable in
cosmwasm_vm::instance::Instance
. It is passed once at construction time and cannot publicly be manipulated anymore. - Remove
take_storage
/leave_storage
fromcosmwasm_vm::Instance
.
Define canonical address callbacks
-
Use
&[u8]
for addresses in params -
Allow contracts to resolve human readable addresses (
&str
) in their json into a fixed-size binary representation -
Provide mocks for unit testing and integration tests
-
Separate out
Storage
fromReadOnlyStorage
as separate traits
This is the first documented and supported implementation. It contains the basic
feature set. init
and handle
supported for modules and can return messages.
A stub implementation of query
is done, which is likely to be deprecated soon.
Some main points:
- The build-system and unit/integration-test setup is all stabilized.
- Cosmwasm-vm supports singlepass and cranelift backends, and caches modules on disk and instances in memory (lru cache).
- JSON Schema output works
All future Changelog entries will reference this base