Provides better control over the maximum number of concurrent requests to a peer.
Gives a fairer allocation of peers to requests being made.
Avoids a task failing because all peers are busy which then introduces a delay before the request is retried.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Moves init code into a separate builder instead of a static init method, with common code in an abstract base class and subclasses of the builder for each of the consensus variants.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Move RocksDBStats to it's own module. This also brings metrics to
metrics:core since none of our other module have nested modules but
they have peer modules.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* [PRIV-41] Use metrics system for private state db
- Use PrivacyParametersBuilder to build PrivacyParameters
- refactor PrivacyParameters to expose default options
- refactor test builders to use PrivacyParameters.DEFAULT
- Use URI in Enclave
* Fix: enclave tests from bad merge
* Fix privacy acceptance tests after db configuration changes
* Switch to use nested class for PrivacyParametersBuilder
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Added ability to subscribe to dropped transactions from the transaction pending pool.
Implemented subscription webservice to support this.
* Added metrics to the pending transactions, tracking the number of local and remote transactions in the pool.
* Converted listener management in pending transactions to use the Subscribers util object.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Biggest change is that UnusedVariable and UnusedMethod went to WARN by
default. Since our build is a no warning build this means we either need
to turn them off or fix them. I mostly opted for the latter. Test code
was mostly fixed, unused loggers were deleted, and other shipped code
was mostly suppressed.
Two less noisy fixes to not use `SortedSet` and to use zero based
comparable results instead of -1, 0, and 1. Also a compiler nit in
errorprone was suppressed, per the description it won't affect us.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Store the instant that a pending transaction is added to the txpool, and expose this out through the api.
* Clock.systemUTC only used once.
* TestClock class added with a factory method for a fixed clock.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
With re-enabling IBFT 1.0, an error was introduced whereby the Eth/62
and ETH/63 protocols did not have a mapped ProtocolManager (resulting
in an eror at runtime).
This change ensures all protocols are handled by the Istanbul64
ProtocolManager.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Adds a PeerValidator that, when the Dao fork milestone is in use, checks that the Dao block is present on each peer when they connect and disconnects them if they are on the wrong chain.
Also:
* Make GetHeadersFromPeer task stricter in validating response matches.
* Update BlockHeadersMessage to return a list of headers
* Add more controls to DeterministicEthScheduler test util
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
There is a failure mode of IBFT whereby a validator fails to import
a block, and also fails to receive the NewBlock message from its
peers. This means said validator is unable to participate in
subsequent rounds, and may cause the network to halt.
To overcome this issue, if an IBFT validator receives messages from
a future height, it will update the "BestEstimatedHeight" of the
corresponding EthPeer object, such that the Synchroniser will
(eventually) download the requisite blocks - thus allowing the
IBFT network to continue to operate.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
It was identified during a demonstration that Pantheon, when running
in IBFT would show a "Bad Block Import" when a validator was added or
removed from the validator pool.
It was determined this was due to IBFT maintaining a single, 'global'
copy of the curent list of validators, which was updated when a block
was imported - thus when a block which had been imported vi IBFT
was then received via Eth block propogation, the validator list would
not align with the global list (as it had been updated in the IBFT
import).
The solution has been to utilise the VoteTallyCache as used in the
Clique implementation.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
With upcoming changes to remove the NewRound message, and place
the RoundChangeCertificate in the Proposal, it was decided to break
out the RoundChangeCertiifcate validation into a separate file
to minimise changes during message restructuring.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
This change moves blocks out from the signed portion of the IBFT messages (Proposal, RoundChange and NewRound).
This has grossly affected the message validators and message factories - but otherwise does not affect the general behaviour of the system (other than reducing message size of the NewRound messages).
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Two changes:
* Stream chains now take up less vertical lines, only breaking on
stream operations.
* Long annotations that span multiple lines no longer have a dangling
parentesis and indent 4 spaces.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
With a prior change swapping header validation for block
validation in the IBFT messages, the necessity to pass in the block
header was removed - though the code remained.
This change simplifies the MessageValidatorFactory interface to only
take the chain height (rather than the full parent header).
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
The IbftRoundFactory creates a MessageValidator for use within the
newly created round, however it does this bypassing the established
factory classes (MessageValidatorFactory).
This commit updates the IbftRoundFactory to use the correct API for
creating the message validator.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Add the services thread pool and a computation thread pool to the
EthScheduler.
* Services are long running, sequential, and infrequently start tasks
such as Full Sync and Fast Sync.
* Computations are short and high CPU intensity tasks such as ECDSA
signature extractions and POW validation. The intent is that each
runnable represents one such extraction and the extractions from a
block are saturated across available processing power. These
computations should have zero dependencies outside their object and
thread.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>