* 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>
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>
IbftRound has been updated to accept Signing errors (eg no signature supplier available) and
continue operating if possible.
This also catches failures in signing and ECDH Key agreement
creation during discovery and handshaking.
Signed-off-by: Trent Mohay <trent.mohay@consensys.net>
* Fix EIP-1559 block mining.
- Updated `AbstractBlockCreator` to set base fee to initial value if block is the fork block number.
- Updated `BlockHeaderBuilder` to populate base fee field.
- Updated `EthHash` to include base fee in hash computation if present in header.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* 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>
* 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>
Removes as many Gradle 7.0 compatibility issues as possible
* `baseName` -> `archiveBaseName`
* `extension` -> `archiveExtension`
* `destinationDir` -> `destinationDirectory`
* `runtime` -> `runtimeOnly`
* Change some log4j-api and log4j-core dependencies
* Remove an unneeded and outdated plugin (`net.ltgt.apt`)
* tweak the plugin-api change detector's property annotations.
Warnings still exist with one external plugin used for license file
checking that we do not control the source code for.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Generally, byte[] -> Bytes of some form. Most of the changes are the
side effect of the type changes or chaning to the names of Tuweni
equivilant calls (getHexString->toHexString, etc).
UnformattedData -> Bytes
Log Topics went from Hash to Bytes32
Difficulty went to UInt256 to match core impl.
Quantity lost BinaryData and is just getValue() and toHexString()
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Remove the LogSeries object and replace it with a plain old List<Log>.
The subclass had two features beyond a simple list. First it would
aggregate the logs as they were added into a bloom filter, but that
bloom filter was never used.
Second it had a RLP encoding convenience method. In the few cases this
is used the RLP encoding is unwrapped.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
This was turned off a number of months ago because of long build times.
However it appears either because of code structure changes or fixed
errorprone that this finishes in a reasonable time now.
Code that violated this check is also fixed.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Update dependencies to most current version
- except picocli which is a major version update
Alphabetize dependencies
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Add support for external GPU mining via the stratum protocol.
Three new CLI Options support this: `--miner-stratum-enabled`,
`--miner-stratum-host`, and `--miner-stratum-port`.
To use stratum first use the `--miner-enabled` option and add the
`--miner-stratum-enabled` option. This disables local CPU mining and opens up
a stratum server, configurable via `--miner-stratum-host` (default is
`0.0.0.0`) and `--miner-stratum-port` (default is 8008). This server supports
`stratum+tcp` mining and the JSON-RPC services (if enabled) will support the
`eth_getWork` and `eth_submitWork` calls as well (supporting `getwork` or
`http` schemes).
This is known to work with ethminer.
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* [PAN-3023] Add command line option for target gas limit
Signed-off-by: cfelde <cfelde@cfelde.com>
* [PAN-3023] Add command line option for target gas limit
Signed-off-by: Christian Felde <cfelde@cfelde.com>
* [PAN-3023] Add command line option for target gas limit
Signed-off-by: Christian Felde <cfelde@cfelde.com>
* [PAN-3023] Add command line option for target gas limit
Signed-off-by: Christian Felde <cfelde@cfelde.com>
* adding in spdx-license-identifier & updated check for the same; removing license check from spotless
Signed-off-by: Joshua Fernandes <joshua.fernandes@consensys.net>
* Change CheckSpdxHeader to a task.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Retesteth requires support for mining without block rewards and without PoW.
No Proof simply requires exposing the nonce generator and using a special
EthHashSolver.
No Reward is supported via a flag in the ProtocolSpec, stating whether or not
to skip zero rewards. For frontier, homestead, and tangerine whistle (EIP150)
this flag is false. For all other forks and all other consensus engines the
flag is true, even when emulating EVM state from those three forks as all
non-PoW consensus engines never consider block rewards.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
If you try and do a difficulty of 1 the UInt256 class used for comparison throws
an error because 2^256 is 33 bytes. Instead use 2^256-1 which is 32.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
This reverts commit 814b36e4
The needed chantes to get rid of Instant.now (which is also needed to get rid
of the wall clock dependency) are too deep and intrusive into IBFT to try and
speed patch them in that some APIs require re-work, so in the interst of test
stability this gets sheleved until it is all ready.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
To allow us to reset the timestamp in the blockchain for Retesteth support
we need to pass a Clock to affected APIs and use that instead of the static method
System.currentTimeMillis(). The most consistent way to do this that will ensure
that the API does not sneak back in is to ban the method via ErrorProne.
TestClock.fixed() was altered to return the "now" time of the first time the fixed clock was requested, needed for many header validation tasks validating headers are not from the future.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Updated TransactionValidationParams with checkLocalPermissioning flag
* Added TransactionValidationParam to TxProcessor
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Columnated storage to allow for iteration over world state
* change MetricsCategory to PantheonMetricsCategory
* consistency renaming of kvstores
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>