Add minimum remaining gas check to exceptional halt reasons. Configure it
to zero pre-istanbul and 2300 for istanbul.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Add configurability to how the ECADD, ECMUL, and Pairing check precompiled
contracts calculate their gas price, and expose static methods for byzantium
and istanbul era prices.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Rename privacyGroupId to createPrivacyGroupId
Also add test for eea_createPrivacyGroup
* Update the JsonRpcError list
* Update orion version
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* [PAN-2829] Add accountVersion to MessageFrame
Add the current contract's version to the message frame.
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
* refactor Enclave
- use final modifiers when appropriate to comply with Pantheon global policy
- use `assertj` assertions in tests
- don't use local variables when not necessary
- check exception message for `upCheck` method
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Fix bugs
Fix remote connection fraction calculation (order of operations bug),
remove early return, allow all remote connections to be prohibited,
change disconnect reason to TOO_MANY_PEERS.
* Fix comment
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* [PAN-1683] Limit the fraction of wire connections initiated by peers
To protect against eclipse attacks, we should not allow all of our wire connections to be initiated from network peers. Some fraction of wire connections should be initiated by our node by connecting to peers in our discovery peer table. This PR ensures the fraction abides the limit.
* change fraction default value and add tests
* make fraction of remote wire connections configurable
- add a cli option to configure the fraction: `--fraction-remote-connections-allowed`
- introduce `Fraction` class to handle the conversion of the CLI option to a double and check if the value is between 0.0 and 1.0
- add tests
- fix broken tests
* remove unused local variable
* fix RunnerTest
* set fraction to 1.0 in PantheonFactoryConfigurationBuilder
* update test
* Introduce --limit-remote-wire-connections-enabled
* fix unused field
* fix conflict
* Update ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/RlpxAgent.java
Co-Authored-By: Danno Ferrin <danno.ferrin@shemnon.com>
* Update ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/RlpxAgent.java
Co-Authored-By: Danno Ferrin <danno.ferrin@shemnon.com>
* Update ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/RlpxAgent.java
Co-Authored-By: Danno Ferrin <danno.ferrin@shemnon.com>
* fix PR discussion and tests
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
EIP-1602 specifies a new validation step. Add hooks for those to occur.
Move contract size checking into the validation hooks.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Initial EIP-1702 versioning code. Version internally is an `int` for Java
reasons. In the future if the versions become sparse or large we will create a
"proxy" version index by putting the standardized indexes into an enum and
using the enum ordinal instead.
Reference tests all pass (hence the WorldStateMock if block) and
GenesisStateTest has an explicit version test now.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>