all
- Upgrade schemars to 0.7.
- Upgrade wasmer to 0.16.
- 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 new
ApiResult
andApiError
types to represent serializable counterparts toerrors::Result
anderrors::Error
. There are conversions fromError
into serializableApiError
(dropping runtime info), and back and forth betweenResult
andApiResult
(with the same serializable error types). - Add
Querier
trait andQueryRequest
for future query callbacks from the contract, along withSystemError
type for the runtime rejecting messages. {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
. - Rename
Error
toStdError
. 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.
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.
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