* Add genesis config parameter ecip1099Block
Signed-off-by: Edward Mack <ed@edwardmack.com>
* add stub for epoch activation config
Signed-off-by: Edward Mack <ed@edwardmack.com>
* add stubs for EtcBesuControllerBuilder
that will handle ECIP 1099 Colibrate Epoch Duration functionality
Signed-off-by: Edward Mack <ed@edwardmack.com>
* introduce EtcHashMinerExecutor
Signed-off-by: Edward Mack <ed@edwardmack.com>
* implement EtcHashMinerExecutor
Signed-off-by: Edward Mack <ed@edwardmack.com>
* remove ecip1099 genesis config option
Signed-off-by: Edward Mack <ed@edwardmack.com>
* apply spotless to code
Signed-off-by: Edward Mack <ed@edwardmack.com>
* add test for Etc Hash epoch calculation
Signed-off-by: Edward Mack <ed@edwardmack.com>
* cleanup comments, apply spotless
Signed-off-by: Edward Mack <ed@edwardmack.com>
* make needed variables final
Signed-off-by: Edward Mack <ed@edwardmack.com>
* update changelog
Signed-off-by: Edward Mack <ed@edwardmack.com>
* refactor code to add epochCalculator to EthHash
As suggested in comment removed EtcHash series of classes to keep
existing controller.
Signed-off-by: Edward Mack <ed@edwardmack.com>
* use gas limit calculator
Signed-off-by: Edward Mack <ed@edwardmack.com>
* fix imports
Signed-off-by: Edward Mack <ed@edwardmack.com>
* run spotless apply
Signed-off-by: Edward Mack <ed@edwardmack.com>
* fix imports
Signed-off-by: Edward Mack <ed@edwardmack.com>
* fix comments
Signed-off-by: Edward Mack <ed@edwardmack.com>
* add ecip1099Block option to asMap method
Signed-off-by: Edward Mack <ed@edwardmack.com>
GasLimitCalculator is now just an interface. This simplifies the logic
in what was previously GasLimitCalculator but is now
TargetingGasLimitCalculator.
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
* Prefer `EvmAccount` in interfaces and methods
* Rename `DefaultEvmAccount` to `WrappedEvmAccount`
* Move `UpdateTrackingAccount` to a top level class from an inner class
* Re-type `getTouchedAcounts()` to not use `UpdateTrackingAccount`
* Extract `WorldStateArchive` interface, rename old class
`DefaultWorldStateArchive`
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* store warmed addresses and slots i the MessageFrame
* update gas calculations for berlin specific rules
* allow state tests in EVMTool to override the forks.
* retesteth should't broadcast re-orgs
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Besu's Retesteth implementation failed transition tests. Two reasons:
* It wasn't adding the DaoForkBlock to genesis files correctly
* It wasn't using the protocol schedules og the block being imported,
but instead to the current chain head.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Previously we were returning success with a zero length hash, meaning we
understood the response but there were problems with the RLP. Instead
now we return one of two errors "Could not decode RLP for Block" or
"Could not import Block".
For #1130
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
ProtocolContext uses a generic for the consensus state, which has a very
large footprint across the code to accomplish what it intends to
accomplish. For every call there are about 61 other lines per call that
need to be updated, over 1300 lines total.
Instead replace it with java.lang.Class#cast, which provides runtime
security, and use generics to provide the compile time sugar that
allows for chained methods of the appropriate type. Then remove its
(quite large) footprint from the rest of the code.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* When in retesteth return the coinbase in the eth_getBlockByHash, as
required by the retesteth tool.
* use genesis extraData when mining
* storage keys should be 0x00 instead of 0x when zero.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Compute transaction gas budget allocation according to EIP-1559 rules.
- Added `TransactionGasBudgetCalculator` with `hasBudget` method.
- Updated `AbstractBlockProcessor` to compute the gas budget using `TransactionGasBudgetCalculator`.
- Added unit tests in `TransactionGasBudgetCalculatorTest`.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Fixed unit test.
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>
* 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>
Add support for `berlinBlock` in genesis configs.
Until the final contents of Berlin are finalized this will be guarded by
a feature flag `--Xberlin-enabled`. Once Berlin is finalized and before
it is deployed on test nets the flag will be removed.
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>
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 MuirGlacier
* Add block numbers for Ropsten and Mainnet
* Add reference tests for difficulty calculations
* Update reference tests for new MuirGlacier difficulty tests
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>
We had two mostly idenitcal classes used for GraphQL and JsonRPC/WS.
This PR merges that to one class.
* Move from org.hyperledger.besu.ethereum.api.json.internal.queries to
org.hyperledger.besu.ethereum.api.query
* Add one method from the GraphQL version
(generateLogWithMetadataForTransaction)
* Remove graphql version and point graphql to the shared version.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.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>
* Factorise metrics code for KeyValueStorage database
- introduce `MonitorableKeyValueStorage`
- factorise code
- remove metrics instanciation in `RocksDbKeyValueStorage` and `ColumnarRocksDbKeyValueStorage`
* Rename class
* [PAN-2995] Make account.getAddress() return an Optional<Address>
* fix Jenkins failure
* fix failing test
* fix failing test
* Revert "fix failing test"
This reverts commit e2bb261a185d20f75e33be0ec72f5b5851c40461.
* Revert "fix failing test"
This reverts commit e5dc3fa073ef968bc017e513d15657204f54e519.
* Revert "fix Jenkins failure"
This reverts commit 15f90ea5e214ac624b891225bd096466c2ce1111.
* Revert "[PAN-2995] Make account.getAddress() return an Optional<Address>"
This reverts commit 08cc7ca5b785c666acd8d2b34d5f672837cd78fe.
* init trace_replayBlockTransactions
* Revert "init trace_replayBlockTransactions"
This reverts commit 545426595c8ede0b30ab1025bbdd262ce51281b7.
* Revert "Revert "init trace_replayBlockTransactions""
This reverts commit 756f52bb019c0e0c61aac4a97269d40198341c86.
* Update TraceReplayBlockTransactions.java
* Check request parameters
Method returns an error if any option other than “trace” is supplied.
* Update TraceReplayBlockTransactions.java
* implement trace_replayBlockTransactions
- start business logic implementation
- iterate through `TraceFrame` and transform to parity style
- detect `CALL` opcode to retrieve contract address required in parity format
* remove comments
* add final modifier for method parameters
* fix unit tests
* remove useless log
* transform address from stack (Bytes32) to an Address
* trace_replayBlockTransactions new features
- compute gas used for each sub trace
- detect `RETURN` opcode
- to get `ouput` value from `memory`
- detect end of subtrace
* fix unit tests
* Update FlatTrace.java
add final modifier
* pretty format JSON file
* handle smart contract deployments
* handle smart contract deployment
- set `code` field when contract creation transaction
- set `address` field when contract creation transaction
* introduce FlatTraceGenerator
* refactoring
* spotless apply
* update tests to compare Json node tree independently of the order
- added generated test cases
- use jackson `ObjectMapper` to compare the actual result to the expected one
- `assertThat(mapper.readTree(actualResult)).isEqualTo(mapper.readTree(expectedResult));`
* fix unit tests
- return empty result if block is empty
- handle case where there is no `RETURN`, `STOP` is then considered as a return to close the trace and perform gas computation.
- increment gas remaining by gas used
* spotless apply
* introduce SELFDESTRUCT
* set result to null when suicide type
* remove result field, use builder only
* re-enable tracing tests
* implement gas used computation
- implement a strategy with 2 options
- if first frame gas remaining is higher than gas remaining after transaction was processed then the gas used will be the net difference
- otherwise a frame by frame cumulative gas cost will be used
* get self destruct refund balance from message frame
* give access to `ProtocolSchedule` to get `GasCalculator`
* fix gas used computation for subtrace (1 level deep)
* fix input, use all memory and not only first element
* fix trace addresses
* debug log
* remove some tests files
* Revert "remove some tests files"
This reverts commit 88ee6aa84c199e1f386e1ba314c507d17c89226d.
* debug jenkins
* out instead of err
* spotless apply
* add debug info
* remove static modifier for blockchainSetupUtil field
* remove unused field
* add javadoc for gasCalculator parameter
* fix PR review comments
* add javadoc for Trace interface
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>