Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: split candid crate #471

Merged
merged 25 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 48 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[workspace]
members = [
"rust/candid",
"rust/candid_parser",
"rust/candid_derive",
"rust/ic_principal",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you recall why we put Principal back to candid a while ago? Also do we want to give it a more general name, e.g. ic_types, to accommodate more types in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We used to have the ic-types crate which contained principal and hash_tree modules.
The modules were moved to candid and agent-rs repo respectively. And ic-types is deprecated.

IMO, it's better to have ic_principal crate which contains only Principal. It will be a stable crate on the top of the dependency tree. We won't have to bump its version because of changes in other parts.

"tools/didc",
]
resolver = "2"
Expand Down
7 changes: 7 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@

# Changelog

## Rust 0.10.0

* The original `candid` crate is split into three crates:
* `candid`: mainly for Candid data (de-)serialization.
* `candid_parser`: used to be the `parser` and `bindings` module in `candid` crate.
* `ic_principal`: only for `Principal` and `PrincipalError`.

## Rust 0.9.9

* Set different config values for `full_error_message` and `zero_sized_values` for Wasm and non-Wasm target.
Expand Down
59 changes: 5 additions & 54 deletions rust/candid/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "candid"
version = "0.9.9"
version = "0.10.0"
edition = "2021"
authors = ["DFINITY Team"]
description = "Candid is an interface description language (IDL) for interacting with canisters running on the Internet Computer."
Expand All @@ -9,22 +9,16 @@ documentation = "https://docs.rs/candid"
repository = "https://github.com/dfinity/candid"
license = "Apache-2.0"
readme = "README.md"

categories = ["encoding", "parsing", "wasm"]
keywords = ["internet-computer", "idl", "candid", "dfinity", "parser"]
include = ["src", "Cargo.toml", "build.rs", "LICENSE", "README.md"]
build = "build.rs"

[build-dependencies]
lalrpop = { version = "0.20.0", optional = true }
categories = ["encoding", "wasm"]
keywords = ["internet-computer", "idl", "candid", "dfinity"]
include = ["src", "Cargo.toml", "LICENSE", "README.md"]

[dependencies]
byteorder = "1.4.3"
candid_derive = { path = "../candid_derive", version = "=0.6.3" }
codespan-reporting = "0.11"
crc32fast = "1.3.0"
data-encoding = "2.4.0"
hex = "0.4.2"
ic_principal = { path = "../ic_principal", version = "0.1.0" }
leb128 = "0.2.4"
num_enum = "0.6.1"
num-bigint = { version = "0.4.2", features = ["serde"] }
Expand All @@ -33,67 +27,24 @@ paste = "1.0.0"
pretty = "0.12.0"
serde = { version = "1.0.118", features = ["derive"] }
serde_bytes = "0.11"
sha2 = "0.10.1"
thiserror = "1.0.20"
anyhow = "1.0"
binread = { version = "2.1", features = ["debug_template"] }

lalrpop-util = { version = "0.20.0", optional = true }
lwshang marked this conversation as resolved.
Show resolved Hide resolved
logos = { version = "0.13", optional = true }
convert_case = { version = "0.6", optional = true }

arbitrary = { version = "1.0", optional = true }
# Don't upgrade serde_dhall. It will introduce dependency with invalid license.
serde_dhall = { version = "0.11", default-features = false, optional = true }
fake = { version = "2.4", optional = true }
rand = { version = "0.8", optional = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
stacker = "0.1"

[dev-dependencies]
goldenfile = "1.1.0"
test-generator = "0.3.0"
rand = "0.8"
criterion = "0.4"
serde_cbor = "0.11.2"
serde_json = "1.0.74"
serde_test = "1.0.137"
impls = "1"
bincode = "1.3.3"

[[bench]]
name = "benchmark"
harness = false
path = "benches/benchmark.rs"

[[test]]
name = "test_suite"
path = "tests/test_suite.rs"
required-features = ["parser"]
[[test]]
name = "value"
path = "tests/value.rs"
required-features = ["parser"]
[[test]]
name = "parse_value"
path = "tests/parse_value.rs"
required-features = ["parser"]
[[test]]
name = "parse_type"
path = "tests/parse_type.rs"
required-features = ["parser"]

[features]
configs = ["serde_dhall"]
random = ["parser", "configs", "arbitrary", "fake", "rand"]
parser = ["lalrpop", "lalrpop-util", "logos", "convert_case"]
all = ["random"]
mute_warnings = []

# docs.rs-specific configuration
# To test locally: RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --features all
[package.metadata.docs.rs]
features = ["all"]
# defines the configuration attribute `docsrs`
rustdoc-args = ["--cfg", "docsrs"]
20 changes: 0 additions & 20 deletions rust/candid/src/bindings/mod.rs

This file was deleted.

Loading