 |
Ethereum
PoC-8
The C++ Implementation of Ethereum
|
Go to the documentation of this file.
25 #include <unordered_map>
42 namespace test {
class ImportTest;
class StateLoader; }
50 class TransactionQueue;
51 struct VerifiedBlockRef;
52 class LastBlockHashesFace;
145 std::map<h256, std::pair<u256, u256>>
storage(
Address const& _contract)
const {
return m_state.
storage(_contract); }
266 bool isSealed()
const {
return !m_currentBytes.empty(); }
279 void uncommitToSeal();
286 void applyRewards(std::vector<BlockHeader>
const& _uncleBlockHeaders,
u256 const& _blockReward);
289 u256 gasUsed()
const {
return m_receipts.size() ? m_receipts.back().cumulativeGasUsed() : 0; }
292 void performIrregularModifications();
295 void updateBlockhashContract();
303 BlockHeader m_previousBlock;
304 BlockHeader m_currentBlock;
305 bytes m_currentBytes;
306 bool m_committedToSeal =
false;
309 bytes m_currentUncles;
313 SealEngineFace* m_sealEngine =
nullptr;
bool addressInUse(Address const &_address) const
Check if the address is in use.
std::function< void(uint64_t, uint64_t, Instruction, bigint, bigint, bigint, VMFace const *, ExtVMFace const *)> OnOpFunc
void commitToSeal(BlockChain const &_bc, bytes const &_extraData={})
bytes const & blockData() const
bool addressInUse(Address const &_address) const
Check if the address is in use.
h256 rootHash() const
The hash of the root of our state tree.
Encodes a transaction, ready to be exported to or freshly imported from RLP.
bytes const & code(Address const &_contract) const
std::vector< Transaction > Transactions
Nice name for vector of Transaction.
PopulationStatistics populateFromChain(BlockChain const &_bc, h256 const &_hash, ImportRequirements::value _ir=ImportRequirements::None)
Construct state object from arbitrary point in blockchain.
h256 rootHash() const
The hash of the root of our state tree.
std::map< h256, std::pair< u256, u256 > > storage(Address const &_contract) const
u256 enactOn(VerifiedBlockRef const &_block, BlockChain const &_bc)
bytes const & code(Address const &_addr) const
h256 stateRootBeforeTx(unsigned _i) const
Address author() const
Get the author address for any transactions we do and rewards we get.
h256 storageRoot(Address const &_contract) const
Get the root of the storage of an account.
u256 transactionsFrom(Address const &_address) const
u256 getNonce(Address const &_addr) const
int64_t utcTime()
Get the current time in seconds since the epoch in UTC.
LogBloom logBloom() const
Get the bloom filter of all logs that happened in the block.
void noteChain(BlockChain const &_bc)
LogBloom const & logBloom(unsigned _i) const
Get the bloom filter of a particular transaction that happened in the block.
std::unordered_set< h256 > h256Hash
boost::log::sources::severity_channel_logger<> Logger
std::vector< LogEntry > LogEntries
Block(u256 const &_accountStartNonce)
Default constructor; creates with a blank database prepopulated with the genesis block.
ExecutionResult execute(LastBlockHashesFace const &_lh, Transaction const &_t, Permanence _p=Permanence::Committed, OnOpFunc const &_onOp=OnOpFunc())
void cleanup()
Returns back to a pristine state after having done a playback.
std::vector< byte > bytes
Logger createLogger(int _severity, std::string const &_channel)
Transactions const & pending() const
Get the list of pending transactions.
std::vector< TransactionReceipt > TransactionReceipts
LogEntries const & log(unsigned _i) const
Get the list of pending transactions.
Message-call/contract-creation executor; useful for executing transactions.
Implements the blockchain database. All data this gives is disk-backed. @threadsafe.
Externality interface for the Virtual Machine providing access to world state.
State const & state() const
Get the backing state object.
h256 codeHash(Address const &_contract) const
bool addressHasCode(Address const &_address) const
Check if the address contains executable code.
A queue of Transactions, each stored as RLP. Maintains a transaction queue sorted by nonce diff and g...
OverlayDB const & db() const
h256Hash const & pendingHashes() const
Get the list of hashes of pending transactions.
void resetCurrent(int64_t _timestamp=utcTime())
std::unordered_map< Address, u256 > addresses() const
OverlayDB const & db() const
Open a DB - useful for passing into the constructor & keeping for other states that are necessary.
friend class dev::test::ImportTest
Block(BlockChain const &_bc)
Construct from a given blockchain. Empty, but associated with _bc 's chain params.
bool addressHasCode(Address const &_address) const
Check if the address contains executable code.
TransactionReceipt const & receipt(unsigned _i) const
Get the transaction receipt for the transaction of the given index.
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > u256
h256 storageRoot(Address const &_contract) const
Get the root of the storage of an account.
Verified block info, does not hold block data, but a reference instead.
LogEntries const & log() const
bool sealBlock(bytes const &_header)
DEV_SIMPLE_EXCEPTION(NoHashRecorded)
std::unordered_map< Address, u256 > addresses() const
u256 balance(Address const &_address) const
u256 balance(Address const &_id) const
BlockHeader const & info() const
Get the header information on the present block.
h256 codeHash(Address const &_contract) const
Description of the result of executing a transaction.
u256 gasLimitRemaining() const
Get the remaining gas limit in this block.
u256 storage(Address const &_contract, u256 const &_memory) const
void setAuthor(Address const &_id)
Interface for getting a list of recent block hashes @threadsafe.
LogBloom const & bloom() const
u256 storage(Address const &_contract, u256 const &_memory) const
friend class dev::test::StateLoader
Active model of a block within the block chain. Keeps track of all transactions, receipts and state f...
std::pair< TransactionReceipts, bool > sync(BlockChain const &_bc, TransactionQueue &_tq, GasPricer const &_gp, unsigned _msTimeout=100)
Block & operator=(Block const &_s)
Copy state object.