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

Can't leak crate-private traits error in libcrux-ml-kem #189

Closed
msprotz opened this issue May 19, 2024 · 8 comments
Closed

Can't leak crate-private traits error in libcrux-ml-kem #189

msprotz opened this issue May 19, 2024 · 8 comments
Assignees

Comments

@msprotz
Copy link
Contributor

msprotz commented May 19, 2024

Here are the revisions I'm working off of:

jonathan@verveine:~/Code/libcrux/libcrux-ml-kem (dev) $ git rev-parse head
b013f19f98b066f15bf931df38481a453a149aa8
jonathan@verveine:~/Code/libcrux/libcrux-ml-kem (dev) $ (cd $CHARON_HOME && git rev-parse head)
ed5047fd07e6c6aa8e7b9f352637f91977adacbe

If I try to extract libcrux-ml-kem, I get:

jonathan@verveine:~/Code/libcrux/libcrux-ml-kem (dev) $ charon
   Compiling libcrux-ml-kem v0.0.2-pre.2 (/Users/jonathan/Code/libcrux/libcrux-ml-kem)
   Compiling libcrux-sha3 v0.0.2-pre.2 (/Users/jonathan/Code/libcrux/libcrux-sha3)
warning: unknown lint: `private_bounds`
 --> libcrux-sha3/src/generic_keccak.rs:9:9
  |
9 | #[allow(private_bounds)] // TODO: figure out visibility
  |         ^^^^^^^^^^^^^^ help: did you mean: `trivial_bounds`
  |
  = note: `#[warn(unknown_lints)]` on by default

warning: unknown lint: `private_bounds`
  --> libcrux-sha3/src/generic_keccak.rs:23:9
   |
23 | #[allow(private_bounds)] // TODO: figure out visibility
   |         ^^^^^^^^^^^^^^ help: did you mean: `trivial_bounds`

error[E0445]: crate-private trait `traits::KeccakItem<N>` in public interface
  --> libcrux-sha3/src/generic_keccak.rs:11:1
   |
11 | pub struct KeccakState<const N: usize, T: KeccakItem<N>> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak crate-private trait
   |
  ::: libcrux-sha3/src/traits.rs:2:1
   |
2  | pub(crate) trait KeccakItem<const N: usize>: Clone + Copy {
   | --------------------------------------------------------- `traits::KeccakItem<N>` declared as crate-private

error[E0445]: crate-private trait `traits::KeccakItem<N>` in public interface
  --> libcrux-sha3/src/generic_keccak.rs:24:1
   |
24 | impl<const N: usize, T: KeccakItem<N>> KeccakState<N, T> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak crate-private trait
   |
  ::: libcrux-sha3/src/traits.rs:2:1
   |
2  | pub(crate) trait KeccakItem<const N: usize>: Clone + Copy {
   | --------------------------------------------------------- `traits::KeccakItem<N>` declared as crate-private

For more information about this error, try `rustc --explain E0445`.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ()', src/charon-driver.rs:91:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: `libcrux-sha3` (lib) generated 2 warnings
error: could not compile `libcrux-sha3` (lib) due to 2 previous errors; 2 warnings emitted
warning: build failed, waiting for other jobs to finish...
[ INFO charon_lib::export:111] [GCrateData<_, _>::serialize_to_file]: Generated the file: /Users/jonathan/Code/libcrux/build_script_build.llbc
@sonmarcho
Copy link
Member

sonmarcho commented May 21, 2024

@Nadrieril I want to change the priority of this issue (make it P1) but it doesn't appear in the dashboard. Any idea where the issue comes from? (I had to add the issue by hand)

@Nadrieril
Copy link
Member

Yeah it's a known limitation. GitHub project has an option to auto-import issues from one repo but only one. I chose aeneas a bit arbitrarily; this means we need to add charon issues to the project by hand. If we paid for a GitHub plan we'd have the option to auto-import from more repos. There might also be a way to use GitHub Actions to automate this, I'll have to look into it.

@Nadrieril Nadrieril self-assigned this May 22, 2024
@Nadrieril
Copy link
Member

Nadrieril commented May 22, 2024

@msprotz I think this is not due to charon itself but to the old rustc version it uses. The error says that it doesn't know the "private_bounds" lint, which was added to a more recent rustc version than the one we use. I think #186 should fix your issue.

@Nadrieril
Copy link
Member

@msprotz Can you try with latest charon main?

@msprotz
Copy link
Contributor Author

msprotz commented May 22, 2024

Yup I just need to wrap up my trait work first then will attempt upgrading tool versions. Expect a few days' delay.

@msprotz
Copy link
Contributor Author

msprotz commented May 24, 2024

I can confirm this is fixed. Thanks!

Actually I just saw this again. Will try to send a repro soon.

@msprotz msprotz closed this as completed May 24, 2024
@msprotz msprotz reopened this May 24, 2024
@Nadrieril
Copy link
Member

Has this happened again since?

@msprotz
Copy link
Contributor Author

msprotz commented Jun 3, 2024

I think the code got rewritten and I don't remember which set of revisions last triggered it. I'm ok with closing, and we'll reopen it if it resurfaces. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants