Update the besu-native libraries to 0.3.0 to gain access to faster BN128
and secp256k1 implementations.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
The parallel task production is by sub-trie, so calling `visitAll` on a
root node will eventually spawn up to 16 tasks (for a hexary trie).
If we marked each sub-trie in its own thread, with no common queue of
tasks, our mark speed would be limited by the sub-trie with the maximum
number of nodes. In practice for the Ethereum mainnet, we see a large
imbalance in sub-trie size so without a common task pool the time in
which there is only 1 thread left marking its big sub-trie would be
substantial.
If we were to leave all threads to produce mark tasks before starting
to mark, we would run out of memory quickly.
If we were to have a constant number of threads producing the mark
tasks with the others consuming them, we would have to optimize the
production/consumption balance.
To get the best of both worlds, the marking executor has a
ThreadPoolExecutor.CallerRunsPolicy which causes the producing tasks to
essentially consume their own mark task immediately when the task queue
is full. The resulting behavior is threads that mark their own sub-trie
until they finish that sub-trie, at which point they switch to marking
the sub-trie tasks produced by another thread.
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
The warm address/slot data was not returned to the calling messageFrame
for CREATE[2] calls as it was for CALL series calls.
Also, improve performance by using more efficient copy constructors and
reusing objects were relevant.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
If a peer exceeds the authorized number of pending blocks, Besu will replace the lowest priority block in the cache from this peer by this new one until the local node sync a new block and maybe purges one of the blocks of this peer.
The highest priority blocks are those that are lowest in block height and then higher priority if they were sent more recently.
Other peers will not be impacted and will be able to continue sending pending blocks.
The cache size limit is the distance between the minimum and maximum value of the BlockPropagationRange parameter. Besu automatically purges blocks outside this range.
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
* 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>
* 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>
Add better invalid reason logging.
The EVMTool state-test will add a field in the json result object.
Block transaction processing will log at INFO why the block is invalid
and include the block hash and (if relevant) transaction hash.
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>
Add some Quality of Life changes to reference tests
* ShanghaiLove tests tend to OOM in parallel execution. Exclude them.
* LegacyTests, as generated code, are not subject to SPDX header checks.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* handle case where onchain groups do not exist
* added constructor so the tests can mock the onchain management contract
Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
* Fix#1110: Privacy: Restart caused by insufficient memory can cause inconsistent private state
Signed-off-by: Stefan Pingel <stefan.pingel@consensys.net>
* addded genesis config option getEcip1017EraRounds
to define the number of Rounds in an Era for Ethereum Classic Emission
Schedule.
Signed-off-by: Edward Mack <ed@edwardmack.com>
* add entry to CHANGLOG.mg
Signed-off-by: Edward Mack <ed@edwardmack.com>
* some doc changes and implemented style suggestions
Signed-off-by: Edward Mack <ed@edwardmack.com>
When a CALL series operation has an erroneous input offset (such as
starting at a ETH address instead of a real offset) we threw an
ArithmeticException.
* Restore the old memory bounds checking on memory expansion
* Treat these formerly uncaught exceptions as invalid transactions and
report errors with a stack trace and custom halt reason.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
- On-chain group management changes: additional API to check whether someone is allowed to update the contract, and remove enclave key as a parameter to contract APIs
- Add check for group membership to onchain and offchain precompiled contracts
Signed-off-by: Stefan Pingel <stefan.pingel@consensys.net>
Move key referenceTest classes relating to reading the JSON data into a
"main" java package so that it can be included in other production
classes. Some classes were renamed to make their intent clearer. Other
smaller changes that bring classes in line with current coding
standards were done.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* deprecate CLI option for privacy precompile address; only put the relevant precompile in the registry
Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
Our current EVM loop splits out cost, execution and halt evaluation. Flattening these three into one method results in a significant speedup in reference tests, which are EVM heavy.
Mostly the cost, exceptionalHaltCondition, and execute are merged into one method, sharing calculations between the three.
In fixed cost operations the merger is very simple AddOperation is a representative fixed cost operation.
Check the gas, check other exceptional halts, do the work, return the result.
In variable cost operations there is some value reads to be done before the cost is calculated. This is where a lot of the de-duplication occurs. CodeCopyOperation is a representative variable cost operation.
JumpIOperation shows where this merger pays off. If the condition is zero then some exceptional halts don't need to be considered. But with the three way split each step couldn't consider such optimizations because the local data was lost between each call.
Some cleanup was enabled by this. The old exceptional halt predicates were deleted and moved into each operation. Gas costs must be checked by the operation instead of globally, or we would lose state if we had to split into two methods and do the gas check shared.
The OperandStack was flattened into a single class instead of an interface plus a single implementation. stack underflow and overflow are signaled via named exceptions and handled via catches instead of pre-checking the stack height. Since overflow/underflow is exceedingly rare in mainnet transactions java exceptions are the more performant means.
Some of the APIs had lingering impacts on how some tests were run and the EVMTool (we cache operation cost in the message frame now.)
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Update to the reference tests used on hivetests.etherdevops.io and
retesteth.etherdevops.io. Both are using a more current release of the
reference tests that includes performance and subroutines items.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* use P2P consistently in help
Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
Co-authored-by: mark-terry <36909937+mark-terry@users.noreply.github.com>
The IBFT2 configuration section of a genesis file has been updated
to allow the specification of a block reward (defaults to 0) and also an explicit
recipient (defaults to the block proposer).
The block reward can be specified as a hex string (with 0x prefix) or a decimal
string (no prefix), and is defined in Wei.
These values are not modifiable for the duration of the network.
Signed-off-by: Trent Mohay <trent.mohay@consensys.net>
- Added `--rpc-tx-feecap` command line flag.
- Maximum transaction fees (in Wei) accepted for transaction submitted through RPC.
- Defaulted to 1 ether.
- Updated `TransactionPool.addLocalTransaction` method: performs an additional check to verify if transaction fees don't exceed user defined fee cap (if cap is set to 0 then it is ignored and means no cap).
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* rename more whitelist occurrences; change allowlisted to allowed and reword where we ended up with allowlisting
Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
Internally we used to use an enum set to track halt reasons and we would
track multiple halt reasons. However, what the halt reason is does not
matter to reference tests and tracing, only that a halt occurred.
Repalace the EnumSet with an Optional and trace only one revert reason.
This saves us time in enumset management and also allows us to return
quicker once any halt is detected.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Upgrade to ErrorProne 2.4.0
* public constructors on abstract classes are removed
* Javadoc must have meaningfull documentation
* lambdas should not be variables
* Added to the list of confusing inner class names (Entry and Type)
* no assert keyword in tests
* Obsolete JDK classes produce errors now
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>