ockam
ockam copied to clipboard
Remove/clean up `pub extern crate` in top level of `ockam_core`
In ockam_core
we re-export several libraries that we don't need to. We should clean this up. Specifically:
pub extern crate hex;
Anything that needs hex
should be changed to depend on hex
directly. (We might be able to remove hex
from ockam-core after this? Not sure, worth trying)
pub extern crate hashbrown;
Hashbrown's types are exported from ockam_core::compat
, so we shouldn't need to export the top level use directly.
pub extern crate async_trait;
We already export the macro separately, so async_trait
's crate shouldn't need to be public.
Hi I am new to Rust but would like to take up this issue
@iakev thank you for picking it up, let us know if you need help along the way
Thank you will update in case of anything
Hi all looking in ockam_core I have found the highlighted issues in the liblary script lib.rs . I am not sure how to proceed for them should I just delete them?
That's part of it. The other part is to follow the instructions suggested in the issue, which mainly has to do with the case where removing them may break existing code in other crates inside the repo.
For example, say you've you've found hex
, which I said:
Anything that needs hex should be changed to depend on hex directly.
There seem to be a few crates in the project which use ockam_core::hex
.
For example, ockam_vault
needs it here: https://github.com/ockam-network/ockam/blob/906ebab4bf2ed18191c966e050fb178298d14f0f/implementations/rust/ockam/ockam_vault/src/key_id_impl.rs#L3, so you should change that to be use hex::encode
, and add hex = { version = "0.4", default-features = false }
(same as from ockam_core
's Cargo.toml) to ockam_vault
's Cargo.toml.
Another example that's worth noting is ockam_key_exchange_xx
, which needs it only in test code here: https://github.com/ockam-network/ockam/blob/906ebab4bf2ed18191c966e050fb178298d14f0f/implementations/rust/ockam/ockam_key_exchange_xx/src/state.rs#L390, so you should change that to use hex::{...}
and add hex = "0.4"
to ockam_key_exchange_xx
's Cargo.toml's dev-dependency
section.
Etc.
Does that help?
Thanks for the clarification it surely helps a lot. Will keep you posted on any developments.
Best regards, Kevin Mwongera
On Mon, Nov 8, 2021, 21:36 Thom Chiovoloni @.***> wrote:
That's part of it. The other part is to follow the instructions suggested in the issue, which mainly has to do with the case where removing them may break existing code in other crates inside the repo.
For example, say you've you've found hex, which I said:
Anything that needs hex should be changed to depend on hex directly.
There seem to be a few crates in the project which use ockam_core::hex.
For example, ockam_vault needs it here: https://github.com/ockam-network/ockam/blob/906ebab4bf2ed18191c966e050fb178298d14f0f/implementations/rust/ockam/ockam_vault/src/key_id_impl.rs#L3, so you should change that to be use hex::encode, and add hex = { version = "0.4", default-features = false } (same as from ockam_core's Cargo.toml) to ockam_vault's Cargo.toml.
Another example that's worth noting is ockam_key_exchange_xx, which needs it only in test code here: https://github.com/ockam-network/ockam/blob/906ebab4bf2ed18191c966e050fb178298d14f0f/implementations/rust/ockam/ockam_key_exchange_xx/src/state.rs#L390, so you should change that to use hex::{...} and add hex = "0.4" to ockam_key_exchange_xx's Cargo.toml's dev-dependency section.
Etc.
Does that help?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ockam-network/ockam/issues/2161#issuecomment-963455418, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD64W4KGBNRBTEEU4T7PLELULAKCFANCNFSM5HKBFHJQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
I closed today a PR that we had open for a while (https://github.com/build-trust/ockam/pull/2565), as some of the changes it introduced were already on develop
.
The only pub extern crate
that still needs to be removed is pub extern crate async_trait
.