Closed agostbiro closed 2 years ago
I've managed to upgrade the coins-bip32
crate to k256 = "0.11"
and digest = "0.10"
, but I'm running into trouble upgrading the hashers in coins-core
to satisfy the new trait bounds required by DigestSigner
in k256 = "0.11"
. There are two blockers:
digest::VariableOutput::finalize_variable
now returns a Result
, but digest::FixedOutput
methods are infallible, which means we have to unwrap the Result
and potentially panic.
Original code:
impl digest::FixedOutput for Blake2b256 {
fn finalize_into(self, out: &mut DigestOutput<Self>) {
digest::VariableOutput::finalize_variable(self.0, |res| {
AsMut::<[u8]>::as_mut(out).copy_from_slice(&res[..32])
});
}
}
Code with digest = "0.10.3"
:
impl digest::FixedOutput for Blake2b256 {
fn finalize_into(self, out: &mut DigestOutput<Self>) {
digest::VariableOutput::finalize_variable(self.0, out).unwrap();
}
}
I don't understand well the uses of Blake2b256
in the project, but I'm wondering if it'd be possible to use a fixed output variant as the inner hasher which would allow sidestepping this issue.
DigestSigner
now requires the digest::core_api::CoreProxy
, which in turn requires the private digest::core_api::wrapper::sealed::Sealed
trait. I've opened an issue in the digest
repo to resolve this.
Thanks for #101 @mattsse ! I'm a little bit concerned about these lines:
If I'm not mistaken a potential error is being ignored there as digest::VariableOutput::finalize_variable
now returns a Result
.
--
Btw we've relaxed the DigestSigner
bounds in the ~digest
~ k256
crate in-between so there is potential for simplification in the hash implementations in the future:
https://github.com/RustCrypto/elliptic-curves/pull/613/files
According to the docs for variable output, that method errors if the buffer is of incorrect size, which we know not to be the case
Btw I've noticed that the DigestSigner
update has been released in k256 = 0.11.3
and the PR is actually using that version already, so I'm closing this issue.
noticed I didn't delete the old impl docs...
used expect
rather than silently dropping the result https://github.com/summa-tx/bitcoins-rs/pull/103
I'm trying to upgrade dependencies in ethers-rs and came across a problem where dependency conflicts with
coins-bip32
are blocking the upgrade. I've tried to upgrade relevant packages incoins-bip32
, but can't seem to get one of the macros right. I'm adding more detail in the attached PR.Diff in ethers-rs:
Conflict in ethers-rs: