-
Notifications
You must be signed in to change notification settings - Fork 135
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
remove ssz_rs dependency #1671
base: master
Are you sure you want to change the base?
remove ssz_rs dependency #1671
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM 👍 !
crates/light-client/Cargo.toml
Outdated
trin-validation.workspace = true | ||
ethereum_ssz.workspace = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you sort these alphabetically
.expect("Unable to convert state root to bytes"), | ||
)?; | ||
let leaf_hash = leaf_object.tree_hash_root(); | ||
let state_root = bytes32_to_node(&Bytes32::from(attested_header.state_root.0.to_vec()))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let state_root = bytes32_to_node(&Bytes32::from(attested_header.state_root.0.to_vec()))?; | |
let state_root = B256::from_slice(&attested_header.state_root.0.to_vec()))?; |
genesis_root: Bytes32, | ||
) -> Result<Bytes32> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
genesis_root: Bytes32, | |
) -> Result<Bytes32> { | |
genesis_root: Bytes32, | |
) -> Result<B256> { |
let d = [start, end].concat(); | ||
Ok(d.to_vec().try_into()?) | ||
Ok(d.to_vec().into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok(d.to_vec().into()) | |
Ok(B256::from_slice(d)) |
) -> Result<Node> { | ||
let genesis_root = genesis_root.to_vec().try_into()?; | ||
) -> Result<B256> { | ||
let genesis_root = genesis_root.to_vec().into(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let genesis_root = genesis_root.to_vec().into(); | |
let genesis_root = B256::from_slice(genesis_root); |
} | ||
|
||
pub fn compute_domain( | ||
domain_type: &[u8], | ||
fork_version: Vector<u8, 4>, | ||
fork_version: FixedVector<u8, U4>, | ||
genesis_root: Bytes32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
genesis_root: Bytes32, | |
genesis_root: B256, |
object_root: Bytes32, | ||
domain: Bytes32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
object_root: Bytes32, | |
domain: Bytes32, | |
object_root: B256, | |
domain: B256, |
genesis_validator_root: Bytes32, | ||
} | ||
|
||
pub fn compute_signing_root(object_root: Bytes32, domain: Bytes32) -> Result<Node> { | ||
let mut data = SigningData { | ||
pub fn compute_signing_root(object_root: Bytes32, domain: Bytes32) -> B256 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub fn compute_signing_root(object_root: Bytes32, domain: Bytes32) -> B256 { | |
pub fn compute_signing_root(object_root: B256, domain: B256) -> B256 { |
crates/light-client/src/types.rs
Outdated
|
||
pub type Bytes32 = Vector<u8, 32>; | ||
pub type Bytes32 = FixedVector<u8, U32>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well remove this type Bytes32
and replace all with B256
@KolbyML, thanks for the feedback, I made the changes you suggested! |
What was wrong?
FIxes #1417
light-client crate used ssz-rs crate for SSZ handling instead of ethereum-ssz crate
How was it fixed?
This PR removes the ssz-rs dependency and uses ethereum-ssz instead
To-Do