Increate the speed of ModExp gas calculations by using primitive types.
Use a native lib for modexp precompile.
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
* Native modexp
The idea behind this commit is to preload asynchronously account nodes and storage nodes from the database during the transaction processing to use these nodes during the calculate root hash step.
We've created two caches, one for account nodes and one for storage nodes. The size of these caches is 100k for accounts and 200k for storage. We've tested other values but this configuration is the one that works better.
We also use exporter cache metrics as Prometheus metrics to check cache efficiency.
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Co-authored-by: Ameziane H <ameziane.hamlat@consensys.net>
* Enable full (non block) bloomFilters with 10 bits per key
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* Delete unused constant
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* Add ChangeLog
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* Set RocksDB format version to 5
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: ahamlat <ameziane.hamlat@consensys.net>
* Remove log statements that are keeping references to objects for too much time
Improvement in terms of reducing java heap used,
since the logs were keeping reference to blocks sent by newPayload,
that causes high memory consumption during initial sync,
and could be one of the causes that prevent to complete snap sync on low spec machines.
Exceptions are also logged by the backward sync, so there is no loss of information.
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Implement "Small" EOF - EIP-3540 (container) and EIP-3670 (validation).
Make code an interface so EOF specific features are compartmentalized,
including an 'invalid' code type representing a code block that didn't
pass validation, CodeV1 for EOF1, and CodeV0 which represents pre-EOF
code. EVMs track a maximum supported EOF version (where 0 is pre-eof)and
code is generated from a CodeFactory taking in context (is it a CREATE
operation and max code size) for the validation.
Includes spec versions for "Shanghai" and transient testnet "Shandong".
"Small" EOF is only activated in Shandong.
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
* Revert "Revert "Upgrade OpenTelemetry (#3675)" (#4031)"
This reverts commit 17de636fe2.
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* Make sure we don't initialize the OpenTelemetry global singleton by mistake
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* disable global otel singleton explicitly
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* make sure to set GlobalOpenTelemetry at most once to avoid test failures
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* reset for tests
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* fix changelog
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
WorldStateUpdater commit method is one of the most consuming methods during block processing (engine_newPayloadV1 call). This PR will focus on parallelizing some parts of this method to make it faster.
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
* Add Shandong network and fork
Add the transient Shandong fork and network definitions. For Shanghai
fork testing. Besu doesn't sync, but it does connect.
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
* Parallelize some steps in BonsaiPersistedWorldState.calculateRootHash method
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* Add synchronized on storage flat database remove and update method
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* Add synchronized on storage flat database remove and update method
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* Fix this error org.rocksdb.RocksDBException: unknown WriteBatch tag
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* create a specific calculateRootHash for BonsaiInMemoryWorldState class
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* create a specific calculateRootHash for BonsaiInMemoryWorldState class
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* Fix nullPointerException on Collections.synchronizedSet
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* Use parallelStreams instead of CompletableFuture API
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* Modify CHANGELOG.md
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* spotless and synchronizedSet initializaton
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Co-authored-by: garyschulte <garyschulte@gmail.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
* implementation of Bonsai snapshots based BonsaiWorldStateArchive
includes: try-with-resources and AutoCloseable WorldState in order to release snapshots when we are done with them
Signed-off-by: garyschulte <garyschulte@gmail.com>
Due to subtle differences between Bytes32 and UInt256 the changes failed
burn-in testing and are being reverted.
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
* don't add to bad blocks manager on StorageException
* support for MerklePatriciaTrie exceptions
Signed-off-by: Justin Florentine <justin+github@florentine.us>
The current internal storage APIs implement UInt256 rather than Bytes32,
which is an accident of prior EVM design. This migrates all internal
handling of storage addresses and values to Bytes32.
The main performance gain is reduced GC pressure, in that UInt256
stores the data as an array of ints, whereas Bytes32 keeps a sliced or
wrapped array of bytes. Since database APIs are all byte array based
this should remove unneeded conversions when going to/from the DB.
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
* Fixed default fromBlock value and improved parameter interpretation in eth_getLogs RPC handler. Improved test coverage.
Signed-off-by: mark-terry <mark.terry@consensys.net>
Overview of changes:
* Remove vestigial log tracing. We will never use it in production and
standard json tracing gets us what we need
* Reduce use of lambdas and optionals. Reads great, translates into a 10%
perf hit in a tight loop.
* Unroll operation loop in some cases. Those are (a) ops that haven't
changed in any way since Frontier (b) ops not overridden in downstream
uses and (c) operations that translate into short static executions.
This has the longest tendrils as it is enabled by operations exposing
static methods to do their work.
* Refactoring of the operationTracer. The single, lambda consuming
traceExecution method was a barrier to performance. It has been replaced
with tracePreExecution and tracePostExecution. Look at
DebugOperationTracer to see how traces that need to operate on both
sides of the operation can be handled with this API.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Also adds a one time call to initiate connection to nodes in static nodes
list after local node is ready. In the absence of this call, the connection attempt
is made after the configured interval (default 60 seconds) to check maintained
connections. This is to make sure the node doesn't have to wait for almost a minute
before it can start interacting with peers (and sync blocks etc.)
Signed-off-by: Vinod Damle <vinod.damle@kaleido.io>
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
Co-authored-by: Vinod Damle <vinod.damle@kaleido.io>
* Upgrade RocksDB version from 6.29.5 to 7.6.0.
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* Add a changelog entry
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: ahamlat <ameziane.hamlat@consensys.net>
* During handshake, flip the encrypted message decryption by starting with the new format (EIP-8), and if there is an exception, try the old format. This will reduce the number of exceptions and unnecessary executions.
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* update CHANGELOG.md to give more context on this PR.
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* update CHANGELOG.md to give more context on this PR.
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* Delete some debug code committed by error
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: ahamlat <ameziane.hamlat@consensys.net>
* use optimistictransactiondb for mutable isolated snapshots
* plumbing necessary to have a snapshot specific updater.
* snapshot rolling working
* implement AutoCloseable on BonsaiSnapshotWorldState to ensure we can correctly dispose of snapshots
* add snapshot transaction cloning, change snapshot based worldstate to extend persisted worldstate rather than in-memory worldstate
Signed-off-by: garyschulte <garyschulte@gmail.com>