reth icon indicating copy to clipboard operation
reth copied to clipboard

feat(net): add peer_id/ip blacklist

Open Will-Smith11 opened this issue 2 years ago • 2 comments

Thought I would go ahead and add the blacklist mentioned in #327, this is just a first revision. before I go any father and write some tests for this.

Would like to confirm that they way that this is currently built aligns with the wanted design for this. @mattsse @gakonst thoughts?

Will-Smith11 avatar Dec 09 '22 01:12 Will-Smith11

Codecov Report

Merging #366 (9f310bc) into main (f489ec5) will increase coverage by 0.02%. The diff coverage is 77.77%.

@@            Coverage Diff             @@
##             main     #366      +/-   ##
==========================================
+ Coverage   73.76%   73.78%   +0.02%     
==========================================
  Files         232      235       +3     
  Lines       22001    22048      +47     
==========================================
+ Hits        16228    16269      +41     
- Misses       5773     5779       +6     
Impacted Files Coverage Δ
crates/net/network/src/session/handle.rs 0.00% <ø> (ø)
crates/net/network/src/session/mod.rs 63.81% <0.00%> (+0.20%) :arrow_up:
crates/net/network/src/peers/manager.rs 56.00% <82.35%> (+1.93%) :arrow_up:
crates/tasks/src/lib.rs 85.45% <0.00%> (-1.59%) :arrow_down:
crates/net/network/src/config.rs 62.26% <0.00%> (-1.38%) :arrow_down:
crates/stages/src/db.rs 73.64% <0.00%> (ø)
crates/stages/src/id.rs 100.00% <0.00%> (ø)
crates/stages/src/pipeline.rs 95.92% <0.00%> (ø)
crates/executor/src/executor.rs 85.64% <0.00%> (ø)
crates/executor/src/revm_wrap.rs 40.71% <0.00%> (ø)
... and 95 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Dec 09 '22 17:12 codecov-commenter

cool! A test would also be nice, but will defer to other opinions if a test should be left to a followup PR

was going to wait for #352 to be merged before adding tests as it would be the perfect spot to test the blacklist

Will-Smith11 avatar Dec 09 '22 23:12 Will-Smith11

@gakonst @mattsse is the plan to leave it up to the user to define how they want to supply the blacklist. from a user perspective it could be nice to be able to define a file that we read on startup and then through the network handle you can blacklist ips and peer ids that get written to the specified file on shutdown?

Will-Smith11 avatar Dec 10 '22 20:12 Will-Smith11

Yep I think all that should be configured in a Reth.toml / CLI which we haven't written yet and not a blocker for this pr.

But yeah same page, we want node operators to Config that at startup time.

We maybe want to add a reth_ namespace for reth specific ops, eg adding of removing someone from the banlist at runtime?

gakonst avatar Dec 10 '22 22:12 gakonst

This LGTM - thanks for taking care of all the nits! If @mattsse approves we can merge.

gakonst avatar Dec 11 '22 03:12 gakonst

This LGTM - thanks for taking care of all the nits! If @mattsse approves we can merge.

gakonst avatar Dec 11 '22 03:12 gakonst

test currently fail, I think we just need to install geth in CI

ref https://github.com/gakonst/ethers-rs/blob/master/.github/workflows/ci.yml#L37

mattsse avatar Dec 11 '22 08:12 mattsse

@Rjected did in separate PR I think

gakonst avatar Dec 11 '22 10:12 gakonst

https://github.com/paradigmxyz/reth/pull/373

gakonst avatar Dec 11 '22 10:12 gakonst