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: add eth-wire #20

Merged
merged 9 commits into from
Oct 10, 2022
Merged

feat: add eth-wire #20

merged 9 commits into from
Oct 10, 2022

Conversation

Rjected
Copy link
Member

@Rjected Rjected commented Oct 7, 2022

This adds some code from ethp2p, just Status and EthVersion for now. For the rest of the wire protocol, most types in primitives need to be complete and they need to implement fastrlp::{Encodable, Decodable}. The Status is specifically important for the initial eth handshake implementation.


#[test]
fn encode_eth_status_message() {
let expected = hex!("f85643018a07aac59dabcdd74bc567a0feb27336ca7923f8fab3bd617fcb6e75841538f71c1bcfc267d7838489d9e13da0d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3c684b715077d80");
Copy link
Member

Choose a reason for hiding this comment

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

where's this test vector from?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure where this specific test vector is from, the exact difficulty doesn't seem to be in any block and I'm not sure where the hash came from (no uncles at that total difficulty's height either).

I had listened for incoming status messages on mainnet to get test vectors originally, this may be left over from that process.

@gakonst
Copy link
Member

gakonst commented Oct 8, 2022

LMK if still WIP or if you'd like a review

Copy link
Collaborator

@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.

lgtm

@Rjected
Copy link
Member Author

Rjected commented Oct 10, 2022

@gakonst feel free to review, not WIP

Copy link
Collaborator

@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.

lgtm.

remaining q re types

use ethereum_forkid::ForkId;
use fastrlp::{RlpDecodable, RlpEncodable};
use reth_primitives::Chain;
use ruint::Uint;
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there a particular benefit for ruint here?

I'd suggest using the U256 from primitives

Copy link
Member Author

Choose a reason for hiding this comment

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

no real benefit, using U256 makes sense and should work

Copy link
Collaborator

Choose a reason for hiding this comment

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

let's import from primitives then, this way we can easily replace the type if we end up doing this.

pub total_difficulty: Uint<256, 4>,

/// The highest difficulty block hash the peer has seen
pub blockhash: [u8; 32],
Copy link
Collaborator

Choose a reason for hiding this comment

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

can use H256 here?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep

pub blockhash: [u8; 32],

/// The genesis hash of the peer's chain.
pub genesis: [u8; 32],
Copy link
Collaborator

Choose a reason for hiding this comment

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

same

 * should unpin forkid and upgrade all once ethereum-types is bumped
   everywhere
 * forkid and fastrlp have no git history between versions, but forkid
   0.10 uses primitive-types 0.11 which is the same as current ethers
@gakonst gakonst merged commit d7c8b70 into main Oct 10, 2022
@gakonst gakonst deleted the dan/eth-wire branch October 10, 2022 16:46
@Rjected Rjected mentioned this pull request Oct 14, 2022
23 tasks
anonymousGiga added a commit to anonymousGiga/reth that referenced this pull request Feb 20, 2024
* adust th display order of fields

* refactor: Involving gas record and time record

* perf: update perf test code of cachedb

refactor: refactor something

---------

Co-authored-by: xudaquan2003 <xudaquan2003@gmail.com>
yutianwu pushed a commit to yutianwu/reth that referenced this pull request Jul 1, 2024
AshinGau pushed a commit to AshinGau/reth that referenced this pull request Oct 13, 2024
…ransactions (paradigmxyz#20)

Before Opt.
```
Independent Raw Transfers/Grevm Parallel
                        time:   [117.65 ms 118.22 ms 118.61 ms]
```
After Opt.
```
Independent Raw Transfers/Grevm Parallel
                        time:   [102.60 ms 103.34 ms 104.18 ms]
                        change: [-13.185% -12.440% -11.552%] (p = 0.00 < 0.05)
```
AshinGau pushed a commit to AshinGau/reth that referenced this pull request Oct 13, 2024
…ransactions (paradigmxyz#20)

Before Opt.
```
Independent Raw Transfers/Grevm Parallel
                        time:   [117.65 ms 118.22 ms 118.61 ms]
```
After Opt.
```
Independent Raw Transfers/Grevm Parallel
                        time:   [102.60 ms 103.34 ms 104.18 ms]
                        change: [-13.185% -12.440% -11.552%] (p = 0.00 < 0.05)
```
Brechtpd pushed a commit to taikoxyz/gwyneth that referenced this pull request Oct 17, 2024
…aiko_mono

feat(gwyneth): update everything (except core protocol) to latest taiko-mono
greged93 pushed a commit to greged93/reth that referenced this pull request Nov 8, 2024
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