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

feat: support no_std for alloy-eips #181

Merged
merged 3 commits into from
Mar 13, 2024
Merged

Conversation

yjhmelody
Copy link
Contributor

@yjhmelody yjhmelody commented Feb 4, 2024

And remove unused error Custom

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

I think we can do that, so supportive, doesn't hurt.

though I'd like to not use thiserror-no-std and instead do all of that manually
can do expand and copy the generated code+cleanup

crates/eips/src/eip2718.rs Outdated Show resolved Hide resolved
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lg on the no-std changes

though about the error type. I'm skeptical that this even belongs in there if it's only used in the consensus crate

https://github.com/search?q=repo%3Aalloy-rs%2Falloy%20Eip2718Error&type=code

we should move it there imo

wdyt @DaniPopes

Cargo.toml Outdated
@@ -83,10 +81,11 @@ rand = "0.8.5"
reqwest = { version = "0.11.18", default-features = false }
semver = "1.0"
thiserror = "1.0"
thiserror-no-std = { version = "2.0", default-features = false }
Copy link
Member

Choose a reason for hiding this comment

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

we don't need this

Comment on lines -22 to -24
/// Some other error occurred.
#[error(transparent)]
Custom(#[from] Box<dyn std::error::Error>),
Copy link
Member

Choose a reason for hiding this comment

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

I think eventually we'd need this, so perhaps the better question for this PR is, does this type even belong in here?

perhaps we should rather move this to the consensus crate instead, I believe it's better suited in there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean?
Move all eip error type to consensus crate? and add Error type to trait such as Decodable2718?

Copy link
Contributor Author

@yjhmelody yjhmelody Feb 6, 2024

Choose a reason for hiding this comment

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

But that might be a break change, which the current one is not? Maybe it should be improved in subsequent versions?

Copy link
Member

Choose a reason for hiding this comment

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

removing a variant is a breaking change as well, I'd really prefer moving the error. imo it does not belong in the eip crate

Comment on lines +19 to 20
#[derive(Debug, Copy, Clone)]
pub enum Eip2718Error {
Copy link
Member

Choose a reason for hiding this comment

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

I still think we should move this error type and keep the custom variant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I still think we should move this error type and keep the custom variant

i want to how tohandle the related trait

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

ah let's just do that separately,

ty

lgtm, pending @DaniPopes

@prestwich
Copy link
Member

though about the error type. I'm skeptical that this even belongs in there if it's only used in the consensus crate

not opposed to removing it, the purpose of it is to allow for non-RLP encoding schemes in EIP-2718 in non-Ethereum networks. E.g. if Optimism decides to have a fallible SSZ encoding for some transaction type, the existing API can still capture that behavior via the Custom error

@prestwich
Copy link
Member

'I have rebased this and it should go through re-review @mattsse

@prestwich
Copy link
Member

cleaning up CI before merge 👍

@prestwich
Copy link
Member

nightly clippy strikes again

rust-lang/rust#121708

@prestwich prestwich merged commit fa155ac into alloy-rs:main Mar 13, 2024
15 checks passed
@prestwich
Copy link
Member

ty for you contribution @yjhmelody, sorry for leaving it open so long 🙇‍♀️

@yjhmelody yjhmelody deleted the feat-no-std branch March 14, 2024 02:25
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.

4 participants