* reduce use of global quorum config
The use of the org.hyperledger.besu.config.GoQuorumOptions static
variable is ugly. In particular does changing its value during tests
cause flaky tests. To ameliorate the issue this commit
- removes unused code that did rely on GoQuorumOptions
- removes access to GoQuorumOptions deep in the call stack by looking
it up in the transaction validator instead
- change the TransactionDecoder to explicitly take the
goQuorumCompatbility flag as an argument where access to the
transaction validator is not easy
- rewriting all tests that did change the GoQuorumOptions by mocking
the option change instead.
Signed-off-by: Taccat Isid <taccatisid@protonmail.com>
* protect access to GoQuorum flag by getter and write once setter
Signed-off-by: Taccat Isid <taccatisid@protonmail.com>
* deduce goQuorum flag from privacyOptions
Signed-off-by: Taccat Isid <taccatisid@protonmail.com>
* remove unnecessary mocks from TransactionPoolTest
Signed-off-by: Taccat Isid <taccatisid@protonmail.com>
Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
More EVM Speed Improvements aimed at improving MSTORE times.
* Move Memory from raw bytes to byte array
* Add calls for right packed partial value copy
* Remove `incrementProgramCounter` and move data into OperationResult
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Before we set the account balance to maximum allowed, but this had
side effects in smart contracts.
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Always copy create code
Always copy the create code. Since it is memory bytes it is subject to
re-writing by the caller and all data would otherwise have to be treated
as mutable.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Private accounts are not able to change the state of public accounts. When transferValue is called in MessageCallProcessor it attempts to get a mutable account. This is only required when a transfer of value is happening. If a transfer of value from a private contract to a public contract is attempted an error will be thrown.
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Broad reaching optimizations to speed up EVM calculations
* Generally speaking, use int and long where it is more appropriate than UInt256 (memory indexes mostly)
* Move the internal stack to Bytes from UInt256
* Re-work the flow of many operations to account for the above
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Move EVM to a standalone module
Move the EVM classes to a standalone module. This is mostly moves but
some API re-resign to peel out some features not essential to the EVM,
such as privacy support and ties to the data storage subsystem.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Rollback TransactionGasCalculator
Rollback the transactionGasCalculator changes. This was done in
preparation for the EVM modularization. Instead, de-structure the data
needed to calculate the gas instead of passing in the whole transaction.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Create new datatypes module
Create a new `datatypes` module to hold datatypes that are broadly used.
This will aid modularization by making sure the base types in the module
minimize the amount of unrelated support classes needed.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Add Address, Hash, and Wei to datatypes
Move the Address, Hash, and Wei to datatypes in as they are needed for
EVM modularization.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* allow onchain privacy group proxy calls under group lock
Prior to this commit, the only allowed transactions in locked onchain
privacy groups were those making the addParticipants call to *any*
contract--not just the proxy. This commit ensures that:
- while locked, only the group management proxy can be called
- while locked, all functions of the management proxy can be called
Corollary, this commit allows unlocking a group using unlock instead
of implicitely unlocking it via addParticipants. This fixes#2693.
Signed-off-by: Taccat Isid <taccatisid@protonmail.com>
* add acceptance test asserting that privacy groups can be unlocked
Signed-off-by: Taccat Isid <taccatisid@protonmail.com>
Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
In preparation for the EVM library pull out the transaction related gas
calculations and move them into their own `TransactionGasCalculator.`
This has 4 calls right now, none of which occur inside the EVM:
* Intrinsic gas cost
* Code Deposit gas cost
* Max refund quotient
* Max Privacy Marker Transaction intrinsic gas cost.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
EIP-1702 account versioning was a candidate for the Istanbul hard fork
but was removed prior to the first testnet. Other versioning techniques
have greater core dev mind share and one preparatory step landed in
London, EIP-3541, making EIP-1702 very unlikely to make it to Mainnet.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Less Spotless Gradle Warnings
Spotless and Gradle 7.x does not play nicely with using a fileTree as a
target and should be using plain strings. This should get rid of the
`Execution optimizations have been disabled`... warnings.
* Move Generated Reference Tests into the `build` dir
Generated reference test are currently generated into `src`, which is in
violation of the standard maven layouts. They should be in the `build`
directory as they are artifacts not maintained in source control.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Refactor: PrivacyBlockProcessor to clarify intent
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Wire up privacy genesis options into PrivacyParameters
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Refactor private state genesis into it's own class
- pass through in privacyParameters
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Refactor: inject PrivateStateGenesis into PrivacyPrecompiles
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Private Genesis initialisation
- set code, balance and storage from private-genesis.json
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Check on-chain with private genesis in acceptance tests
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Remove unused EthGetCodeCall
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Use a plugin based aproach for privacy genesis
- if the plugin is registered it will be used to apply private genesis
state
- if onchain flexible privacy groups is enable that will be applied
after
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* PrivateGenesisAcceptanceTest::createPrivacyGroup can be private
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* PrivateStateGenesis add debug logs
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Warn if genesis account allocation is in reserved precompile range
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Add sender into unsignedPrivateMarkerTransaction for plugin to make descision
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Remove locking solution as may not be needed
- if this is required we should first evaluate actual use cases
and test scenarios
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Rename PrivateStateGenesis -> PrivateStateGenesisAllocator
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Tidy up naming for getPrivateStateGenesisAllocator
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Privacy Plugin javadocs
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Update spotless to 5.14.2 and java-google-format to 1.10.0.
Both of these are needed to support Java 16 and Gradle 7.x.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Update ErrorProne to 2.7.1 (needed for Gradle 7.x upgrade).
All new rules are fairly benign and easy to fix.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Add unstable CLI option for max ommers depth
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* Move to a builder pattern for mining parameters
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* Refactor: clarify intent of arg when testing permissioning plugin
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Refactor: remove duplicate createPrivateMarkerTransaction
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* PrivateMarkerTransactionFactory: add option to delegate to plugin
if defined the plugin will be responsible for creating the pmt
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Implement locking strategy for eea_sendRawTransaction
- this will lock per address being sent to prevent nonce
too low errors
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Refactor plugin integration to use a more explicit poco
- the plugin will need to sign the transaction with the data it's given
- it will not need to query anything e.g nonce etc
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* refactor: update naming and tidy up based on comments
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
* Isolate code for calculating gas limit when using privacy plugin
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Co-authored-by: Vijay Michalik <vijay.michalik@consensys.net>
* Add support for mining ommers, up to 8 blocks behind the head job
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* Add a CLI option to set PoW jobs TTL
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* Upgrade to Apache Tuweni 2.0
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* Remove intermediate repository
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* Remove all occurrences of toBytes
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* Migrate to tuweni-bytes
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* add changelog
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* correct reference tests
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* Initial API changes
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* more changes
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* Change APIs for VM ops
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* Use constant UInt256.ONE
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* Optimize a bit address <> word transformation
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
* spotless
Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>