diff options
author | chriseth <chris@ethereum.org> | 2018-08-14 18:14:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-14 18:14:53 +0800 |
commit | d01ffd1ad9737a13a7d39e33246d101b36b5cd93 (patch) | |
tree | 20a7a250cd491fd2d639a4bfd4a19f77a2fc5542 /test/ExecutionFramework.cpp | |
parent | 6ca3973944546d1a5518274fea47e635a07f9ca5 (diff) | |
parent | b325a70d59baf1afc4e284cc8738d71069ec97c2 (diff) | |
download | dexon-solidity-d01ffd1ad9737a13a7d39e33246d101b36b5cd93.tar dexon-solidity-d01ffd1ad9737a13a7d39e33246d101b36b5cd93.tar.gz dexon-solidity-d01ffd1ad9737a13a7d39e33246d101b36b5cd93.tar.bz2 dexon-solidity-d01ffd1ad9737a13a7d39e33246d101b36b5cd93.tar.lz dexon-solidity-d01ffd1ad9737a13a7d39e33246d101b36b5cd93.tar.xz dexon-solidity-d01ffd1ad9737a13a7d39e33246d101b36b5cd93.tar.zst dexon-solidity-d01ffd1ad9737a13a7d39e33246d101b36b5cd93.zip |
Merge pull request #4799 from ethereum/semanticsTestsGasEtAl
Semantics tests for ``gasleft()``, ``blockhash()`` ``tx.gasprice`` and ``block.gaslimit``
Diffstat (limited to 'test/ExecutionFramework.cpp')
-rw-r--r-- | test/ExecutionFramework.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ExecutionFramework.cpp b/test/ExecutionFramework.cpp index 00f5e697..ea624735 100644 --- a/test/ExecutionFramework.cpp +++ b/test/ExecutionFramework.cpp @@ -85,6 +85,22 @@ std::pair<bool, string> ExecutionFramework::compareAndCreateMessage( return make_pair(false, message); } +u256 ExecutionFramework::gasLimit() const +{ + auto latestBlock = m_rpc.eth_getBlockByNumber("latest", false); + return u256(latestBlock["gasLimit"].asString()); +} + +u256 ExecutionFramework::gasPrice() const +{ + return u256(m_rpc.eth_gasPrice()); +} + +u256 ExecutionFramework::blockHash(u256 const& _blockNumber) const +{ + return u256(m_rpc.eth_getBlockByNumber(toHex(_blockNumber, HexPrefix::Add), false)["hash"].asString()); +} + void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256 const& _value) { if (m_showMessages) |