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

fix: change Header::nonce to B64 #485

Merged
merged 3 commits into from
Apr 9, 2024
Merged

Conversation

klkvr
Copy link
Member

@klkvr klkvr commented Apr 9, 2024

Motivation

It was changed to u64 by accident probably, this nonce is not the same entity as transaction nonce (it is a hash, not a number), and it is reported by RPC as a 8-byte hex string

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Contributor

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

hmm this is also u64 in reth https://github.com/paradigmxyz/reth/blob/main/crates/primitives/src/header.rs#L76-L78 , not sure we should change this to B64?

Also, I think the enabling default tls commit slipped in

@klkvr klkvr force-pushed the klkvr/block-nonce branch from 77087c5 to 3fb91b0 Compare April 9, 2024 10:03
@klkvr
Copy link
Member Author

klkvr commented Apr 9, 2024

hmm this is also u64 in reth https://github.com/paradigmxyz/reth/blob/main/crates/primitives/src/header.rs#L76-L78 , not sure we should change this to B64?

yeah not sure if this should actually be u64 in consensus types

it was B64 in rpc-types and reth is currently pinned to alloy commit which has it as B64 in rpc_types::Header:

pub nonce: Option<B64>,

@klkvr
Copy link
Member Author

klkvr commented Apr 9, 2024

The spec defines it as bytes8 so it should definitely by serialized/deserialized as B64 https://github.com/ethereum/execution-apis/blob/90a46e9137c89d58e818e62fa33a0347bba50085/src/schemas/block.yaml#L72

Copy link
Contributor

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

gotcha, then lgtm, but pending @mattsse to double check

@mattsse mattsse merged commit 557b888 into alloy-rs:main Apr 9, 2024
18 checks passed
klkvr added a commit to klkvr/alloy that referenced this pull request Apr 11, 2024
* fix: change Block.nonce to B64

* clippy

* tests
ben186 pushed a commit to ben186/alloy that referenced this pull request Jul 27, 2024
* fix: change Block.nonce to B64

* clippy

* tests
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