* [PAN-2786] Stop Transaction Pool Queue from Growing Unbounded
- use a `ArrayBlockingQueue` with a fixed size to limit the transaction task queue
- expose a method in `MonitoredExecutors` to create a working queue with a maximum capacity
- update `EthScheduler` to use a limited working queue for the `txWorkerExecutor`
* [PAN-2786] Implement a bounded timed queue
- implement a custom bounded queue
- use a time based policy with keep alive configuration
- implement eviction process based on the policy
- add metrics
* use field instead of parameter
* fix PR pass 1
- use concrete class instead of interface
- change metric name to comply with global policy
- update unit test
- wrap `Runnable` into `scheduleTxWorkerTask`
* fix PR
- remove time based policy
- use raw `Runnable`
- make a room for a new element at full capacity
* Update BoundedQueueTest.java
invert condition
* fix PR comments
- remove Mock class
- make logic more thread safe, avoid race condition
- remove element until the new one is accepted
* Update ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/EthScheduler.java
Co-Authored-By: Adrian Sutton <adrian@symphonious.net>
* spotless apply
* fix nit comments
- use assertj assertions for better readability
- improve unit test
* spotless apply
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* [PAN-2630] Synchronizer should disconnect the sync target peer on invalid block data
- check if headers are sequential
- if sequential, check if they form a chain, if not, disconnect the peer
* update behaviour and add tests
- change checks order
- add log message
- write tests
* disconnect sync target when InvalidBlockException
* remove power mockito
- remove powermockito
- write tests in subclasses of the `AbstractGetHeadersFromPeerTaskTest`
* fix Exception check bug
* fix PR discussion first pass
- add assertion to check when the peer is disconnected
- add assertion to check the peer has not been disonnected
- undo remove final on class
- remove sync target field
* remove spy invocation
* spotlessApply
* shouldDisconnectPeerIfInvalidBlockException
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Add eea_getPrivacyPrecompileAddress API in pantheon
* Return error is privacy is not enabled
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Make MetricCategory an interface so it isn't locked into the pantheon specific categories.
* Split categories into StandardMetricCategory and PanteonMetricCategory to separate the common and Pantheon specific categories.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Query params can be used to adjust the number of peers required and number of blocks tolerance to be considered in sync.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
- Previously you had to sign the private transaction with the same key as the privacy marker transaction.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* streamline `JsonRpcParameter.required` method
* add test cases for PAN-2721
* clarify TopicParameter parsing comments
* consume end of array in TopicParameter custom deserializer
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Return specific error for enclave
* Serialize into error object instead of regex to find the error.
* Return EnclaveException for errors in Enclave
* Fix enclave error response after rebase
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Previously it was possible for a transaction to be "missed" by this call if it was added to a block between when we checked the blockchain and when we checked the pending transaction pool.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Don't create a new SecureRandom instance every time a filter ID is generated.
Fix intermittency in FilterIdGeneratorTest - quantity values omit leading 0s.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Connection ID is now tracked as a property of the subscription rather than as a separate map, so we can use a single concurrent map to track all details of subscriptions.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Prevents intermittent `eth_getFilterLogs` failure when the `filterId`
began with a hex 0. Previously leading 0's were not trimmed so depending
on the randomly generated value, a filter could appear to not exist in
the `FilterRegistry`
* standardize Quantity.format to Quantity.create
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Previously was only set after callbacks were invoked, allowing additional messages to be sent while parts of the supporting infrastructure for the peer was being torn down.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* GraphQL library upgrade changes.
one more NPE path for GraphQL sniffed out. With more tests.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Adds metrics to expose:
* height of best known block
* synchronizer in sync flag
* max peers
* Timestamp of current chain head
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Most libraries with newer stable versions were upgraded to their
newest stable version
* One exception is RocksDB, where a previous update caused a performance
regression. the 6.0.1 update will be tested in another PR
* GraphQL got stingier about null variable maps, so empty maps were passed instead
* errorprone plugin got stricter with it's variable access
* There was a license that was slightly different, creating 2 MIT licenses in the license report.
* Gradle wanted a new almost identical wrapper jar.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
When looking for a specific block and failing we should explain why
in the error message.
Also, clean up test names and grouping
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>