diff --git a/Cargo.lock b/Cargo.lock index 5cd091778f..8ae5e0aa99 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1514,6 +1514,28 @@ dependencies = [ "serde_bytes", ] +[[package]] +name = "ic-cycles-ledger-pic" +version = "0.1.0" +dependencies = [ + "candid", + "ic-cdk 0.16.0", + "ic-cycles-ledger-types", + "pocket-ic", + "serde", + "serde_bytes", +] + +[[package]] +name = "ic-cycles-ledger-types" +version = "0.1.0" +dependencies = [ + "candid", + "ic-cdk 0.16.0", + "serde", + "serde_bytes", +] + [[package]] name = "ic-ledger-types" version = "0.13.0" @@ -3197,6 +3219,7 @@ name = "shared" version = "0.0.2" dependencies = [ "candid", + "getrandom", "ic-canister-sig-creation", "ic-cdk 0.16.0", "ic-cdk-macros 0.16.0", diff --git a/Cargo.toml b/Cargo.toml index 3565764855..c6575668bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,8 @@ members = [ "src/backend", "src/cycles_ledger/client", + "src/cycles_ledger/pic", + "src/cycles_ledger/types", "src/shared" ] resolver = "2" @@ -11,6 +13,8 @@ ic-cdk = "0.16.0" ic-cdk-macros = "0.16.0" ic-cdk-timers = "0.9.0" ic-cycles-ledger-client = { path = "src/cycles_ledger/client" } +ic-cycles-ledger-pic = { path = "src/cycles_ledger/pic" } +ic-cycles-ledger-types = { path = "src/cycles_ledger/types" } ic-ledger-types = "0.13.0" ic-stable-structures = "0.6.7" ic-metrics-encoder = "1.1.1" diff --git a/Dockerfile b/Dockerfile index ee3488068e..d62f61b4af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,12 +51,18 @@ COPY Cargo.lock . COPY Cargo.toml . COPY src/backend/Cargo.toml src/backend/Cargo.toml COPY src/cycles_ledger/client/Cargo.toml src/cycles_ledger/client/Cargo.toml +COPY src/cycles_ledger/pic/Cargo.toml src/cycles_ledger/pic/Cargo.toml +COPY src/cycles_ledger/types/Cargo.toml src/cycles_ledger/types/Cargo.toml COPY src/shared/Cargo.toml src/shared/Cargo.toml ENV CARGO_TARGET_DIR=/cargo_target RUN mkdir -p src/backend/src \ && touch src/backend/src/lib.rs \ && mkdir -p src/cycles_ledger/client/src \ && touch src/cycles_ledger/client/src/lib.rs \ + && mkdir -p src/cycles_ledger/pic/src \ + && touch src/cycles_ledger/pic/src/lib.rs \ + && mkdir -p src/cycles_ledger/types/src \ + && touch src/cycles_ledger/types/src/lib.rs \ && mkdir -p src/shared/src \ && touch src/shared/src/lib.rs \ && ./docker/build --only-dependencies \ diff --git a/scripts/lint.rust.sh b/scripts/lint.rust.sh index 4c7374fdda..8a5157dcaa 100755 --- a/scripts/lint.rust.sh +++ b/scripts/lint.rust.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash set -euo pipefail -# Lint the rust code -cargo clippy --locked --target wasm32-unknown-unknown --all-features -- -D warnings -W clippy::pedantic -A clippy::module-name-repetitions -A clippy::struct-field-names -A deprecated +# Lint the Rust canister code, excluding the autogenerated crates. +for crate in src/backend/Cargo.toml src/shared/Cargo.toml; do + cargo clippy --manifest-path "$crate" --locked --target wasm32-unknown-unknown --all-features -- -D warnings -W clippy::pedantic -A clippy::module-name-repetitions -A clippy::struct-field-names -A deprecated +done diff --git a/src/cycles_ledger/pic/Cargo.toml b/src/cycles_ledger/pic/Cargo.toml new file mode 100644 index 0000000000..22e83f1c53 --- /dev/null +++ b/src/cycles_ledger/pic/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "ic-cycles-ledger-pic" +version = "0.1.0" +edition = "2021" + +[dependencies] +candid = { workspace = true } +ic-cdk = { workspace = true } +ic-cycles-ledger-types = { workspace = true } +pocket-ic = { workspace = true } +serde = { workspace = true } +serde_bytes = { workspace = true } diff --git a/src/cycles_ledger/pic/src/lib.rs b/src/cycles_ledger/pic/src/lib.rs new file mode 100644 index 0000000000..c0e200439e --- /dev/null +++ b/src/cycles_ledger/pic/src/lib.rs @@ -0,0 +1 @@ +//! TODO: Generate pic bindings. diff --git a/src/cycles_ledger/types/Cargo.toml b/src/cycles_ledger/types/Cargo.toml new file mode 100644 index 0000000000..e4e70e7a7d --- /dev/null +++ b/src/cycles_ledger/types/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "ic-cycles-ledger-types" +version = "0.1.0" +edition = "2021" + +[dependencies] +candid = { workspace = true } +ic-cdk = { workspace = true } +serde = { workspace = true } +serde_bytes = { workspace = true } diff --git a/src/cycles_ledger/types/src/lib.rs b/src/cycles_ledger/types/src/lib.rs new file mode 100644 index 0000000000..96fd24d04f --- /dev/null +++ b/src/cycles_ledger/types/src/lib.rs @@ -0,0 +1 @@ +//! TODO: generate types diff --git a/src/shared/Cargo.toml b/src/shared/Cargo.toml index 866a7e572c..922b516187 100644 --- a/src/shared/Cargo.toml +++ b/src/shared/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" [dependencies] candid = { workspace = true } +getrandom = { workspace = true } ic-canister-sig-creation = { workspace = true } ic-cdk = { workspace = true } ic-cdk-macros = { workspace = true }