-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
|
||
#[test] | ||
fn encode_eth_status_message() { | ||
let expected = hex!("f85643018a07aac59dabcdd74bc567a0feb27336ca7923f8fab3bd617fcb6e75841538f71c1bcfc267d7838489d9e13da0d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3c684b715077d80"); |
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.
where's this test vector from?
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.
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.
LMK if still WIP or if you'd like a review |
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.
lgtm
@gakonst feel free to review, not WIP |
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.
lgtm.
remaining q re types
crates/net/eth-wire/src/status.rs
Outdated
use ethereum_forkid::ForkId; | ||
use fastrlp::{RlpDecodable, RlpEncodable}; | ||
use reth_primitives::Chain; | ||
use ruint::Uint; |
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.
is there a particular benefit for ruint
here?
I'd suggest using the U256 from primitives
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.
no real benefit, using U256 makes sense and should work
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's import from primitives then, this way we can easily replace the type if we end up doing this.
crates/net/eth-wire/src/status.rs
Outdated
pub total_difficulty: Uint<256, 4>, | ||
|
||
/// The highest difficulty block hash the peer has seen | ||
pub blockhash: [u8; 32], |
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 use H256 here?
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.
yep
crates/net/eth-wire/src/status.rs
Outdated
pub blockhash: [u8; 32], | ||
|
||
/// The genesis hash of the peer's chain. | ||
pub genesis: [u8; 32], |
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.
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
* 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>
…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) ```
…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) ```
…aiko_mono feat(gwyneth): update everything (except core protocol) to latest taiko-mono
…am-161605313 chore: merge upstream 1616053
This adds some code from ethp2p, just
Status
andEthVersion
for now. For the rest of the wire protocol, most types inprimitives
need to be complete and they need to implementfastrlp::{Encodable, Decodable}
. TheStatus
is specifically important for the initialeth
handshake implementation.