The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- cosmwasm-std: Implement
BankQuery::AllDenomMetadatato allow querying all the denom metadata andBankQuery::DenomMetadatato query a specific one. In order to use this query in a contract, thecosmwasm_1_3feature needs to be enabled for thecosmwasm_stddependency. This makes the contract incompatible with chains running anything lower than CosmWasm1.3.0. (#1647) - cosmwasm-vm: Add
Cache::save_wasm_uncheckedto save Wasm blobs that have been checked before. This is useful for state-sync where we know the Wasm code was checked when it was first uploaded. (#1635) - cosmwasm-std: Add
FromStrimpl forCoin. (#1684) - cosmwasm-std: Add
Decimal::bpsandDecimal256::bpsto create a decimal from a basis point value (#1715).
- cosmwasm-vm: Add checks for table section of Wasm blob (#1631).
- cosmwasm-vm: Limit number of imports during static validation (#1629).
- cosmwasm-vm: The
check_contractexample was removed. Please use the crate cosmwasm-check instead (#1511). - cosmwasm-vm: Avoid using loupe for getting the
Modulesize in the file system cache to prepare for the Wasmer 3 upgrade. - cosmwasm-vm: Add target (triple + CPU features) into the module cache
directory to avoid using modules compiled for a different system. Bump
MODULE_SERIALIZATION_VERSIONto "v5". (#1664) - cosmwasm-vm: When enabling
print_debugthe debug logs are now printed to STDERR instead of STDOUT by default (#1667). - cosmwasm-vm: Add
Instance::set_debug_handler/unset_debug_handlerto allow customizing the handling of debug messages emitted by the contract (#1667). - cosmwasm-vm: Add
.wasmextension to stored wasm files (#1686). - cosmwasm-vm: Upgrade Wasmer to version 4.0.0.
- cosmwasm-check: Update clap dependency to version 4 (#1677)
- cosmwasm-std: Coin uses shorter
Coin { 123 "ucosm" }format for Debug (#1704)
- cosmwasm-storage: All exports are deprecated because this crate will be removed with CosmWasm 2.0 (#1596).
1.2.7 - 2023-06-19
- cosmwasm-std: Add
<<and<<=implementation forUint{64,128,256,512}types. (#1723) - cosmwasm-std: Add
Timestamp::{plus,minus}_{minutes, hours, days}. (#1729) - cosmwasm-std: Add
Decimal::bpsandDecimal256::bpsto create a decimal from a basis point value (#1715).
- cosmwasm-std: Coin uses shorter
Coin { 123 "ucosm" }format for Debug (#1704)
1.2.6 - 2023-06-05
- cosmwasm-vm: Bumped module serialization version from v4 to v5 to invalidate potentially corrupted caches caused by Rust update. See CosmWasm/wasmvm#426 for more information. (#1708)
1.2.5 - 2023-05-02
- cosmwasm-std: Implement
PartialEqforAddr == &Addrand&Addr == Addras well asEvent == &Eventand&Event == Event(#1672). - cosmwasm-std: Add
#[must_use]annotations toUint64,Uint128,Uint256,Uint512,DecimalandDecimal256math operations (#1678)
- cosmwasm-std: The PartialEq implementations between
Addrand&str/Stringare deprecated because they are not considered to be safe. In almost all cases you want to convert both sides of the equation toAddrfirst. If you really want to do a string comparison, useAddr::as_str()explicitly. (#1671)
1.2.4 - 2023-04-17
- cosmwasm-vm: Add call depths limit
1.2.3 - 2023-03-22
- cosmwasm-vm: Use saturating increments for
Statsfields to ensure we don't run into overflow issues.
1.2.2 - 2023-03-08
- cosmwasm-std: Add an IBC querier implementation to
testing::MockQuerier(#1620, #1624). - cosmwasm-std: Add
#[must_use]annotations toTimestampmath functions.
- all: Fix
backtracesfeature for newer versions of Rust. This still requires Rust nightly (#1613). - cosmwasm-std: Add missing export
CheckedMultiplyFractionError(#1608).
1.2.1 - 2023-01-30
- cosmwasm-std: Add
Decimal{,256}::to_uint_floorand::to_uint_ceilfor efficient and explicit decimal to uint conversion (#1603).
- cosmwasm-std: Make fields of
WeightedVoteOptionpublic to allow constructing it (#1597).
- cosmwasm-std: Improve readability of
Debugoutput forDecimalandDecimal256(#1600).
1.2.0 - 2023-01-24
- cosmwasm-std: Add
GovMsg::VoteWeighted. In order to use this in a contract, thecosmwasm_1_2feature needs to be enabled for thecosmwasm_stddependency. This makes the contract incompatible with chains running versions of CosmWasm earlier than 1.2.0 (#1481). - cosmwasm-std: Add
instantiate2_addresswhich allows calculating the predictable addresses forMsgInstantiateContract2(#1437, #1554). - cosmwasm-std: Add
WasmMsg::Instantiate2(requirescosmwasm_1_2, seeGovMsg::VoteWeightedabove) to instantiate contracts at a predictable address (#1436, #1554)). - cosmwasm-schema: In contracts,
cosmwasm schemawill now output a separate JSON Schema file for each entrypoint in therawsubdirectory (#1478, #1533). - cosmwasm-std: Upgrade
serde-json-wasmdependency to 0.5.0 which adds map support toto_vec/to_binaryand friends. - cosmwasm-std: Implement
AsRef<[u8]>forBinaryandHexBinary(#1550). - cosmwasm-std: Allow constructing
SupplyResponsevia aDefaultimplementation (#1552, #1560). - cosmwasm-std: Add
Nevertype which cannot be instantiated. This can be used as the error type foribc_packet_receiveoribc_packet_ackto gain confidence that the implementations never errors and the transaction does not get reverted. (#1513) - cosmwasm-std: Add new
WasmQuery::CodeInfoto get the checksum of a code ID (#1561). - cosmwasm-vm: Add
Cache::remove_wasmto remove obsolete Wasm blobs and their compiled modules. - cosmwasm-std: Implement fraction multiplication and division. Assists with Uint & Decimal arithmetic and exposes methods for flooring/ceiling result (#1485, #1566).
- cosmwasm-vm: Avoid exposing OS specific file system errors in order to test cosmwasm-vm on Windows. This gives us confidence for integrating cosmwasm-vm in a libwasmvm build on Windows. This change is likely to be consensus breaking as error messages change. (#1406)
- cosmwasm-vm: Use
Displayrepresentation for embedding WasmerInstantiationErrors (#1508).
- cosmwasm-schema: Nested QueryMsg with generics is now supported by the QueryResponses macro (#1516).
- cosmwasm-schema: A nested QueryMsg no longer causes runtime errors if it contains doc comments.
- cosmwasm-std/cosmwasm-vm: Increase length limit for address conversion in
MockApito support addresses longer than 54 bytes (#1529).
1.1.9 - 2022-12-06
- cosmwasm-schema: Fix type fully qualified path to symbol
QueryResponsesin macrocosmwasm_schema::generate_api!(#1527).
1.1.8 - 2022-11-22
- cosmwasm-schema: Fix type params on
QueryMsgcausing a compiler error when used with theQueryResponsesderive macro.
1.1.6 - 2022-11-16
- cosmwasm-std: Add
Fromimplementations to convert betweenCanonicalAddr/Binaryas well asCanonicalAddr/HexBinary(#1463). - cosmwasm-std: Add
Fromimplementations to convertu8arrays toCanonicalAddr(#1463). - cosmwasm-std: Implement
PartialEqbetweenCanonicalAddrandHexBinary/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-07schemas - cosmwasm-schema:
QueryResponsesderive now sets theJsonSchematrait bound on the generatedimplblock. This allows the contract dev to not add aJsonSchematrait bound on the type itself.
1.1.5 - 2022-10-17
- cosmwasm-std: Add
wrapping_add,wrapping_sub,wrapping_mulandwrapping_powtoUint256/Uint512. - cosmwasm-schema: Better error messaging when attempting to compile schema
generator for
wasm32 - cosmwasm-vm: In the
secp256k1_verify,secp256k1_recover_pubkey,ed25519_verifyanded25519_batch_verifyimport implementations we now exit early if the gas left is not sufficient to perform the operation.
- cosmwasm-std: Remove
non_exhaustivefrom IBC typesIbcChannelOpenMsg,IbcChannelConnectMsgandIbcChannelCloseMsgin 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
untaggedenums
1.1.3 - 2022-09-29
- cosmwasm-schema:
IntegrityErroris 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
HexBinarywhich is likeBinarybut encodes to hex strings in JSON. AddStdError::InvalidHexerror case. (#1425)
- cosmwasm-vm: Bump
MODULE_SERIALIZATION_VERSIONto "v4" because the module serialization format changed between Wasmer 2.2 and 2.3 (#1426). - cosmwasm-schema: The
QueryResponsesderive macro now supportsQueryMsgs with generics. (#1429)
1.1.1 - 2022-09-15
- cosmwasm-schema: Using
QueryResponseswith aQueryMsgcontaining a unit-like variant will no longer crash. The different variant types in Rust are:It's still recommended to only use struct variants, even if there are no fields.enum QueryMsg { UnitLike, Tuple(), Struct {}, }
- cosmwasm-schema: It is no longer necessary to specify
serdeorschemarsas a dependency in order to makecosmwasm-schemamacros work.
1.1.0 - 2022-09-05
- cosmwasm-std: Implement PartialEq for
Binaryandu8arrays. - cosmwasm-std: Add
Uint{64,128,256,512}::one. - cosmwasm-std: Add
Uint{64,128,256,512}::abs_diffandDecimal{,256}::abs_diff(#1334). - cosmwasm-std: Implement
From<Decimal> for Decimal256. - cosmwasm-std: Implement
Rem/RemAssignforDecimal/Decimal256. - cosmwasm-std: Implement
checked_add/_sub/_div/_remforDecimal/Decimal256. - cosmwasm-std: Implement
pow/saturating_powforDecimal/Decimal256. - cosmwasm-std: Implement
ceil/floorforDecimal/Decimal256. - cosmwasm-std: Implement
PartialEqfor reference on one side and owned value on the other for allUintandDecimaltypes - cosmwasm-std: Implement
saturating_add/sub/mulforDecimal/Decimal256. - cosmwasm-std: Implement
BankQuery::Supplyto allow querying the total supply of a native token. In order to use this query in a contract, thecosmwasm_1_1feature needs to be enabled for thecosmwasm_stddependency. This makes the contract incompatible with chains running CosmWasm1.0. (#1356) - cosmwasm-std: Implement
MINconst value for allUintandDecimaltypes - cosmwasm-std: Implement
checked_div_euclidforUint256/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
abortfeature by default. This provides more helpful panic messages via a custom panic handler. - cosmwasm-std: Make
Decimal{,256}::DECIMAL_PLACESa publicu32value. - cosmwasm-crypto: Bumped
k2560.10.4 -> 0.11anddigest0.9 -> 0.10(#1374). - cosmwasm-vm: Rename features to capabilities, including
features_from_csvtocapabilities_from_csv;CacheOptions::supported_featurestoCacheOptions::available_capabilities;MockInstanceOptions::supported_featurestoMockInstanceOptions::available_capabilitiesInstance::required_featurestoInstance::required_capabilitiesAnalysisReport::required_featurestoAnalysisReport::required_capabilities.
- cosmwasm-vm: The
check_contractexample 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
abortfeature is enabled, cosmwasm-std installs a panic handler that aborts the contract and passes the panic message to the host. Theabortfeature 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
abortis created to abort contract execution when requested by the contract. (#1299) - cosmwasm-std: Add new
ibc3feature 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-wasmto 0.4.0 to fix u128/i128 serialization ofto_vec/to_binaryin some cases (#1297).
- cosmwasm-std: Implement
checked_multiply_ratioforUint64/Uint128/Uint256 - cosmwasm-std: Implement
checked_from_ratioforDecimal/Decimal256 - cosmwasm-std: Implement
Div/DivAssignforDecimal/Decimal256. - cosmwasm-vm: Add feature
allow_interface_version_7to run CosmWasm 0.16 contracts in modern hosts. Be careful if you consider using this!
- all: Updated Rust edition to 2021
- cosmwasm-std: Rename
SubMsgExecutionResponsetoSubMsgResponse. - cosmwasm-crypto: Update dependency
k256to ^0.10.4. - cosmwasm-vm:
BackendErrorwas changed tonon_exhaustivefor future extension;BackendErrornow implementsPartialEqfor easier test code; themsginBackendError::Unknownbecame non-optional because it was always set; the argument inBackendError::unknown/::user_errwas change toimpl Into<String>to avoid unnecessary clones.
- cosmwasm-std:
SubMsgExecutionResponseis deprecated in favor of the newSubMsgResponse.
- cosmwasm-std: Remove
Pairwhich was previously deprecated. UseRecordinstead. (#1282)
1.0.0-beta8 - 2022-04-06
- cosmwasm-std: Implement
MulAssignforDecimal/Decimal256. - cosmwasm-std: Implement
is_zero/atomics/decimal_placesas const for Uint and Decimal types. - cosmwasm-std: Implement
newandrawconst constructors forDecimal/Decimal256.
- all: Drop support for Rust versions lower than 1.56.1.
- cosmwasm-std:
MockQueriernow supports adding custom behaviour for handling Wasm queries viaMockQuerier::update_wasm(#1050).
- cosmwasm-std:
Api::addr_validatenow requires inputs to be normalized. - cosmwasm-vm: The
addr_validateimport now requires inputs to be normalized.
1.0.0-beta7 - 2022-03-22
- cosmwasm-std: Implement
Decimal{,256}::checked_mulandDecimal{,256}::checked_pow. - cosmwasm-std: Implement
Sub/SubAssignforUint64. - cosmwasm-std: Implement
Mul/MulAssignforUint64. - cosmwasm-std: Implement
RemAssignforUint64/Uint128/Uint256/Uint512. - cosmwasm-std: Implement
pow/checked_powforUint64/Uint128/Uint512. - cosmwasm-std: Implement
SubAssign/AddAssignforDecimal/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::RemforUint{64,128,256,512}.
- cosmwasm-std: Change type of
Reply::resultfromContractResultto the newSubMsgResult. Both types are equal when serialized butContractResultis 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_VERSIONto "v3-wasmer1". (#1224)
1.0.0-beta5 - 2022-02-08
- all: Drop support for Rust versions lower than 1.54.0.
- cosmwasm-std: The
Debugimplementation ofBinarynow 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
Isqrtexport (#1214).
- cosmwasm-vm: Fix
AddAssignimplementation ofGasInfo. - cosmwasm-vm: Bump
MODULE_SERIALIZATION_VERSIONto "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:
wasmerversion 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-featuresoption that defaults to "iterator,staking,stargate". - cosmwasm-vm: The default
singlepasscompiler is now supported on 64-bit Windows. - cosmwasm-std: Add missing
DivideByZeroErrorexport. - cosmwasm-std: Implement
std::iter::SumforDecimalandDecimal256.
- all: Drop support for Rust versions lower than 1.53.0.
- cosmwasm-std: The balance argument from
mock_dependencieswas removed. Remove&[]if you don't need a contract balance or use the newmock_dependencies_with_balanceif you need a balance. - cosmwasm-vm: Unlock cache mutex before module instantiation.
- cosmwasm-vm:
wasmerversion bumped2.0.0 -> 2.1.0
- cosmwasm-std: Remove the macros
create_entry_pointsandcreate_entry_points_with_migrationin 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::ContractInfovariant to get metadata about the contract, likecode_idandadmin. - cosmwasm-std: New field
Env::transactioncontaining info of the transaction the contract call was executed in. - cosmwasm-std: Implement
ops::MulforDecimalandDecimal256. - cosmwasm-std: New const methods
Uint128::to_be_bytes/::to_le_bytes. - cosmwasm-std: New const conversion methods
Uint256::from_uint128andUint512::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
iteratora required feature if theiteratorfeature flag is set (enabled by default). - cosmwasm-vm: Increase
MAX_LENGTH_HUMAN_ADDRESSfrom 90 to 256 in order to support longer address formats than bech32. - cosmwasm-std: Make
CustomQuerya subtrait ofClone, i.e. types that implementCustomQueryneed to beCloneable. - cosmwasm-std: Add generic for custom query type to
QuerierWrapper,Deps,DepsMutandOwnedDeps. MergeQuerierWrapper::custom_queryinto the now fully typedQuerierWrapper::query. - cosmwasm-std: Add generic type
Qfor 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_ackandibc_packet_timeout. - cosmwasm-std: In
DecimalchangeFraction<u128>toFraction<Uint128>, such thatDecimal::numeratorand::denominatornow returnUint128. - cosmwasm-std: Make methods
Uint256::to_be_bytes/::to_le_bytesconst. - cosmwasm-std: Make methods
Uint512::to_be_bytes/::to_le_bytesconst. - cosmwasm-std: Make method
Uint512::from_le_bytesconst. - cosmwasm-std: Rename
PairtoRecord.Pairis now an alias forRecordand deprecated. (#1108) - cosmwasm-vm: Bump required marker export
interface_version_7tointerface_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_pointsandcreate_entry_points_with_migrationin favour of the new, more flexible entry point system introduced in CosmWasm 0.14.
- cosmwasm-std: Remove
HumanAddr(deprecated since 0.14). UseStringinstead. - cosmwasm-std: Remove
KV(deprecated since 0.14). UsePairinstead.
0.16.2 - 2021-09-07
- cosmwasm-std: Implement
MulandMulAssignforUint128. - cosmwasm-std: Implement
FromStrforUint128,Uint256, andUint512. - cosmwasm-std: Make
Uint256::from_le_bytes,::from_be_bytesand::newconst. - cosmwasm-std: Added the
Decimal256type with 18 decimal places.
- cosmwasm-std: Implement
Decimal::from_ratiousing full uint128 multiplication to support a wider range of input values. - cosmwasm-std:
Decimal::from_rationow accepts any types that implementInto<Uint128>rather thanInto<u128>. - cosmwasm-crypto: Update dependency
k256to ^0.9.6. - cosmwasm-std: Add enum cases
ShltoOverflowOperation(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
Uint256andUint512types. - cosmwasm-std: Added implementations of
Isqrt(integer square root) forUint64,Uint128,Uint256, andUint512. - cosmwasm-std: Exposed
Uint{64, 128, 256}::full_mulfor full multiplication that cannot overflow.
- cosmwasm-std: In
ExternalApi::addr_validateand::addr_canonicalizedo not send too long inputs to VM to avoid terminating contract execution. Errors are returned instead now. - cosmwasm-std: Add enum cases
ShrtoOverflowOperation(breaking; #1059).
0.16.0 - 2021-08-05
- cosmwasm-std: Added the
IbcChannelOpenMsg,IbcChannelConnectMsg,IbcChannelCloseMsg,IbcPacketReceiveMsg,IbcPacketAckMsg, andIbcPacketTimeoutMsgtypes 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_timeoutsincemock_ibc_packet_ackis no longer usable for creating mock data foribc_packet_timeout. - cosmwasm-std: New
Attribute::newconstructor that does the same thing asattr. - cosmwasm-std::testing: Added
mock_wasm_attrwhen you really need to create anAttributewith a key starting with_in test code. - cosmwasm-std: Renamed
IBCAcknowledgementWithPacket->IbcPacketAckMsgto remove an unneeded level of indirection. - cosmwasm-std: Added
Event::add_attributesfor bulk adding attributes to anEventstruct. - cosmwasm-std: Added
Addr::into_stringfor explicit conversion
- cosmwasm-vm: The
Checksum::to_hexfunction signature was changed fromto_hex(&self) -> Stringtoto_hex(self) -> String. - cosmwasm-std: The
attrfunction now accepts types that implementInto<String>rather thanToString. - cosmwasm-std, cosmwasm-vm, cosmwasm-storage: The
iteratorfeature is now enabled by default. - cosmwasm-std: Make
MockApi::canonical_lengthprivate. - cosmwasm-vm: Make
MockApi::canonical_lengthprivate. - cosmwasm-vm: Bump required marker export
interface_version_6tointerface_version_7. - cosmwasm-std, cosmwasm-vm: Entrypoints
ibc_channel_open,ibc_channel_connect,ibc_channel_close,ibc_packet_receive,ibc_packet_ack,ibc_packet_timeoutnow each accept a correspondingMsgvalue 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_recvfunction now returns anIbcPacketReceiveMsg,mock_ibc_packet_ackrequires an acknowledgement to be passed and returns anIbcPacketAckMsg. - cosmwasm-std:
IbcBasicResponseandIbcReceiveResponsenow both support custom events via theeventsfield. - 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,IbcBasicResponseandIbcReceiveResponsecan no longer be constructed using struct literals. Use constructors likeResponse::newto construct empty structs and appropriate builder-style methods to set fields (response.add_message,response.set_data, etc). - cosmwasm-std:
Event,IbcChannel,IbcPacket,IbcAcknowledgementhave been markednon_exhaustive(can't be constructed using a struct literal by downstream code). - cosmwasm-std:
Event::attrhas been renamed toEvent::add_attributefor consistency with other types likeResponse. - cosmwasm-vm:
Instance::required_featureschanged from a property to a getter method. - cosmwasm-vm: Add
required_featuresfield toAnalysisReportwhich is returned byCache::analyze. - cosmwasm-vm: The VM now checks that exactly one
interface_version_*marker export is set. Forinterface_version_5andinterface_version_6(CosmWasm 0.14–0.15) more specific error messages were added.
- cosmwasm-std::testing:
mock_ibc_channelis now private. Usemock_ibc_channel_open,mock_ibc_channel_connect, ormock_ibc_channel_closeinstead.
0.15.2 - 2021-07-21
- cosmwasm-std: Export
VoteOptionas a top-level type.
0.15.1 - 2021-07-20
- cosmwasm-std: Export
GovMsgas a top-level type of the crate.
0.15.0 - 2021-06-24
- cosmwasm-std: Implement
SubandSubAssignforUint128 - cosmwasm-std: Implement custom events for contract execution results
- cosmwasm-std: Add
CosmosMsg::Govfor voting on governance proposals. - cosmwasm-storage: Implement
StorageforPrefixedStorageandReadonlyPrefixedStorage. NOTE: CallingsetorremoveonReadonlyPrefixedStoragewill panic!
- cosmwasm-std: Make
Uint128inner 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_LENand message length verification as this should not be a concern ofcosmwasm-crypto.
- cosmwasm-std: Rename the
sendfunction parameter tofundsinWasmMsgfor 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
wasmerto2.0.0 - cosmwasm-vm: ED25519 message length and batch length limits are now hardcoded
in
cosmwasm-vmitself 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 ofReplyOnas there is no natural default case anymore (#961). - cosmwasm-std: Merge
messagesandsubmessagesinto one list, usingReplyOn::Neverto model the "fire and forget" semantics (#961). - cosmwasm-std: Add
SubMsgconstructors:::new(),::reply_on_error(),::reply_on_success(),::reply_always(); Addwith_gas_limitto 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.kindtoEvent.ty. - cosmwasm-std: Rename
SubcallResponsetoSubMsgExecutionResponse. - contracts: Rename
ReflectSubCalltoReflectSubMsgandSubCallResulttoSubCallMsgin thereflectcontract. - cosmwasm-std: Rename the
subcallmodule tosubmessages. - cosmwasm-vm: Bump required marker export
cosmwasm_vm_version_5tointerface_version_6. - cosmwasm-std:
IbcAcknowledgementis renamed toIbcAcknowledgementWithPacketas it contains both data elements. (#975) - cosmwasm-std:
IbcAcknowledgementWithPacket.acknowledgementis no longer simplyBinary, but a newIbcAcknowledgementstructure, 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_soperation.
0.14.1 - 2021-06-14
- cosmwasm-std: Add
Timestamp::minus_secondsand::minus_nanos. - cosmwasm-std: Add
Addr::as_bytes - cosmwasm-std: Implement
std::ops::Subformath::Decimal - cosmwasm-std: Add
Timestamp::secondsandTimestamp::subsec_nanos. - cosmwasm-std: Implement division for
Decimal / Uint128 - cosmwasm-std: Add
math::Decimal::sqrt
- cosmwasm-std: Fix
Uint64::multiply_ratioandUint128::multiply_ratioso 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::analyzeprovides 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
stargatefeature 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
stargatefeature flag to enable new stargate and ibc features (#692, #706) - cosmwasm-std: (requires
stargate) Added newCosmosMsg::Stargatemessage type to dispatch protobuf-encoded message (contract must know proto schema) (#706) - cosmwasm-std: (requires
stargate) Added newQueryRequest::Stargatemessage 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,MigrateResponseandHandleResponsewhich makeContextobsolete. - contracts: added new
ibc-reflectcontract 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::Migratevariant that allows one contract (eg. multisig) be the admin and migrate another contract (#768) - cosmwasm-std: Added optional
systementry point that can only be called by native (blockchain) modules to expose admin functionality if desired. (#793) - cosmwasm-std: Add extra field
submessagestoResponse, such that you can get a callback from these messages after their execution (success or failure). (#796) - cosmwasm-std: Added
replyentry 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 u128as 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::Burnvariant when you want the tokens to disappear (#860) - cosmwasm-std: Create
Fraction<T>trait to represent a fractionp/qwith integerspandq.Decimalnow implementsFraction<u128>, which provides public getters::numerator()and::denominator(). - cosmwasm-std: Add
Decimal::invthat returns1/dfor decimald. - cosmwasm-vm: Add
Cache::metricsto expose internal data for monitoring purposes (#763). - cosmwasm-std: Implement
PartialOrdandOrdforBinaryusing the same lexicographical ordering as implemented byVec<u8>. - cosmwasm-std: Implement
PartialOrdandOrdforAddrusing the same lexicographical ordering as implemented byString. - cosmwasm-std: Added new
WasmMsg::UpdateAdminvariant that allows an admin contract (eg. multisig) to set another admin (#900) - cosmwasm-std: Added new
WasmMsg::ClearAdminvariant 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
Uint64analogously toUint128with 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::newandUint128::newto create instances in a const context.
- contracts: Rename
HandleMsgtoExecuteMsg. - all: Rename
handleentry point toexecute. - all: Rename
initentry point toinstantiate. - all: Rename
systementry point tosudo. - all: Drop support for Rust versions lower than 1.51.0.
- all: The
queryandexecuteentry 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_nextimport 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: MessageInfoargument from themigrateentry point (#690). - cosmwasm-std: Remove
from_addressfromBankMsg::Send, as it always sends from the contract address, and this is consistent with otherCosmosMsgvariants. - cosmwasm-std: Remove the previously deprecated
InitResult,HandleResult,MigrateResultandQueryResultin order to make error type explicit and encourage migration to custom errors. - cosmwasm-std: Add a
datafield toInitResponsethe same way as inMigrateResponseandHandleResponse. - cosmwasm-std: Rename
MessageInfo::sent_fundstoMessageInfo::funds. - cosmwasm-std: Merge response types
InitResponse,HandleResponseandMigrateResponseinto the newResponse. - cosmwasm-std: Remove
Defaultimplementation fromHumanAddr,CanonicalAddr,ContractInfo,MessageInfo,BlockInfoandEnv. If you need one of those, you're probably doing something wrong. - cosmwasm-std: Make
labelinWasmMsg::Instantiatenon-optional to better match the Go/database format. - cosmwasm-std: Add new field
admintoWasmMsg::Instantiateto fully supportMsgInstantiateContractfromx/wasm(#861). - cosmwasm-std:
Binary::to_arrayis now generic over the array length instead of the output type. As a consequence the obsolete typeByteArraywas removed. The array length is not restricted to 0-64 anymore. - cosmwasm-std: Use const generics to implement
From<&[u8; LENGTH]> for BinaryandFrom<[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_limitfromInstanceOptions, and define it instead atCachelevel (same memory limit for all cached instances). (#697) - cosmwasm-std: Rename type
KVtoPairin order to comply to naming convention as enforced by clippy ruleupper_case_acronymsfrom Rust 1.51.0 on. - cosmwasm-std:
ContractInfo::addressandMessageInfo::senderare 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_4tointerface_version_5. - cosmwasm-vm: Rename trait
ApitoBackendApito better express this is the API provided by the VM's backend (i.e. the blockchain). - cosmwasm-vm: Rename imports to
addr_canonicalizeandaddr_humanize(#802). - cosmwasm-vm: Replace types
HumanAddr/CanonicalAddrwith&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:
reflectcontract requiresstargatefeature and supports redispatchingStargateandIbcMsg::Transfermessages (#692) - cosmwasm-std: The arithmetic methods of
Uint128got 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)Uint128got 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_mulandsaturating_powwhich match their equivalent in u128 except that instead ofOptionthe checked methods return aResultwith anOverflowErrororDivideByZeroErrorthat carries a few debug information and can directly be converted toStdError/StdResultby using the?operator.StdError::UnderflowandStdError::underflowwere removed in favour ofStdError::Overflow.StdError::DivideByZeroErrorwas added.- The
-operator (impl ops::Sub<Uint128> for Uint128) was removed because it returned aStdResultinstead of panicking in the case of an overflow. This behaviour was inconsistent with+and the Rust standard library. Please use the explicit*_submethods introduced above. In a couple of releases from now, we want to introduce the operator again with panicking overflow behaviour (#858).
- cosmwasm-std: Replace
HumanAddrwithStringinBankQuery,StakingQueryandWasmQueryquery requests (#802). - cosmwasm-std: In staking query response types
Delegation,FullDelegationandValidatorthe validator address fields were changed fromHumanAddrtoString. The newAddrtype cannot be used here because it only supports standard account addresses viaApi::addr_*(#871). - cosmwasm-std: Change address types in
BankMsg,IbcMsgandWasmMsgfromHumanAddrtoString(#802). - cosmwasm-std:
Api::addr_humanizenow returnsAddrinstead ofHumanAddr(#802). - cosmwasm-std: Hide
StakingMsg,CosmosMsg::Staking,AllDelegationsResponse,BondedDenomResponse,Delegation,FullDelegation,StakingQuery,Validator,ValidatorsResponseandtesting::StakingQuerierbehind thestakingfeature flag to make those only available in contracts built for PoS chains. - cosmwasm-std: Remove
StakingMsg::Withdrawin favour ofDistributionMsg::SetWithdrawAddressandDistributionMsg::WithdrawDelegatorReward(#848). - cosmwasm-std: Rename
StakingQuery::Validators,ValidatorsResponseandQuerierWrapper::query_validatorstoStakingQuery::AllValidators,AllValidatorsResponseandQuerierWrapper.query_all_validators. AddStakingQuery::Validator,ValidatorResponseandQuerierWrapper::query_validatorto allow querying a single validator. (#879) - cosmwasm-schema: Make first argument non-mutable in
export_schema_with_titlefor consistency withexport_schema. - cosmwasm-std: The block time in
BlockInfo::timeis now aTimestamp.BlockInfo::time_nanoswas removed.
- cosmwasm-std:
InitResponse,MigrateResponseandHandleResponseare deprecated in favour of the newResponse. - cosmwasm-std:
Contextis deprecated in favour of the new mutable helpers inResponse. - cosmwasm-std:
HumanAddris not much more than an alias toStringand it does not provide significant safety advantages. With CosmWasm 0.14, we now useStringwhen there wasHumanAddrbefore. 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::defaultinstead. - cosmwasm-vm: Upgrade Wasmer to 1.0 and adapt all the internal workings accordingly.
- cosmwasm-vm: Export method
cosmwasm_vm::Cache::statsand response typeStats. - cosmwasm-vm: Remove
cosmwasm_vm::testing::MockApi::new. UseMockApi::defaultinstead. - cosmwasm-vm: Convert field
Instance::apito a method. - cosmwasm-vm: Change order of generic arguments for consistency in
Instance,CacheandBackendto always match<A: Api, S: Storage, Q: Querier>. - cosmwasm-vm: Remove
Instance::get_memory_size. UseInstance::memory_pagesinstead.
cosmwasm-std
StdErrornow implementsPartialEq(ignoring backtrace if any). This allows simplerassert_eq!()when testing error conditions (rather than match statements as now).
cosmwasm-std
- Deprecate
InitResult,HandleResult,MigrateResultandQueryResultin order to make error type explicit and encourage migration to custom errors. - Implement
DerefforQuerierWrapper, such thatQuerierWrapperbehaves like a smart pointer toQuerierallowing you to accessQueriermethods 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
thiserrorinstead ofsnafuto implementStdError. Along with this change, thebacktracesfeature now requires Rust nightly. - Rename
StdError::ParseErr::sourcetoStdError::ParseErr::source_typeandStdError::SerializeErr::targettoStdError::SerializeErr::target_typeto work around speacial treatment of the field namesourcein thiserror. - Rename
ExterntoDepsto unify naming. - Simplify ownership of calling
handle, etc. withDepsandDepsMutstruct that just contains references (DepsMuthas&mut Storageotherwise 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 useStorageeverywhere. And use&Storageto provide readonly access. This was only needed to letPrefixedStorage/ReadonlyPrefixedStorageimplement the common interface, which is something we don't need.
cosmwasm-storage
PrefixedStorage/ReadonlyPrefixedStoragedo not implement theStorage/ReadonlyStoragetraits anymore. If you need nested prefixes, you need to construct them directly viaPrefixedStorage::multilevelandReadonlyPrefixedStorage::multilevel.- Remove unused
TypedStorage. If you need this or similar functionality, you probably want to useBucketorSingleton. If you really need it, please copy the v0.11 code into your project. - Remove
StorageTransactionalong withtransactionalandRepLog. This has not been used actively for contract development and is now maintained in a contract testing framework.
cosmwasm-vm
- Remove
Storage::rangeandStorageIterator. The storage implementation is now responsible for maintaining iterators internally and make them accessible via the newStorage::scanandStorage::nextmethods. - Add
FfiError::IteratorDoesNotExist. Looking at this,FfiErrorshould probably be renamed to something that includes before, on and behind the FFI boundary to Go. MockStoragenow implements the newStoragetrait and has an additionalMockStorage::allfor 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_codeandCosmCache::get_instancetake options as anInstanceOptionsstruct. This containsgas_limitandprint_debugfor now and can easily be extended.cosmwasm_vm::testing::mock_instance_optionscan be used for creating such a struct in integration tests. - Make
FileSystemCachecrate internal. This should be used viaCosmCache. - Fix return type of
FileSystemCache::loadtoVmResult<Option<Module>>in order to differentiate missing files from errors. - Add in-memory caching for recently used Wasm modules.
- Rename
CosmCacheto justcosmwasm_vm::Cacheand addCacheOptionsto configure it. - Rename
ExterntoBackend. - Rename
mock_dependenciestomock_backendandmock_dependencies_with_balancestomock_backend_with_balances. - Rename
FfiError/FfiResulttoBackendError/BackendResultand adaptVmErroraccordingly.
cosmwasm-std
- Implement
From<std::str::Utf8Error>andFrom<std::string::FromUtf8Error>forStdError. - Generalize denom argument from
&strtoS: Into<String>incoin,coinsandCoin::new. - Implement
PartialEqbetweenBinaryandVec<u8>/&[u8]. - Add missing
PartialEqimplementations betweenHumanAddrandstr/&str. - Add
Binary::to_array, which allows you to copy binary content into a fixed-lengthu8array. This is especially useful for creating integers from binary data.
cosmwasm-std
- Implement
HashandEqforBinaryto allow usingBinaryinHashSetandHashMap. - Implement
HashandEqforCanonicalAddrto allow usingCanonicalAddrinHashSetandHashMap. - Implement
Add,AddAssignandSubwith 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/querychanged in an incompatible way. See the newContractResultandSystemResulttypes and their documentation. - Pass
Envintoqueryas well. As this doesn't haveMessageInfo, we removedMessageInfofromEnvand 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_nanostoBlockInfoallowing access to high precision block times. - Change
FullDelegation::accumulated_rewardsfromCointoVec<Coin>. - Rename
InitResponse::log,MigrateResponse::logandHandleResponse::logtoInitResponse::attributes,MigrateResponse::attributesandHandleResponse::attributes. - Rename
LogAttributetoAttribute. - Rename
logtoattr. - Rename
Context::add_logtoContext::add_attribute. - Add
Api::debugfor 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::UnauthorizedandStdError::unauthorizedin favour of custom errors. From now onStdErrorshould only be created by the standard library and should only contain cases the standard library needs. - Let
impl Display for CanonicalAddruse upper case hex instead of base64. This also affectsCanonicalAddr::to_string. - Create trait
CustomQueryfor 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_vecandCanonicalAddr::into_vec. - The
canonical_lengthargument 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_addressandMockApi::human_addresswas 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
storageis always first followed by namespace inBucket::new,Bucket::multilevel,ReadonlyBucket::new,ReadonlyBucket::multilevel,bucketandbucket_read. - Change order of arguments such that
storageis always first followed by namespace inPrefixedStorage::new,PrefixedStorage::multilevel,ReadonlyPrefixedStorage::new,ReadonlyPrefixedStorage::multilevel,prefixedandprefixed_read.
cosmwasm-vm
CosmCache::new,Instance::from_codeandInstance::from_modulenow take an additional argument to enable/disable printing debug logs from contracts.- Bump required export
cosmwasm_vm_version_3tocosmwasm_vm_version_4. - The
canonical_lengthargument was removed frommock_dependencies,mock_dependencies_with_balancesandMockApi::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_addressandMockApi::human_addresswas 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,unauthorizedin favour ofStdError::generic_errand friends. - Implement
From<&[u8; $N]> for BinaryandFrom<[u8; $N]> for Binaryfor all$N <= 32. - Add
Contextobject that can be used to build Init/Handle/Migrate response viaadd_log,add_message,set_dataand then convert to the proper type viaintoortry_into. Option to simplify response construction. - Env uses
HumanAddrformessage.senderandcontract_address - Remove
Apiargument frommock_env - Implement
From<&[u8]>andFrom<Vec<u8>>forCanonicalAddr
cosmwasm-vm
- Remove unused cache size argument from
CosmCache. set_gas_limitnow 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_regionfor 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
RegionValidationErrorandRegionValidationResult. Api::human_addressandApi::canonical_addressnow return a pair of return data and gas usage.- Remove
NextItemin 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::InvalidUtf8for the cases where the backend sends invalid UTF-8 in places that expect strings. - Remove
FfiError::Otherin favour ofFfiError::UserErrandFfiError::Unknown. - The
canonicalize_addressandhumanize_addressimports now report user errors to the contract. - Bump
cosmwasm_vm_version_2tocosmwasm_vm_version_3. Querier::raw_queryandQuerierResultwere removed in favour of the newQuerier::query_raw, which includes a gas limit parameter for the query.
cosmwasm-vm
- Add
Instance::create_gas_reportreturning a gas report including the original limit, the remaining gas and the internally/externally used gas.
cosmwasm-storage
- Add
.remove()method toBucketandSingleton.
- Downgrade wasmer to 0.17.0.
cosmwasm-std
- Replace type
NeverwithEmptybecause 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::getand all its implementations now returnOption<Vec<u8>>.ReadonlyStorage::rangeand 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
Querieris notCloneandSendanymore. consume_regionpanics on null pointers and returnsVec<u8>instead ofStdResult<Vec<u8>>.- Added contract migration mechanism. Contracts can now optionally export a
migratefunction 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.
handlecan still make use of the field. - Rename
MockQuerier::with_stakingtoMockQuerier::update_stakingto match::update_balance. - The obsolete
StdError::NullPointerandnull_pointerwere removed. - Error creator functions are now in type itself, e.g.
StdError::invalid_base64instead ofinvalid_base64. The free functions are deprecated and will be removed before 1.0.
cosmwasm-storage
- Remove
transactional_deps. Usetransactionalthat just provides a transactional storage instead. get_with_prefixreturnsOption<Vec<u8>>instead ofStdResult<Option<Vec<u8>>>.set_with_prefixandremove_with_prefixreturn nothing instead ofStdResult<()>.RepLog::commitno longer returns any value (always succeeds).Op::applyno longer returns any value (always succeeds).
cosmwasm-vm
- The export
allocatemust not return 0 as a valid address. The contract is responsible for avoiding this offset in the linear memory. - The import
db_readnow 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_nextnow 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_gasin 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::recylcedirectly to get back the external dependencies. - Rename
MockQuerier::with_stakingtoMockQuerier::update_stakingto match::update_balance. - Instead of panicking,
read_region/write_region/get_region/set_regionnow return a newCommunicationError::DerefErrwhen dereferencing a pointer provided by the contract fails. FfiError::set_messagewas removed because errors should be immutable. UseFfiError::otherto create an error with the desired error message.- The import implementation of
db_scannow errors instead of returning an error code for an invalid order value. The return type was changed tou32. - Remove
StorageIteratorItemin favour of the new typesStorageIteratorandNextItem.StorageIteratoris a custom iterator type that does not implement Rust'sIteratortrait, allowing it to communicate the used gas value of the lastnextcall to the VM. - Don't report any
VmErrorback to the contract incanonicalize_addressandhumanize_address. Only invalid inputs should be reported. - Move error cases
VmError::RegionLengthTooBigandVmError::RegionTooSmallintoCommunicationError. - In the
canonicalize_addressimplementation, 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
ReadonlyStorageintoStorage. - The imports
canonicalize_addressandhumanize_addressnow return a memory address to an errorRegion. If this address is 0, the call succeeded. - Bump
cosmwasm_vm_version_1tocosmwasm_vm_version_2.
cosmwasm-std
- The arguments of
logchanged from&strtoToString, allowing to pass various types likeString,HumanAddr,Uint128or primitive integers directly. - Add
From<Vec<u8>>andInto<Vec<u8>>implementations forBinaryfor zero-copy conversions.
cosmwasm-vm
- Deprecated
Instance::get_gasin 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
Instancecan now be set into readonly mode, which is checked by the writing storage importsdb_writeanddb_remove. Read-only mode is off by default for backwards compatibility.call_query_rawnow sets the instance's storage to readonly. - The new error case
VmError::WriteAccessDeniedis 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.lenintoRegion.capacityandRegion.length, where the new capacity is the number of bytes available andlengthis the number of bytes used. This is a breaking change in the contract-vm interface, which requires the same memory layout of theRegionstruct on both sides. - Add
removemethod toStoragetrait. - (feature-flagged) Add
rangemethod toReadonlyStoragetrait. 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
iteratorto both packages to enablerangefunctionality. 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
ChangeOwnerwill map tochange_ownerin the underlying JSON, notchangeowner. This is a breaking change for the clients. - Public interface between contract and runtime no longer uses
Stringto represent an error, but rather serializesApiErroras a rich JSON error. - Return value from
env.write_dbandenv.remove_dbto allow error reporting. - Query responses are now required to contain valid JSON.
- Renamed all
*_dbwasm imports todb_* - Merge
cw-storagerepo as subpackage, nowcosmwasm-storage - Add iterator support to
cosmwasm-storage Coin.amountis nowUint128rather 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 onCointypes, as well as enforcing valid amounts.Envno longer has acontract.balanceelement. If you need this info, please use theQuerierto 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_fundsis aVec<Coin>notOption<Vec<Coin>>. We will normalize the go response ingo-cosmwasmbefore sending it to the contract.Env.message.signerwas renamed toEnv.message.sender.Env.block.{height,time}are nowu64rather 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::memorycrate internal, as those symbols are not needed by users of the library. - Rename
cosmwasm::mock::dependencies->cosmwasm::mock::mock_dependenciesto differentiate between testing and productionExternal. - Export all symbols from
cosmwasm::mockas 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
cosmwasmtocosmwasm-std. - The export
allocatedoes not zero-fill the allocated memory anymore. - Add
remove_dbto the required imports of a contract. - (feature-flagged) add
scan_dbandnext_dbcallbacks from wasm contract to VM. serde::{from_slice, to_vec}returncosmwasm_std::Result, no more need to use.context(...)when calling these functions- Split
ResponseintoInitResponseandHandleResponse; splitContractResultintoInitResultandHandleResult. - Create explicit
QueryResponse, analogue toInitResponseandHandleResponse. - The exports
cosmwasm_vm_version_1,allocateanddeallocateare now private and can only be called via the Wasm export. Make sure tousecosmwasm_stdat least once in the contract to pull in the C exports. - Add
Queriertrait andQueryRequestfor query callbacks from the contract, along withSystemErrortype for the runtime rejecting messages. QueryRequesttakes a genericCustom(T)type that is passed opaquely to the end consumer (wasmdor integration test stubs), allowing custom queries to native code.{Init,Handle,Query}Resultare now just aliases for a concreteApiResulttype.- Support results up to 128 KiB in
ExternalStorage.get. - The
Storagetrait's.get,.setand.removenow return aResultto allow propagation of errors. - Move
transactional,transactional_deps,RepLog,StorageTransactioninto cratecosmwasm-storage. - Rename
ResulttoStdResultto differentiate between the auto-usedcore::result::Result. Fix error argument toError. - Complete overhaul of
ErrorintoStdError:- The
StdErrorenum 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
sourcefields anymore. Instead source errors are converted to standard types likeString. For this reason, bothsnafu::ResultExtandsnafu::OptionExtcannot be used anymore. - Backtraces became optional. Use
RUST_BACKTRACE=1to enable them. Utf8Err/Utf8StringErrmerged intoStdError::InvalidUtf8Base64Errrenamed intoStdError::InvalidBase64ContractErr/DynContractErrmerged intoStdError::GeneralErr- The unused
ValidationErrwas removed StdErroris now non_exhaustive, making new error cases non-breaking changes.
- The
ExternalStorage.getnow returns an empty vector if a storage entry exists but has an empty value. Before, this was normalized toNone.- Reorganize
CosmosMsgenum types. They are now split by modules:CosmosMsg::Bank(BankMsg),CosmosMsg::Custom(T),CosmosMsg::Wasm(WasmMsg) - CosmosMsg is now generic over the content of
Customvariant. 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-vmandgo-cosmwasmruntime. - Add
stakingfeature flag to expose newStakingMsgtypes underCosmosMsgand newStakingRequesttypes underQueryRequest. - Add support for mocking-out staking queries via
MockQuerier.with_staking from_slice/from_binarynow require result type to beDeserializeOwned, i.e. the result must not contain references such as&str.
cosmwasm-vm
- Make
Instance.memory/.allocate/.deallocate/.funccrate internal. A user of the VM must not access the instance's memory directly. - The imports
env.canonicalize_address,env.humanize_addressandenv.read_dbdon'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_6tocosmwasm_vm_version_1. - Provide implementations for
remove_dband (feature-flagged)scan_dbandnext_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::testingwrappers return standardResulttypes now, eg.Result<HandleResponse, ApiError>.- Add length limit when reading memory from the instance to protect against
malicious contracts creating overly large
Regions. - 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_readnow returns an error code if the storage key does not exist. The latest standard library converts this error code back to aNonevalue. This allows differentiating non-existent and empty storage entries. - Make
Instance::from_module,::from_wasmerand::recyclecrate-internal. - Create explicit, public
Checksumtype to identify Wasm blobs. CosmCache::newnow takes supported features as an argument.- Rename
VmError::RegionTooSmallErrtoVmError::RegionTooSmall. - Rename
VmError::RegionLengthTooBigErrtoVmError::RegionLengthTooBig. - Change property types to owned string in
VmError::UninitializedContextData,VmError::ConversionErr,VmError::ParseErrandVmError::SerializeErr. - Remove
VmError::IoErrin favour ofVmError::CacheErr. - Simplify
VmError::CompileErr,VmError::ResolveErrandVmError::WasmerRuntimeErrto just hold a string with the details instead of the source error. - Remove
VmError::WasmerErrin favour of the newVmError::InstantiationErr. - The snafu error builders from
VmErrorare now private, i.e. callers can only use the errors, not create them. VmErroris now#[non_exhaustive].- Split
VmError::RuntimeErrinVmError::BackendErrandVmError::GenericErr; renameVmError::WasmerRuntimeErrtoVmError::RuntimeErr. - Add
Instance.with_querieranalogue toInstance.with_storage.
cosmwasm
- Fix JSON schema type of
Binaryfrom int array (wrong) to string (right). - Make
ExternnotCloneable 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_handleandexports::do_query. - Make
ExternalStoragenotCloneable 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
SlicetoRegionto simplify differentiation between Wasm memory region and serde'sfrom_slice - Rename
ParamstoEnv,mock_paramstomock_envfor clearer naming (this is information on the execution environment) Response.logis 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_memorytoResult<usize, Error>to make it harder to forget handling errors. - Fix missing error propagation in
do_canonical_address,do_human_addressandallocate. - Update error return codes in import
c_read. - Rename imports
c_read/c_writetoread_db/write_db. - Rename imports
c_canonical_address/c_human_addresstocanonicalize_address/humanize_address. - Add
cosmwasm_vm::testing::test_iofor basic memory allocation/deallocation testing between host and guest. - Make
ValidationErr.msga dynamicStringincluding relevant runtime information. - Remove export
check_api_compatibility. The VM will take care of calling it. - Let
check_api_compatibilitycheck 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_storagefromcosmwasm_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
StoragefromReadOnlyStorageas 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