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

Support Rust no_std environments #347

Merged
merged 10 commits into from
Sep 5, 2023
Merged

Support Rust no_std environments #347

merged 10 commits into from
Sep 5, 2023

Conversation

DaniPopes
Copy link
Contributor

Add a "std" feature flag to the Rust bindings, enabled by default, which when disabled by consumers with no-default-features = true activates #![no_std] attribute.

This is achieved by using alloc for owned String and Vec, and using &CStr instead of &Path when std is not available.

I've also included some small warnings and lint fixes.

Copy link
Member

@jtraglia jtraglia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I like these changes. Thanks! Just one thing I'd like to point out (see my comment below), but it's not your problem. I'd like to have @asn-d6 and @pawanjay176 also review this before merging.

v.push(Blob::from_hex(blob)?);
}
return Ok(v);
self.blobs.iter().map(|blob| Blob::from_hex(blob)).collect()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, this change causes a stack overflow for me; testing on an M1 MacBook Air. This isn't really your problem though. I suspect it will be resolved if/when we start boxing blobs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's failing in CI as well, will revert

Copy link
Contributor

@pawanjay176 pawanjay176 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall.
The feature checks need to set the working directory and also the no-std check doesn't compile on the tests

@DaniPopes DaniPopes force-pushed the no_std branch 2 times, most recently from 88484a8 to 1ef16a9 Compare August 31, 2023 20:51
@DaniPopes
Copy link
Contributor Author

Should be good now

@jtraglia
Copy link
Member

@DaniPopes Ah sorry, that windows stack overflow issue is unrelated to your PR. We just fixed this. See:

You just need to pull in changes from main. Thanks for your work on this 🥇

@jtraglia jtraglia merged commit 551e2f9 into ethereum:main Sep 5, 2023
@DaniPopes DaniPopes deleted the no_std branch September 7, 2023 23:38
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