Undo the frame caching of balance for the SELFBALANCE operation.
We would need to keep the balance up to date for all value transfer calls, and
currently those happen at several orders of magnitude more often than
SELFBALANCE operation, so more CPU time would be spent updating a value that is
never read than could be saved by not going to the account trie.
We may revisit this later, but this is the quickest path to conformance.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* sweep state roots before child nodes
* Adds long removeAccountStateTrieNode(key) method to WorldStateStorage.Updater
* remove assertj assertions from `AbstractKeyValueStorageTest`
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
When an EVM operation is halted (for example, for out of gas) we don't log what
the operation would have been nor do we log the reason for the halt.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* [PAN-2842] Blake 2b tweaks
* Adjust endianess on byte payload
* f flag can have only 0 or 1
* Fewer successful vector tests
* Tests for failure and edge cases
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Database Versioning: The behavior is to load the database at the existing version if it
already exists or create the newest version if it doesn't
* multi-column by default: This makes the separated world state storage column required by mark sweep on by default
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Mark Sweep Pruner
* add `unload` method on Node interface, which is a noop everywhere but on `StoredNode`
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
The TransactionReceipt type is not stored and it's functionality is covered by
the TransactionReceiptFactory. The Root/Status values are divined by the
presence or absence of the state root value.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Retesteth will often request an in-process blockchain be rewound one block so
that it can attempt the same test with tweaked parameters. Add support for this.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Retesteth requires support for mining without block rewards and without PoW.
No Proof simply requires exposing the nonce generator and using a special
EthHashSolver.
No Reward is supported via a flag in the ProtocolSpec, stating whether or not
to skip zero rewards. For frontier, homestead, and tangerine whistle (EIP150)
this flag is false. For all other forks and all other consensus engines the
flag is true, even when emulating EVM state from those three forks as all
non-PoW consensus engines never consider block rewards.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* [PAN-2989] EIP-1884 - Repricing for trie-size-dependent opcodes
Add the new gas costs and new operation to the EVM.
Add contract balance to message frame
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
If you try and do a difficulty of 1 the UInt256 class used for comparison throws
an error because 2^256 is 33 bytes. Instead use 2^256-1 which is 32.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
When a chainID is not specifed in a genesis file for the purposes of the chainid
opcode we interpret that to mean chain ID 0.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
The revert reason returned from the EVM has been changed to a bytes value to
better represent the specification (of it being an ABI encoded data block).
This has meant that the TransactionReceipt returned from
ethGetTransactionReceipt now provides a hex-encoded string (rather than UTF-8).
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
This reverts commit 814b36e4
The needed chantes to get rid of Instant.now (which is also needed to get rid
of the wall clock dependency) are too deep and intrusive into IBFT to try and
speed patch them in that some APIs require re-work, so in the interst of test
stability this gets sheleved until it is all ready.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
To allow us to reset the timestamp in the blockchain for Retesteth support
we need to pass a Clock to affected APIs and use that instead of the static method
System.currentTimeMillis(). The most consistent way to do this that will ensure
that the API does not sneak back in is to ban the method via ErrorProne.
TestClock.fixed() was altered to return the "now" time of the first time the fixed clock was requested, needed for many header validation tasks validating headers are not from the future.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Note that EIP-1706 was already implemented elsewhere and this is
just the gas calculation updates.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Reduce the non-zero byte of intrinsic gas cost from 68 to 16.
Keep all other values the same.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Retesteh has some genesis file that specify a nonce in the relevant accounts.
Add support to the GenesisState class to pre-set nonces.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
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>
* [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>
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>
BlockDataGenerator (a testing util) uses the default key generation code, which
is set to a production grade SecureRandom seed by default. However this creates
non-deterministic results with the block data.
This changes the generator for test data to use a deterministic set of key
pairs.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Add privacy group id to private transaction
* Update enclave send methods to accept privacy group id
* Update eea sendRawTransaction endpoint
* extract privacy group id from private transaction if present
* extract privateFor/privateFrom if privacy group id is not present
* Fix tests
* Change abstract class invocation to concrete class.
* Utility method to load enclave public key
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* add dump sub command
* add getBlockHash method for the dump sub command
* Resolve review issues : Add the ability to export multiple blocks, Rename dump command to export command, Improve tests for the export command
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>