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>
Create readOnlyValidatorProvider in QbftBesuControllerBuilder and pass into QbftJsonRpcMethods constructor (better than using protocolContext as is only used once when creating the RPCs
This requires storing transactionValidatorProvider in a field and relying on its earlier creation during createConsensusContext()
Fixes#2795
Signed-off-by: Simon Dudley <simon.dudley@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>
During the transition from contract mode to block header mode, when creating the extra data for a new block, we need to look ahead to the next block's voteProvider to obtain the nonEmpty one associated with the BlockValidatorProvider.
This only applies to ForkingValidatorProvider which is currently only used for QBFT. However, we don't want QBFT to know it's using a ForkingValidatorProvider. Therefore we need to implement getVoteProviderAfterBlock on the ValidatorProvider interface even though it's implementation is equivalent to getVoteProvider.
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
This is a re-implementation of the initial POC done in https://github.com/PegaSysEng/pantheon/pull/1909/ by Danno Ferrin <danno.ferrin@gmail.com>
* Only enable plugin rpc api when enabled on --rpc-http-api or --rpc-ws-apis
* Only allow new rpc endpoints to be defined
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
QBFT to log warning when using validator contract if genesis extra data has validator
Also prevent existing warning from logging when using validator contract with no signers in genesis extra data.
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
* Extract private key file option to mixin (#536)
Signed-off-by: Diego López León <dieguitoll@gmail.com>
* Method rename (#536)
Signed-off-by: Diego López León <dieguitoll@gmail.com>
* Use keypair to resolve node key in public-key subcommands (#536)
Signed-off-by: Diego López León <dieguitoll@gmail.com>
* Refactor common behavior for public key subcommands (#536)
Signed-off-by: Diego López León <dieguitoll@gmail.com>
* Write test private key to default location (#536)
This is to rely on actual file system resolution for the test context
Signed-off-by: Diego López León <dieguitoll@gmail.com>
* Add support for custom private key file on public-key subcommands (#536)
Signed-off-by: Diego López León <dieguitoll@gmail.com>
Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
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>
* Extract gas cost calculation for Balance, ExtCodeCopy, ExtCodeHash, ExtCodeSize operations into cost function.
* Allow cost function to be called by an outside library
Signed-off-by: failfmi <oscurocalma@gmail.com>
Migrate ExceptionalHaltReason to an interface from an enum. The enum
made it difficult for downstream implementations to add custom reasons
as to why the EVM has halted. Switching to an interface is needed
because enums are final and not extensible.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Raise the visibility of AbstractCreateOperation's constructor to
protected from package so that create operations outside the library can
re-use the existing code.
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* Allow the use of BESU_CONFIG_FILE env var to specify config TOML
* Throw an exception when BESU_CONFIG_FILE and --config-file specified
* Switch ExecutionException for ParameterException
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>