- Add
candid::MotokoResult
type. Usemotoko_result.into_result()
to convert the value into Rust result, andrust_result.into()
to get Motoko result.
- Breaking changes:
- Rewrite
configs
andrandom
modules, adapting TOML format as the parser.configs
module is no longer under a feature flag, and no longer depend on dhall. - Rewrite Rust bindgen to use the new
configs
module. Useemit_bindgen
to generate type bindings, and useoutput_handlebar
to provide a handlebar template for the generated module.compile
function provides a default template. The generated file without config is exactly the same as before.
- Rewrite
- Non-breaking changes:
utils::check_rust_type
function to check if a Rust type implements the provided candid type.
- Switch
HashMap
toBTreeMap
in serialization andT::ty()
. This leads to around 20% perf improvement for serializing complicated types. - Disable memoization for unrolled types in serialization to save cycle cost. In some cases, type table can get slightly larger, but it's worth the trade off.
- Fix bug in
text_size
- Fix decoding cost calculation overflow
- Fix length check in decoding principal type
- Implement
CandidType
forserde_bytes::ByteArray
- Add
pretty::candid::pp_init_args
function to pretty print init args
- Support
#[serde(rename = "")]
with arbitrary string. - Fix a performance bug in the type table parsing.
- Allow setting decoding quota for deserialization with the following new functions:
candid::decode_args_with_config
,candid::utils::decode_args_with_config_debug
,candid::decode_one_with_config
,candid::Decode!([config]; &bytes, T)
,candid::Decode!(@Debug [config]; &bytes, T)
,IDLArgs::from_bytes_with_types_with_config
andIDLArgs::from_bytes_with_config
. The original decoding method remains to be non-metered.
- Fix Typescript binding for init args.
- Fix parser when converting
vec { number }
intoblob
type.
- Add Typescript binding for init args.
- Fix HTTP header.
- Fix agent routing when running in remote environments.
- Fix display
IDLValue::Blob
to allow "\n\t" in ascii characters.
- Add an "assist" feature. Given a type, construct Candid value in the terminal with interactive dialogue.
- Add
didc assist
command. - Fix
didc decode --format blob
.
- Add
candid::types::value::try_from_candid_type
to convert Rust type toIDLValue
. - Display
IDLValue::Blob
in ascii character only when the whole blob are ascii characters.
- Add
import service
in parser to allow merging services.
- Export
PRINCIPAL_MAX_LENGTH
as a public constant. - Make all dependencies optional.
- Add II integration with URL parameter
ii
andorigin
.
- The original
candid
crate is split into three crates:candid
: mainly for Candid data (de-)serialization.candid::bindings::candid
moves tocandid::pretty::candid
.candid::pretty
moves tocandid::pretty::utils
. These modules are only available under feature flagprinter
(enabled by default).candid::{Int, Nat}
is only available under feature flagbignum
(enabled by default). If this feature is not enabled, you can usei128/u128
forint/nat
type.- Remove operator for
i32
andNat
. - Add
IDLValue::Blob(Vec<u8>)
enum for efficient handling of blob value. candid::types::number::pp_num_str
moves tocandid::utils::pp_num_str
.candid::types::value
module is only availble under feature flagvalue
.mute_warning
feature flag is removed, usecandid::types::subtype_with_config
instead.
candid_parser
: used to be theparser
andbindings
module incandid
crate.- Remove
FromStr
trait forIDLArgs
andIDLValue
. Useparse_idl_args
andparse_idl_value
respectively instead. TypeEnv.ast_to_type
becomescandid_parser::typing::ast_to_type
.bindings::rust::Config
uses builder pattern.candid
is re-exported incandid_parser::candid
.candid::*
is re-exported incandid_parser
.
- Remove
ic_principal
: only forPrincipal
andPrincipalError
.
- Add
candid::types::subtype_with_config
to control the error reporting level of special opt rule. - Add
Type.is_blob(env)
method to check if a type is a blob type. - Fix TS binding for
variant {}
.
- Set different config values for
full_error_message
andzero_sized_values
for Wasm and non-Wasm target. - Fix subtyping error message for empty type.
- Remove name duplication check in
candid_method
to avoid errors on certain IDEs. - Improvements in Candid UI
- Add II button, thanks to @Web3NL.
- Support streaming download of profiling data.
- Implement
CandidType
forstd::cmp::Reverse
. - Rust codegen: add
pub
for struct fields. - Fix
merge_init_types
andinstantiate_candid
when the main actor refers to a variable.
- Draw flamegraph for canister upgrade
- Upstream fix from
merge_init_types
- Add
utils::merge_init_args
to parse and mergecandid:args
metadata, and add the same endpoint in Candid UI. - Add
record!
andvariant!
macro to generate record and variant type AST. - Allow trailing comma in
func!
macro. - Add
minize_error_message
toIDLDeserialize::Config
.
- Improve Rust binding generation: 1) Fix generated code for agent; 2) Generated names conform to Rust convention: Pascal case for type names and enum tags; snake case for function names.
- Fix a bug when deriving empty struct/tuple enum tag, e.g.,
#[derive(CandidType)] enum T { A{}, B() }
. - Add
IDLDeserialize::new_with_config
to control deserializer behavior. For now, you can only bound the size of zero sized values.
- Fix error message for
subtype::equal
to report the correct missing label. - Recover subtype error from custom deserializer. This fixes some custom types for not applying special opt rule.
- Fix Candid UI to support composite query.
- Internally, move away from
BigInt::try_into
to allow more build targets, e.g. WASI and iOS. - Spec change: allow
record {} <: record {null}
. - Fix length counting of zero sized values.
- Remove
arc_type
feature.
utils::service_equal
to check if two service are structurally equal under variable renaming.utils::instantiate_candid
to generate metadata from did file: separate init args, flatten imports. For now, comments in the original did file is not preserved.impl From<Func/Service>
trait fordefine_function/define_service
macros.- Make
bindings::candid::pp_args
a public method. - Bump dependencies, notably
pretty
,logos
andsyn
.
- Bump agent-js to fix the new response code change
- Bump candid to 0.9
- Add a strict mode for
didc check
which checks for structural equality instead of backward compatibility.
- Deserializer only checks subtyping for reference types, fully conforming to Candid spec 1.4. You can now decode
opt variant
even if the variant tags are not the same, allowing upgrading variant types without breaking the client code. - The old
candid::Type
is nowcandid::TypeInner
, andType
is a newtype ofRc<TypeInner>
. This change significantly improves deserialization performance (25% -- 50% improvements) candid::parser
module is only available under feature flag"parser"
. This significantly cuts down compilation time and Wasm binary size- Disable the use of
candid::Func
andcandid::Service
to avoid footguns. Usedefine_function!
anddefine_service!
macro instead candid::parser::typing::TypeEnv
moved tocandid::types::TypeEnv
. Use ofcandid::TypeEnv
is not affectedcandid::parser::types::FuncMode
moved tocandid::types::FuncMode
candid::parser::value
moved tocandid::types::value
candid::parser::pretty
moved tocandid::bindings::candid::value
- Deprecate
ToDoc
trait for pretty printingIDLProg
, usecandid::bindings::candid
module instead - Deprecate
candid::codegen
, usecandid::bindings
instead - In
candid::bindings::rust
, there is aConfig
struct to control how Rust bindings are generated
- Macros for constructing type AST nodes:
service!
,func!
andfield!
- Support future types
- Bound recursion depth in deserialization for non-Wasm target (Wasm canister doesn't have a specified C ABI, and runs in a sandbox. It's okay to stack overflow)
- Limit the size of vec null/reversed in deserialization
Nat
serialization for JSON and CBOR- Support custom candid path for
export_service!
- Support
composite_query
function annotation
- Bug fix in TS bindings
- Pretty print numbers
- Downgrade
serde_dhall
for license issue.
- Fix: missing impl serde traits for
Principal
- Move
Principal
into this crate, no more re-exportic-types
- Bump
ic-types
to0.5
(fixinglookup_path
for hash trees)
- Implement
CandidType
forRc
andArc
- Fix TS binding for TypedArray
- Fix float tokenizer
- Derive
Serialize
forInt
andNat
- Fix parser: underscore for hexnum; semicolon at the EOF
- Fix semicolon in Rust binding
- Derive
Copy
,Eq
,Default
forReserved
- Bump
ic-types
to0.4
- Fetch did file from canister metadata
- Deprecate
localhost/_/candid
endpoint - Fetch name section from metadata (instrumented code)
- Bug fix for encoding
vec nat8
types - Disable profiler for query methods
- Update service methods in TS bindings to use ActorMethod, the type used by agent-js's Actor class
- Infer the type of
vec {}
tovec empty
to satisfy subtype checking - Expose more internal structures
- Bump ic-types to 0.3
candid::utils::service_compatible
to check for upgrade compatibility of two service types
- Generate Rust binding from Candid file (experimental)
- Ignore init args for subtype checking
- Pretty print text value with escape_debug
- More visitors for Nat and Int type
- Flamegraph when profiling feature is enabled
- Fix
subtype
function to take only one env. To check subtyping from two did files, useenv.merge_type(env2, ty2)
to merge the env and rename variable names.
- Release ARM binary for
didc
- Refine the spec for opt rules
- Support import when parsing did files with
check_file
function - Fix TypeScript binding for reference types
- Report profiling info when
__get_cycles
method is available - Add binding generation and subtype checking for Candid UI canister
- Update TypeScript binding to better integrate with dfx
- Set
is_human_readable
to false in Deserializer
- Update JS binding to use
Principal
from@dfinity/principal
- Add
#[candid_path("path_to_candid")]
helper attribute to the candid derive macro - Update
ic-types
to 0.2.0
- Update spec to introduce subtyping check in deserialization #168
- Coq proof for subtype check
- Update test suite to conform with the new spec
- Require full subtype checking in deserialization. This removes undefined behavior when trying to decode variant and empty vector at types that are not supertype of the wire type.
- Deserialization requires both
Deserialize
andCandidType
trait. de::ArgumentDecoder
,ser::ArgumentEncoder
moved toutils::{ArgumentDecoder, ArgumentEncoder}
.types::subtype
returnsResult<()>
instead ofbool
for better error message.- Disable subtyping conversion for opt rules in
IDLValue.annotate_type
. - Display type annotations for number types.
- Better error messages in deserialization
- Remove unnessary
reqwest
dependency - Implement CandidType for
str
didc bind
to support Motoko bindingsdidc hash
to compute hash of a field namedidc decode
can decode blob format- Candid UI canister
- Fix a bug for serializing recursive values in Rust CDK #210
- Use BigInt in JS/TS binding
- Fix TypeScript binding for tuple
- Rust support for Func and Service value
#[candid_method(init)]
to support init arguments in service actor- Subtyping check for Candid types
- Handle subtyping for
reserved
andint
in decoding
- Benchmark for Rust library with criterion
didc check
anddidc subtype
command to check for subtyping- Conditional running CI for Coq or Rust library
- Support
serde_bytes
for efficient handling of&[u8]
andVec<u8>
- Typescript binding for Candid
- Support more native Rust types: Path, PathBuf, VecDeque, LinkedList, BinaryHeap, Cow, Cell, RefCell
- Documentation for type mapping and howto section
didc bind
to generate typescript binding
- Generate random Candid values
- Sort method names lexicographically
- Candid user guide
- More Coq proof for MiniCandid
didc random
command and an experimental config file
- Better pretty printer for Candid value
- Support reference types
- Support more native Rust types: HashMap, HashSet, BTreeMap, BTreeSet, i128, u128
- Bug fix for empty record detection when deserializing to native Rust types
- Test suites for reference types
didc encode
supports outputing blob format
- Bug fix for opt subtyping
- Formalize definitions of IDL-soundness in Coq
- Support the opt subtyping rules
- Allow using Rust keyword as field label
- Add opt subtyping tests
- Rewrite description of deserialization #128
- Add result getter for serializer
- Implement CandidType for std::time::SystemTime and Duration
- Support service constructor
- Export
init
types in JS binding for service constructor - Improve pretty-printing for Candid values: underscore for numerals, blob shorthand for
vec nat8
. - Disable pretty-printing for large vectors.
- Add attribute
#[candid_method]
to derive Candid types for functions. - Add a feature flag
cdk
to generate candid path specifically for Rust CDK.
- Candid UI canister to render a web UI for all running canisters on the network.
- Fix a bug when decoding nested record values.
- Add
encode_args
anddecode_args
functions to encode/decode sequence of arguments.
- Use
ic-types
for Principal (breaking change) - Support type annotations in parsing Candid values
- Support float e notation
- Support nested comments
- Pretty print decoded candid values
- New lexer using the
logos
crate - Use
codespan-reporting
to report Rust-like parsing errors
- Fix deserialization to validate type table and detect infinite loop in
type T = record { T }
- Fix serialization for newtype struct
- Display trait for pretty printing
types::Type
- More test suites for prim and construct types
- Tools for emitting JavaScript tests from Candid test suites
- Publish
didc
andcandiff
binary in the release - Generate JS tests from the Candid test suites
- No longer requires the shortest LEB128 number in deserialization #79
- Parser improvements:
- Floats in fractional number, no e-notation yet
- Comments (no nested comments)
- Blob shorthand for
vec nat8
value - Fix text parser to valiate utf-8 encoding
- Bounds check for bool and text
- Type annotation for reserved
- Initial commit for didc and candiff tools
- Add Candid test suite