Some of our loggers were not private, static, and final. In a few
cases these were non-static fields in classes that were repeatedly
instantiated in core transaction logic.
This is enforced via a new ErrorProne check, so the PR includes fixes
for all of the places this was a problem, not just the performance
impacting code.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Handle legacy gas pool and EIP-1559 gas pool when mining blocks.
- Added `EIP1559` manager class in `ProtocolSpec` (defaulted to `Optional.empty()`).
- Updated `MainnetProtocolSpecs` EIP-1559 definition to set the `EIP1559` manager class.
- Updated `BlockTransactionSelector`
- Added `eip1559CumulativeGasUsed` field in `TransactionSelectionResults`.
- Updated `updateTransactionResultTracking` method to compute cumulative gas used according to `EIP-1559` rules.
- Updated `transactionTooLargeForBlock` method to compute gas remaining according to `EIP-1559` rules.
- Updated `blockOccupancyAboveThreshold` method to compute minimum block occupancy ratio according to `EIP-1559` rules.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Update BlockTransactionSelector transaction gas price computation.
BlockTransactionSelector should compare transaction gas price to the min transaction gas price parameter according to EIP-1559 rules.
- Added `TransactionPriceCalculator` to `ProtocolSpec` (defaulted to `TransactionPriceCalculator.frontier()`.
- Created `minTransactionPriceInNextBlock` method in `BaseFee`.
- Removed useless constructor in `BaseFee`.
- Updated EIP-1559 protocol spec definition to set the correct transaction price calculator.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
@pinges correctly pointed out that, even though we have access to all the logs in the BlockAddedEvent, we still use BlockchainQueries to add the new logs from the event. Now we do the sane thing.
Unfortunately, it doesn't seem as easy with private logs so we still have to use privacyQueries as far as I can tell.
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* Manage EIP-1559 transactions forging in local transaction pool.
- Updated `TransactionPool`
- Added `TransactionPriceCalculator` field for frontier transactions.
- Added `TransactionPriceCalculator` field for EIP-1559 transactions.
- Added `EIP1559` field.
- Added `minTransactionGasPrice` to compute transaction gas price according to EIP-1559 rules.
- Created `BaseFee` domain object.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
This change allows the newly defined "SecurityModule" to work against a generic API, while the NodeKey interface adapts these generic types to the types already used throughout Besu (i.e. those defined in Secp256k1).
Signed-off-by: Trent Mohay <trent.mohay@consensys.net>
Update BesuController to use the NodeKey, rather than working with KeyPair - which in turn allows the crypto operations to be injected.
Signed-off-by: Trent Mohay <trent.mohay@consensys.net>
When we deny a connection based on HTTP hostname log to trace the
rejected value.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Co-authored-by: Usman Saleem <usman@usmans.info>
* Added changelog entries for PR:
- https://github.com/hyperledger/besu/pull/430
- https://github.com/hyperledger/besu/pull/440
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* ### Description
BlockHeader object needs to be modified in order to add the new field (baseFee) as specified in the EIP.
We should take care about the RLP encoding/decoding of this structure since it has to include or not the new fields depending on whether we are pre fork or post fork.
- Update `core.BlockHeader.java`
- Add `baseFee`
- Update `readFrom` method for RLP decoding
- Update `writeTo` method for RLP encoding
- Update `plugin.data.BlockHeader.java`
- Add `getBaseFee` method
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* TODO Add CLI command line flag `--Xeip1559-enabled`.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* TODO Add CLI command line flag `--Xeip1559-enabled`.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Added unstable annotation for getBaseFee. Moved from long to `Optional<Long>`
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Spotless apply
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Fixed error
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* fix plugin API hash
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* RLP encoding / decoding operations are guarded with the feature flag.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* spotless apply
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Fix the error retrurned when the PMT cannot be added to the transaction pool because the intrinsic gas exeeds the gas limit.
Signed-off-by: Stefan Pingel <stefan.pingel@consensys.net>
Occasionally the other side of an HTTP connection will drop the
connection before we are done processing. This results in a harmless
but annoying exception showing up in the log. If we check before we
write we won't get that exception.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
If we detect an EOF for the cache file switch over to an uncached query.
This is typically seen when filling a log filter and the new block has
not yet written out the log bloom cache to disk. Fixed#473
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
The EthQL API spec specifies pulledStates and knownStates in the
`syncing` query. Previously we always returned null. This plumbs through
the needed data so that the synchronization states can report the
fast sync progress via EthQL, as well as the `eth_syncing` JSON-RPC.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Restore test generation of blocks.bin
Restore the ability to generate our blocks.bin as part of the build.
(a) a fixed start time was added
(b) nonces for blocks imported for test are deterministically chosen.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* more readable test files
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* init trace_transaction api
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
* add test cases for trace_transaction api
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
* resolve the tests by checking only the presence of the blockHash field and not its value because it is different each time generateTestBlockchain is called
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
* clean code
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
* to allow the tests to work, we must put back the blocks.bin and no longer generate it during the build. adding the nonce to the blocks.json file should solve this problem
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
* clean code
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
* refactor add additional transaction part
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
* create file if logBloom-current.cache is missing
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
* update populateLatestSegment in order to resolve the missing logs issue
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
* add lock for populateLatestSegment
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>