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

Please bump to prost 0.12 #153

Open
siretart opened this issue Jul 6, 2024 · 3 comments · May be fixed by #154
Open

Please bump to prost 0.12 #153

siretart opened this issue Jul 6, 2024 · 3 comments · May be fixed by #154

Comments

@siretart
Copy link

siretart commented Jul 6, 2024

Version 0.12 introuduces TryFrom traits that appear to conflict with implementations in this crate.

cf. tokio-rs/prost#853

@siretart
Copy link
Author

siretart commented Jul 7, 2024

While trying to resolve this issue, I believe I'm running into tokio-rs/prost#927

I'm seeing this error with prost-build 0.12:

error[E0119]: conflicting implementations of trait `TryFrom<i32>` for type `generated_ops::can_do_crypto::CheckType`
   --> src/operations_protobuf/generated_ops/can_do_crypto.rs:11:68
    |
11  | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
    |                                                                    ^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `generated_ops::can_do_crypto::CheckType`
    |
   ::: src/operations_protobuf/generated_ops/mod.rs:124:1
    |
124 | impl TryFrom<i32> for CheckType {
    | ------------------------------- first implementation here
    |
    = note: this error originates in the derive macro `::prost::Enumeration` (in Nightly builds, run with -Z macro-backtrace for more info)

@megsdevs, I notice that you have closed tokio-rs/prost#955 last December. It appears to me that this issue may have been resolved in some other way, but the public github issues are not making it obvious to how. Can you, or maybe @LucioFranco or @0xAlcibiades help out here to get parsec rebuilt with prost-0.12?

Thank you so much!

@siretart
Copy link
Author

siretart commented Jul 8, 2024

I suppose that the definitions at

impl TryFrom<i32> for Cipher {
type Error = ResponseStatus;
fn try_from(cipher_val: i32) -> Result<Self> {
Cipher::from_i32(cipher_val).ok_or_else(|| {
error!(
"Value {} not supported as a cipher algorithm encoding.",
cipher_val
);
ResponseStatus::InvalidEncoding
})
}
}
impl TryFrom<i32> for Hash {
type Error = ResponseStatus;
fn try_from(hash_val: i32) -> Result<Self> {
Hash::from_i32(hash_val).ok_or_else(|| {
error!(
"Value {} not supported as a hash algorithm encoding.",
hash_val
);
ResponseStatus::InvalidEncoding
})
}
}
impl TryFrom<i32> for AeadWithDefaultLengthTag {
type Error = ResponseStatus;
fn try_from(aead_val: i32) -> Result<Self> {
AeadWithDefaultLengthTag::from_i32(aead_val).ok_or_else(|| {
error!(
"Value {} not supported as an AEAD with default tag length algorithm encoding.",
aead_val
);
ResponseStatus::InvalidEncoding
})
}
}
impl TryFrom<i32> for Raw {
type Error = ResponseStatus;
fn try_from(key_agreement_val: i32) -> Result<Self> {
Raw::from_i32(key_agreement_val).ok_or_else(|| {
error!(
"Value {} not supported as a raw key agreement algorithm encoding.",
key_agreement_val
);
ResponseStatus::InvalidEncoding
})
}
}
impl TryFrom<i32> for EccFamily {
type Error = ResponseStatus;
fn try_from(ecc_family_val: i32) -> Result<Self> {
EccFamily::from_i32(ecc_family_val).ok_or_else(|| {
error!(
"Value {} not supported as an ECC family encoding.",
ecc_family_val
);
ResponseStatus::InvalidEncoding
})
}
}
impl TryFrom<i32> for DhFamily {
type Error = ResponseStatus;
fn try_from(dh_family_val: i32) -> Result<Self> {
DhFamily::from_i32(dh_family_val).ok_or_else(|| {
error!(
"Value {} not supported as a DH family encoding.",
dh_family_val
);
ResponseStatus::InvalidEncoding
})
}
}
impl TryFrom<i32> for CheckType {
type Error = ResponseStatus;
fn try_from(check_type_val: i32) -> Result<Self> {
CheckType::from_i32(check_type_val).ok_or_else(|| {
error!(
"Value {} not supported as a check type.",
check_type_val
);
ResponseStatus::InvalidEncoding
})
}
}
are in conflict. However, just removing them seems to be insufficient.

@siretart
Copy link
Author

@ema any chance you could have a look?

Fabian-Gruenbichler added a commit to Fabian-Gruenbichler/parsec-interface-rs that referenced this issue Jul 11, 2024
derived Enumerations now provide their own conversion implementation
from i32, so map any DecodeErrors originating from there to
InvalidEncoding, and drop the manual impls that existed before.

Closes: parallaxsecond#153

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Fabian-Gruenbichler added a commit to Fabian-Gruenbichler/parsec-interface-rs that referenced this issue Jul 11, 2024
derived Enumerations now provide their own conversion implementation
from i32, so map any DecodeErrors originating from there to
InvalidEncoding, and drop the manual impls that existed before.

Closes: parallaxsecond#153

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
@Fabian-Gruenbichler Fabian-Gruenbichler linked a pull request Jul 11, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant