* [MINOR] no fixed ports in tests
First enable "0" port in PeerDiscoveryAgent so it binds to
an open port. Then change the test to use two PeerDiscoveryAgents
The change to zero is accomplished by populating the endpoint with
the actual bound socket instead of the value passed in. If it is
zero the value will change otherwise it will be the value passed in.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* render error message to System.err instead of .out
* log and check exception type
* add else
* simplification of explanitory comment
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Metrics being captured initially:
Total number of peers ever connected to
Total number of peers disconnected, by disconnect reason and whether the disconnect was initiated locally or remotely.
Current number of peers
Timing for processing JSON-RPC requests, broken down by method name.
Generic JVM and process metrics (memory used, heap size, thread count, time spent in GC, file descriptors opened, CPU time etc).
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Upgrade dependency versions
* All version information is merged into one place
* Upgrade most version to their latest non-test version.
* dependencies are now sorted
Two dependencies were not upgraded:
errorprone - There are new checks that require build or source changes.
vertex - The license to eclipse 2.0 which is not in our current approved license list.
The change is trivial but for tracability it should be done alone.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Avoids throwing java.util.concurrent.ExecutionException when handling other framing errors in DeFramer.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Add the ipV6 flag to the datagram socket options, this creates a socket that handles both
ipv4 and ipv6 socket connections.
* Set the IPv6 flag state based on the presence or absence of an IPv6 address.
i.e. if your machine runs IPv6 it will accept IPv6 bootnodes and peers. However link-local IPv6 is not fully supported (see issue #288).
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
IBFT requires various aspects of the mining infrastructure in order
to create a proposed block.
This includes specifically the BlockCreator and MiningCoordinating,
the mining executor is not required at this stage, nor is the miner.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Allow IPv6 bootnodes to be specified by translating to address only form when
parsing a URI.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Throw FramingException when snappy decompression fails.
* Handle FramingException in DeFramer as a routine event representing a malformed message.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Remove release/retain requirement from MessageData.
MessageData now wraps a BytesValue rather than a Netty ByteBuf so we no longer need to call release/retain and pass that through to the underlying ByteBuf.
Entirely removed support for a BytesValue wrapping a Netty ByteBuf as it does not provide any way to release the underlying ByteBuf.
* Add BytesValue.copyTo(byte[]) to avoid the need to call getArrayUnsafe() to copy the data.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Some more logging level downgrades.
* At steady state we should get only one info level log per new block
* We don't need to know about peer stuff at info
* Caught up to best peer fires for every block
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Update value returned by web3_clientVersion to be ethstats friendly
* Version part starts with a v
* SNAPSHOT builds report 32 bits of the git hash
* OS and architecture are sniffed out and reported
* JVM version and branding are sniffed out and reported
Example values (not all real):
pantheon/v0.9.0-dev-f800a0b1/osx-x86_64/oracle-java-1.8
pantheon/v0.9.0-dev-27960b57/osx-x86_64/zulu-java-11
pantheon/v0.9.0/linux-arm64/openjdk-java-12
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Replace the JNI based snappy library with an all Java version.
This will help work on #251 because the error messages are more reasonable
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Add tests that hit the retry failure case
Move "complete what we just got" semantic into the
DownloadHeaderSequenceTask. Previously it was completing everything
in the chunk it was assigned.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Ban Peers via CLI
As part of working on #251 I needed to be able to ban certain nodes from my
connection pool and let others connect. This is a general solution to add
a --banned-nodeids CLI flag where the nodeIds of banned nodes are listed.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Introduce ProtocolScheduleBuilder and use it for Clique, MainNet, IBFT and dev.
* Remove default milestone blocks and simplify MainnetProtocolSchedule. All milestone blocks must now be defined in the genesis file (previously ethash chains would get Mainnet milestone blocks by default).
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Make GenesisConfigFile responsible for handling all the content in the genesis config file and rename GenesisConfig to GenesisState as it is now just responsible for creating the initial state at genesis.
* In CliqueProtocolController, pass the network ID to EthProtocolManager instead of the chain ID and use downloader parallelism setting instead of network ID for the number of threads.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
As recommended in #231 alter the API so that the
subclasses always return their list from executePeerTask in the
`CompletableFuture` and reset the retry in `#executeTask()` when any
non-empty list is returned.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Fix corner case where Memory did not clear target destination if the new bytes to set was empty.
* Use BytesValue.EMPTY instead of Bytes32.EMPTY to make it clear that it's a 0 length BytesValues rather than 32 bytes of zeross.
* Treat outputLength for call operations as a maximum length - when the actual data to output is shorter than outputLength, do not zero out the tail end of the memory range.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
A more robust fix: be tolerant of partial success. Instead of counting
every call as a limited retry change the semantics of
AbstractRetryingPeerTask such that it's retryCounter may be reset on a
partial success. Hence the limit is on consecutive zero progress
retries and large blocks dribbled in one at a time are not penalized.
Undo temp fix. Restore retries to 3 in a row.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Don't rely on sun.security.krb5.Confounder.bytes.
It's not reflected as part of the JDK platform and makes IDEs cranky.
* Use a better SecureRandom factory.
* spotless
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Introduce classes to wrap JSON config instead of accessing it directly in multiple places.
* Fix discrepancy in how CliqueProtocolSchedule and CliquePantheonController loaded the block period configuration.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
We create our own instance of Clock. However the java.time.Clock
provides what is needed and already exists on the platform.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Introduce createInMemoryBlockchain test utility and use it everywhere appropriate.
* Inject BlockchainStorage into DefaultMutableBlockchain.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Replace explicit usages of RocksDbKeyValueStorage with the more generic but now just as capable KeyValueStorage.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>