* 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
allow either constantinoplefixblock or petersburgblock but not both
throw RuntimeException when both petersburg and constantinoplefix are specified
Signed-off-by: Alexandre PARIS-VERGNE <alexpv14@gmail.com>
* Support clique genesis (needs a nodekey)
* Support nested calls
* Write genesis allocations to world state
* Report total gas (EVM operations + intrinsic cost of TX)
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Retesteth requires even length quantities (in contravariance to the Eth
JSON-RPC standards). For storage range at provide even length
quantities.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Fix cases where the gas estimate is too low and causes the transaction to fail
Implementation of a strategy that will estimate the number of gas needed by a transaction
1 - Estimate the number of gas used by a transaction
2 - Estimate the number of gas necessary to add for each sub call present in a transaction (65/64^depth)
3 - Add the minimum gas required for operations that need it (SSTORE)
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
When deserializing some JSON-RPC requests jackson instantiates
OptionalLong in a way JPMS doesn't like. Suppress that warning.
Fixes#798
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Update transaction pool error handling.
Transactions added locally into the pool via `eth_sendRawTransaction` can now generate 2 new JSON RPC errors:
- `ETH_SEND_TX_ALREADY_KNOWN`: occurs when adding a transaction already present in the pool.
- code: -32000
- message: `Known Transaction`
- `ETH_SEND_TX_REPLACEMENT_UNDERPRICED`: occurs when adding a transaction already present in the pool.
- code: -32000
- message: `Replacement transaction underpriced`
### Changes summary
- Created `TransactionAddedStatus` enum.
- `ALREADY_KNOWN`
- `REJECTED_UNDERPRICED_REPLACEMENT`
- `ADDED`
- Created 2 new errors in `JsonRpcError`.
- Updated JsonRpcErrorConverter to handle newly created errors.
- Updated `addLocalTransaction` method of `PendingTransactions` to return `TransactionAddedStatus` instead of boolean.
- Updated unit tests accordingly.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>