If peer discovery was disabled, we would still try to create a Node Record even though we hadn't initialized required fields.
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
We wrote the saved the new node record to disk but we didn't set it on the DiscoveryPeer class so we were still responding with the old one.
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
We were creating new in-memory storage segments each time we were
supposed to be retrieving it which prevented me from being able to test
what keys ended up being stored in that segment.
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Not all clients implement EIP-706, even though they may advertise a
version 5 in the hello packet. To cope with this if we are expecting
compression but haven't had a compressed message yet and a new message
fails to decompress we turn off compression and try again.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Remove all but 4 log4j2.xml config files
* The main config for the besu CLI app
* The config for the evmTool CLI app
* The config for acceptance tests
* A config in testUtil
If any tests depend on a log4j file they should import testutil.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* #1695 - Added support for EIP-868
Signed-off-by: David Mechler <david.mechler@consensys.net>
* Fix broken test
Signed-off-by: David Mechler <david.mechler@consensys.net>
* #1695 - Added tests for new functionality
Signed-off-by: David Mechler <david.mechler@consensys.net>
* #1695 - spotlessApply
Signed-off-by: David Mechler <david.mechler@consensys.net>
* Update changelog
Signed-off-by: David Mechler <david.mechler@consensys.net>
Adding the Log4j "jul" (java.util.logging) adapter resulted in many
messages like this at startup:
`main INFO Registered Log4j as the java.util.logging.LogManager.`
These come from the Log4j status logger. We can get rid of those by
setting the status attribute on all configurations to a higher logging
level. WARN is the next higher level.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* #1561 - Create/store/update ENR when local node is created
Signed-off-by: David Mechler <david.mechler@consensys.net>
* #1561 - spotlessApply
Signed-off-by: David Mechler <david.mechler@consensys.net>
* Update discovery library to prod version 0.4.1
Signed-off-by: David Mechler <david.mechler@consensys.net>
* Add DNS discovery for goerli, rinkeby and mainnet to help speed up discovery of peers
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* Add final to constant fields
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
Co-authored-by: David Mechler <david.mechler@consensys.net>
Allows nodes in a network to not strictly prefer older peers. This
helps break up impenetrable cliques in small, stable networks (private
networks often fit this description). We generate a random mask for the
lifetime of the process and use that to xor against the nodeId of a
potential peer. The desired behavior of the network is that some of the
nodes will allow the new peer to make an inbound connection but that
peer can't try to farm a nodeId that would make prioritize it over all
other peers in a guaranteed fashion.
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
This PR add the support to DNS. By default Besu refuses the use of a DNS but it is possible to use it by adding the following flag --Xdns-enabled=true. Adding this flag will resolve the hostname when starting besu and then it won't change
If there is a need for a more dynamic update (eg for permissioning) add also this flag --Xdns-update-enabled = true ( this will query the DNS every time. So you must trust the DNS on which you are looking for the IP)
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
handle peerAdded on admin_addPeer to add the peer to the PeerTable
handle peerRemoved on admin_removePeer to remove the peer from the PeerTable
Signed-off-by: Alexandre PARIS-VERGNE <alexpv14@gmail.com>
* add hive test
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* garbage endpoint in peerdisccontrollertest
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* rlp deserialization test
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* make things work with optional
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* PeerDiscoveryPacketPcapSedesTest changes from Optional getFrom
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* rlp deserialization test
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* allow empty from field in ping
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* comment
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* logging
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* cleanup rebase
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* scaffolding
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* pass hive
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* remove some stuff
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* comment
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* leave list properly
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* spotless
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* rename port -> udpPort
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* move comment
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* fix documentation bug
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* remove redundant supression
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* more accurate tests
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* empty commit to trigger build
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* #1066 Switched to use unprefixed hex strings for memory and stack values
Signed-off-by: David Mechler <david.mechler@consensys.net>
* Disable flaky tests per Ben Burns(Yeti) request
Signed-off-by: David Mechler <david.mechler@consensys.net>
* Revert last commit and enable ignored tests.
Signed-off-by: David Mechler <david.mechler@consensys.net>
* #1157 - updated to create 2 agents so that proper bonding can occur
Signed-off-by: David Mechler <david.mechler@consensys.net>
* #1162 - Updated test to mock the local peer PING packet creation so that the hash can be managed.
Signed-off-by: David Mechler <david.mechler@consensys.net>
* Add check for spoofed IP in ping message
* Add logging message when ping request is rejected.
Signed-off-by: David Mechler <david.mechler@consensys.net>
Upgrade to ErrorProne 2.4.0
* public constructors on abstract classes are removed
* Javadoc must have meaningfull documentation
* lambdas should not be variables
* Added to the list of confusing inner class names (Entry and Type)
* no assert keyword in tests
* Obsolete JDK classes produce errors now
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* replace whitelist/blacklist with allowlist/denylist and support both versions in CLI options
Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
DevP2P packets expiration fields should be in seconds past the epoch,
not milliseconds past the epoch.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Don't respond to neighbors and ping packets that have an expiration
prior to the system's current time.
Addresses two tests in #975
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Increase Netty threadpool size for handshake handling
It was found that all ECIES handhshaking is taking place in
an NioEventLoop of being serviced by one worker.
This in turn meant that, during periods of high demand,
many potential peers were timing out (as the latter peers
had to wait for earlier peers to complete prior to
being serviced).
This change grows the threadpool to 10 (arbitrarily selected),
which minimises the number of peers waiting for connectivity.
Signed-off-by: Trent Mohay <trent.mohay@consensys.net>
Co-authored-by: Jason Frame <jasonwframe@gmail.com>
IbftRound has been updated to accept Signing errors (eg no signature supplier available) and
continue operating if possible.
This also catches failures in signing and ECDH Key agreement
creation during discovery and handshaking.
Signed-off-by: Trent Mohay <trent.mohay@consensys.net>
Some of our loggers were not private, static, and final. In a few
cases these were non-static fields in classes that were repeatedly
instantiated in core transaction logic.
This is enforced via a new ErrorProne check, so the PR includes fixes
for all of the places this was a problem, not just the performance
impacting code.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>