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

Add conversion between ByteVector and FixedBytes #405

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Akagi201
Copy link

@Akagi201 Akagi201 commented Oct 8, 2024

It will help to work with alloy crates.

MSRV >= 1.81

The latest alloy-primitives crate requires rustc >= 1.79, and reth requires rustc >= 1.81

https://github.com/alloy-rs/core/blob/main/Cargo.toml#L8
https://github.com/paradigmxyz/reth/blob/main/Cargo.toml#L4

@ralexstokes
Copy link
Owner

do you have a use case in mind, e.g. another repo or project that needs the conversion?

I have been thinking for some time to base the primitives here around alloy to the extent possible, although we run into some blocks with deriving the relevant SSZ implementations

also bumping the MSRV is an important change so it would be nice to either surface that in this PR (or even make a separate PR)

@Akagi201
Copy link
Author

Akagi201 commented Oct 8, 2024

In alloy::rpc::types::beacon::BlsPublicKey;

/// BLS signature type
pub type BlsSignature = FixedBytes<BLS_SIGNATURE_BYTES_LEN>;

In ethereum_consensus::primitives::BlsPublicKey;

pub struct PublicKey(ByteVector<BLS_PUBLIC_KEY_BYTES_LEN>);

I face the issue that I need to convert between the above two types in my project. Also It will be better that we can only use alloy primitives types, maybe it's not easy.

The latest alloy-primitives crate requires rustc >= 1.79, and reth requires rustc >= 1.81

https://github.com/alloy-rs/core/blob/main/Cargo.toml#L8
https://github.com/paradigmxyz/reth/blob/main/Cargo.toml#L4

@Akagi201
Copy link
Author

Akagi201 commented Oct 8, 2024

Also I found that the ci lint errors are not related to my PR changes.

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.

2 participants