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>
* #1066 Switched to use unprefixed hex strings for memory and stack values
Signed-off-by: David Mechler <david.mechler@consensys.net>
* Disable flaky tests per Ben Burns(Yeti) request
Signed-off-by: David Mechler <david.mechler@consensys.net>
* Revert last commit and enable ignored tests.
Signed-off-by: David Mechler <david.mechler@consensys.net>
* #1157 - updated to create 2 agents so that proper bonding can occur
Signed-off-by: David Mechler <david.mechler@consensys.net>
* #1162 - Updated test to mock the local peer PING packet creation so that the hash can be managed.
Signed-off-by: David Mechler <david.mechler@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>
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>
Produce error response if any of Address, Bytes or Bytes32 values
inside GraphQl requests are not prefixed with 0x as defined by the spec.
Fix old tests that used values that are not prefixed with 0x and add
additional tests to confirm Address, Bytes and Bytes32 values will be
rejected if not prefixed with 0x.
Signed-off-by: Mak Muftic <mak@nodefactory.io>
This PR fixes an error when downloading chain (Async operation failed)
When there are several blocks which are very large (> 12M) and which are requested in the same segment (by default 200) we can have timeouts and never manage to synchronize. This modification will make it possible to gradually reduce the size of the segment with each attempt. Then the segment resumes its default size for the next blocks
If the reduction is not enough at the last attempt we try with a single block
Signed-off-by: Karim TAAM <karim.t2am@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>
* Add check for spoofed IP in ping message
* Add logging message when ping request is rejected.
Signed-off-by: David Mechler <david.mechler@consensys.net>
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>
* change Perm*Whitelist JSON-RPC methods to extend the Perm*Allowlist methods to remove dupe
* added unit test for Perm JSON RPC methods collection
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>
* Upgrade Library Versions
Upgrade library versions to most recent version
Exceptions:
* Errorprone - lots of new violations need fixing
There will be a follow on PR for this.
* picocli - non-trivial conformance changes
* EthSigner&Orion - similar non-trivial API changes, plus it's only for
integration testing
* Kubernetes - significant library revisions
* Web3j - Web3j changed some error semantics in 5.0 that broke
acceptance tests. Expect an update in a follow on PR.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Detect zombies backend query and abort useless processing.
The timeout handler populate the request context with a boolean value indicating whether or not the query is alive, i.e the HTTP request has not expired. Backend queries are now conditioned by this value and can be stopped if needed.
This PR experiments this mechanism on a reduced scope. Hence, only `eth_getLogs` backend queries are affected.
- Created `BackendQuery` utility class to run a process only if the query is alive, i.e timeout not expired.
- Put `AtomicBoolean` value in the `JsonRpcRequestContext`
- `TimeoutHandler` sets the alive value to `false` if the timeout handler is triggered.
- Updated `BlockchainQueries` to run steps depending on the value of the `AtomicBoolean` retrieved from the request context.
- Added unit tests.
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* replace whitelist/blacklist with allowlist/denylist and support both versions in CLI options
Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
- Implemented submitHashrate endpoint.
- Updated eth_hashrateEndpoint so that it returns the cumulative hashrate of all sealers if available. Otherwise it returns the local hashrate
- Added hashrate submission with Stratum1EthProxyProtocol and Stratum1Protocol
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Before this pull request Besu was using the latest known fork id to create status message for Ethereum P2P protocol handshake.
This latest known fork id was created based on a list of forks retrieved from the Genesis.
For private networks it is possible that all fork blocks number are set to 0.
The algorithm to compute the valid fork hashes excludes 0 values.
As a result, the list was empty and the `getLatestForkId` was returning `null`. This is an issue when you support capabilities >= to Eth/64 sub protocol because other peers expect the fork id value in the `RLP` encoded message.
Moreover, the algorithm to compute the fork id should be aware of the chain head number and update `CRC` value only for fork blocks below the current head.
This pull request fixes this issue by fetching the chain head number and update accordingly the `CRC` value.
Unit tests have been extended to cover an exhaustive list of possible combinations on named networks (`goerli`, `rinkeby`, `ropsten` and `mainnet`).
Signed-off-by: Abdelhamid Bakhta <abdelhamid.bakhta@consensys.net>
* Add onchain privacy group multi-tenancy support to priv_getPrivateTx and priv_getPrivRcpt
Signed-off-by: Lucas Saldanha <lucas.saldanha@consensys.net>
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>
Performance measurements have indicated that the list of Bytes32 for
memory is not performant enough. Moving to a byte array reduces wrapper
object thrashing as well as simplifying cross-word boundary logic (there
are no boundaries).
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* feat: FastSync now stops on failure instead of falling back to FullSync
* feat: exiting on FastSync failed
* feat: FastSync continues on FullSync when no errors happened
Signed-off-by: Alexandre PARIS-VERGNE <alexpv14@gmail.com>
Improved JUMP and JUMPSUB destination check. Avoid having to browse the code if the destination == code size
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>