Skip to content

Conversation

@DaviRain-Su
Copy link

error[E0271]: type mismatch resolving <u64 as TryFrom<usize>>::Error == anyhow::Error
--> /Users/davirain/.cargo/git/checkouts/ics23-fbd6714e79a75cb1/5a0206f/rust/src/ops.rs:71:28
|
71 | let size: u64 = length.try_into()?;
| ^^^^^^^^ expected struct TryFromIntError, found struct anyhow::Error

Compiling getrandom v0.2.3
For more information about this error, try rustc --explain E0271.
error: could not compile ics23 due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed

When I added ics23 to substrate for testing to see if the error reported by no_std was well supported.

@hu55a1n1
Copy link
Contributor

Thanks for the PR @DaviRain-Su and thanks for this awesome library @ethanfrey! 🙏
It would be great if we could merge this because the ics23 crate fails to build in no_std mode currently and this PR fixes it. We're using this in our ibc-rs project and this issue is blocking our release.

Here's some context on the underlying cause of this issue ->

Since the ?-based error conversions would normally rely on the std::error::Error trait which is only available through std, no_std mode will require an explicit .map_err(Error::msg) when working with a non-Anyhow error type inside a function that returns Anyhow’s error type.

https://docs.rs/anyhow/1.0.44/anyhow/#no-std-support

@ethanfrey
Copy link
Contributor

@hu55a1n1 Thanks for bumping this issue and explaining why it was needed. It seems like follow up from #41

Note the pr review and my request for proper testing and cleanup of the no_std work in #42

If you want to take over getting no_std work merged, I would be happy. I would ask.

  1. rebase this pr.
  2. write at least one test to show the old code breaks, the new code works. If it is urgent, I can merge without tests, but prefer not to.
  3. Commit to taking over No-std cleanup #42 and possibly the trait prost::Message is not implemented for ics23::ProofSpec #46 so the no_std work is properly tested and doesn't turn into urgent requests under someone else's release timeline.

I know little about no_std but happy to merge if things are properly tested and covered by ci.

@ethanfrey
Copy link
Contributor

Replaced by #54 (same code rebased)

@ethanfrey ethanfrey closed this Nov 1, 2021
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 this pull request may close these issues.

3 participants