* Do parallel extract signatures in the parallel block importer.
* remove the extraction from FullSyncBlockHandler
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
There's an issue with the world state downloader where the download process could stall. The sequence goes like:
1. Inside requestDataFromPeer thread A takes out the sendingRequests lock
2. Thread A checks shouldRequestNodeData which returns true
3. Thread A sends a request for data
4. Thread A checks shouldRequestNodeData which returns false so it exits the while loop
5. Thread B receives the response to the (only) outstanding request
6. Thread B enters shouldRequestNodeData but fails to get the sendingRequests lock so exits the method
7. Thread A releases the sendingRequests lock and exits the methods
There are now no threads checking if they should send new requests and no outstanding requests to trigger a check in the future so the download is stuck and will never make anymore progress.
The fix is to switch the order of taking out the sendingRequests lock and checking shouldRequestNodeData so we release the sendingRequests lock before we go back round the loop to check shouldRequestNodeData.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* move to an offer() instead of a put() on the downloader so that when
the task is stopped the put will see that it is done and not wait
forever.
* remove peer based focus of the task. Let subtasks pick their peers.
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>
--> adapt `BlockBroadcaster` to use `send` method on `EthPeer`
--> adapt `EthProtocolMamnager` to utilize `BlockBroadcaster` to disseminate newly mined block
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* don't create a new CommandLine object in the case of exception - this caused the help to be missing the mixins added
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* o
* add test
* clean up
* scaffolding
* update
* update
* comments
* add test
* update
* update ii
* format
* update ii
* fix
* verifyBroadcastBlockInvocation
* test
* update
* update to difficulty calculation
* remove BlockBroadcasterTest from this pr
* update
* update
* update II
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Reduce logging for invalid peer discovery packets. The message is enough to locate the source of the rejection.
* Reduce ECIESHandshaker logging to trace since it documents a normal flow through the handshake process.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* check the token if authentication enabled, regardless of user optional status
* more tests
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Make the use of an existing fast sync state more explicit - passing it into the FastSyncDownloader.start method.
* Simplify FastSyncState constructors.
* Move PivotHeaderStorage to be FastSyncStateStorage and fully encapsulate loading and storing of FastSyncState instances.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Request 384 nodes per request instead of 200 since that's how many geth will allow returning.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Skip requesting data we already have but continue to walk the tree to ensure we have all child nodes.
* Don't delete fast sync state on stop. Allow resuming world state downloads.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* added JsonRpcHttpService.isPermitted(User, JsonRpcMethod) and JsonRpcMethod.getPermissions() and unit tests
* 401 if no auth token
* added DSL condition for NetVersion to fail because Unauthorized
* Added DSL conditions to do login and set auth token, and AwaitLoginResponse
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Allow fast sync to resume if chain head is not genesis but a fast sync is still in progress.
If present, use the stored pivot block header when restarting.
Extract the fast sync logic out of DefaultSynchronizer into it's own class.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Modify EthScheduler to use shutdownNow immediately instead of trying shutdown first.
EthScheduler executes a lot of tasks which wait for responses from the network and may have a significant number of tasks queued. Using shutdown would wait for all network responses and all queued tasks to complete before exiting which almost always reaches the 2 minute timeout allowed before switching to shutdownNow. All tasks have to cope with being unexpectedly terminated (as would happen with a kill -9) so there's no reason to have this extra delay.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>