aboutsummaryrefslogtreecommitdiffstats
path: root/test/ExecutionFramework.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/ExecutionFramework.cpp')
-rw-r--r--test/ExecutionFramework.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/test/ExecutionFramework.cpp b/test/ExecutionFramework.cpp
index a24f78fb..3922d5e9 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)
@@ -106,9 +122,9 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256
if (!_isCreation)
{
d.to = dev::toString(m_contractAddress);
- BOOST_REQUIRE(m_rpc.eth_getCode(d.to, "latest").size() > 2);
+ BOOST_REQUIRE(m_rpc.eth_getCode(d.to, "pending").size() > 2);
// Use eth_call to get the output
- m_output = fromHex(m_rpc.eth_call(d, "latest"), WhenError::Throw);
+ m_output = fromHex(m_rpc.eth_call(d, "pending"), WhenError::Throw);
}
string txHash = m_rpc.eth_sendTransaction(d);
@@ -142,6 +158,11 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256
entry.data = fromHex(log.data, WhenError::Throw);
m_logs.push_back(entry);
}
+
+ if (!receipt.status.empty())
+ m_transactionSuccessful = (receipt.status == "1");
+ else
+ m_transactionSuccessful = (m_gas != m_gasUsed);
}
void ExecutionFramework::sendEther(Address const& _to, u256 const& _value)