The EthGetWork.shouldReturnSuccessResponseWhenMining was exhibiting intermittent failures, as a mining node would occasionally report "No mining work available yet" - rather than the inputs required to be solved for the current block.
From investigation, it was found that Besu's EthHash miner has a small time window after completing a block, in which the target for the next block has not yet been computed (eg while collating transactions) - during this interval, Besu will validly report "No mining work available yet".
To overcome this, the acceptance test has been updated to poll Besu for upto 5 seconds, waiting for a valid work target to be provided - rather than executing a single-attempt (which may fall within the window specified above).
Signed-off-by: Trent Mohay <trent.mohay@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>
We cleared the mark storage upon starting the pruner in order to prevent the first sweep from being smaller than it needs to be.
```
// Optimization for the case where the previous cycle was interrupted (like the node was shut
// down). If the previous cycle was interrupted, there will be marks in the mark storage from
// last time, causing the first sweep to be smaller than it needs to be.
clearMarks();
```
Unfortunately, it's currently called in prepare, which is synchronous with the main thread. This means that we can delay startup by on the order of 10 minutes if the storage was especially full.
This commit makes the pruner `start` asynchronous.
This was reverted once before due to test intermittency and this commit is the second attempt :P
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Rollback a Eth64 change intended to improve compatibility in consortium network. It resulted in many nodes not connecting on named networks such as goerli and mordor.
* Revert "Handle backward compatibility for EIP-2124 fork id management (#981)"
This reverts commit 1d8218ae
* Revert "[EIP-2124] Backward compatible fork id management implementation (#979)"
This reverts commit cb2c67d7
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Use seconds for timeout configuration
* Add units to variable names
* Change timeout to 5 minutes
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Changelog for PR #969.
Signed-off-by: Mark Terry <mark.terry@consensys.net>
* Tweak.
Signed-off-by: Mark Terry <mark.terry@consensys.net>
Co-authored-by: MadelineMurray <43356962+MadelineMurray@users.noreply.github.com>
We cleared the mark storage upon starting the pruner in order to prevent the first sweep from being smaller than it needs to be.
// Optimization for the case where the previous cycle was interrupted (like the node was shut
// down). If the previous cycle was interrupted, there will be marks in the mark storage from
// last time, causing the first sweep to be smaller than it needs to be.
clearMarks();
Unfortunately, it's currently called in prepare, which is synchronous with the main thread. This means that we can delay startup by on the order of 10 minutes if the storage was especially full.
This commit makes the pruner `start` asynchronous.
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Slight rework on some PendingTransaction synchronization
* sync on `prioritizedTransactions` instead of `pendingTransactions`
* `pendingTransactions` is already a `ConcurrentHashMap`, which
syncs on itself internally
* not all accesses to `pendingTransactions` were synced
* `prioritizedTransactions` is not exposed directly or indirectly,
making it a better lock
* Improve synchronization in TransactionsForSenderInfo
* `gaps` was returned without requiring synchronization
* `transacitonInfos` was not thread safe.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Add timeout handler in JsonRpcHttpService.
- Created `TimeoutOptions` class with fields:
- *timeout*: the timeout in milliseconds.
- *errorCode*: the http status code.
- Created `EthRpcTimeoutHandler`.
- Contains `handler` static method to create `Vertx Handler`. The process of the handler created is the following
- retrieve the body as string.
- parse it as a `JsonObject`.
- cache the resulting `JsonObject` in the `RoutingContext`.
- retrieve the RPC method name.
- set a timer based on the configuration if the method name matches one entry in the configuration map.
- call the next handler.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
SPDX checks shouldn't be done against jmh generated files. Make it
generic so that the gradle/intellij favoured location of generated files
will never be a problem. These are also covered by `.gitignore` already.
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>
Update implementation of the EIP-2315
- Execution of BEGINSUB causes exception and terminates execution.
- JUMPSUB sets the pc to location + 1 .
- In the edge case when BEGINSUB is the last instruction in code and this subroutine is jumped-to, the implementations should execute STOP .
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
* Handle zeros fork blocks when computing fork id.
- Updated `ForkIdManager`:
- Created `ForkIDChecker` interface with `boolean check(ForkId forkId)` method.
- Added a check in the constructor to use the proper `ForkIDChecker` based on the following conditions:
- Accept all peers if the list of forks contains only `zeros`.
- Use `EIP-2124` rules otherwise.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Handle backward compatibility
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
It was possible to run Besu on an incomplete fast-synced db with full sync enabled. This causes the node to stall out. This PR resolves this issue.
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Because of where we provide info log messages in the
BlockPropagationManager we don't log out of order blocks. Moving to
task cleanup allows us to get the timing information too instead of
simply as part of the executeTask method
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Updated SimpleNodePermissioning smart contract in the acceptance tests to relax enodeURL matching to exclude the p2p port.
Signed-off-by: Mark Terry <mark.terry@consensys.net>
In the event that someone who has forked this repository sets up CircleCI integrations for it, we would like that builds on their master branch would not be able to send alerts to the Hyperledger Rocket Chat #besu-contributors channel. Here we move to having the notification web-hook be sent to an address set by the HUBOT_URL variable instead. This environment variable is set in the CircleCI web-app in the same place we set the variables for our secrets for other 3rd party app access.
It has been tested that an environment without the variable being set would cause no issues for the CircleCI build system either for other forked projects.
Signed-off-by: Edward Evans <edward.joshua.evans@gmail.com>
* Add checks on the replacement of a transaction in the pool:
- reject EIP-1559 for pre-fork blocks
- accept both frontier and EIP-1559 transactions during phase 1
- reject frontier transactions after phase 2 is finalized
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* The transaction gas price is computed when adding a transaction into the local pool using eth_sendRawTransaction JSON RPC endpoint. Transaction price must be computed properly depending on the type of the transaction.
For instance `shouldReplace` method of PendingTransactions must be updated to deal with EIP-1559 transactions.
- Updated `PendingTransactions` to add access to the chain header in order to retrieve the last base fee value.
- Updated `TransactionReplacementByPriceRule` to compute the transaction price depending on the type of the transaction (frontier or eip-1559).
- Added unit tests to cover all possible replacement scenarios.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
This mode does not seem really useful because it does the same thing as a NONE mode (it takes the parameters p2p-host, p2p-port, etc). At the moment this mode does not bring much and seems to be confusing. To avoid confusion the best is to delete ManualNatManager