aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/solidityExecutionFramework.h
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-05-21 00:31:47 +0800
committerchriseth <c@ethdev.com>2015-05-21 00:31:47 +0800
commit42a36548e2c6575bd83213861ebece85d2048aa5 (patch)
tree68b247bed02a61609e9f81256eae88a8286665ec /libsolidity/solidityExecutionFramework.h
parentb0d5cbf6983030c4e4fb48c45e1602880069b063 (diff)
parent79f11974eafee20365c65c02798200353951564a (diff)
downloaddexon-solidity-42a36548e2c6575bd83213861ebece85d2048aa5.tar
dexon-solidity-42a36548e2c6575bd83213861ebece85d2048aa5.tar.gz
dexon-solidity-42a36548e2c6575bd83213861ebece85d2048aa5.tar.bz2
dexon-solidity-42a36548e2c6575bd83213861ebece85d2048aa5.tar.lz
dexon-solidity-42a36548e2c6575bd83213861ebece85d2048aa5.tar.xz
dexon-solidity-42a36548e2c6575bd83213861ebece85d2048aa5.tar.zst
dexon-solidity-42a36548e2c6575bd83213861ebece85d2048aa5.zip
Merge pull request #1983 from chriseth/sol_knowledgeableGasEstimation
Gas estimation taking known state into account.
Diffstat (limited to 'libsolidity/solidityExecutionFramework.h')
-rw-r--r--libsolidity/solidityExecutionFramework.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/libsolidity/solidityExecutionFramework.h b/libsolidity/solidityExecutionFramework.h
index f76465f2..fa25fb12 100644
--- a/libsolidity/solidityExecutionFramework.h
+++ b/libsolidity/solidityExecutionFramework.h
@@ -44,11 +44,11 @@ public:
bytes const& compileAndRun(std::string const& _sourceCode, u256 const& _value = 0, std::string const& _contractName = "")
{
- dev::solidity::CompilerStack compiler(m_addStandardSources);
- compiler.addSource("", _sourceCode);
- ETH_TEST_REQUIRE_NO_THROW(compiler.compile(m_optimize), "Compiling contract failed");
+ m_compiler.reset(false, m_addStandardSources);
+ m_compiler.addSource("", _sourceCode);
+ ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize), "Compiling contract failed");
- bytes code = compiler.getBytecode(_contractName);
+ bytes code = m_compiler.getBytecode(_contractName);
sendMessage(code, true, _value);
BOOST_REQUIRE(!m_output.empty());
return m_output;
@@ -160,12 +160,14 @@ protected:
BOOST_REQUIRE(executive.go());
m_state.noteSending(m_sender);
executive.finalize();
+ m_gasUsed = executive.gasUsed();
m_output = executive.out().toVector();
m_logs = executive.logs();
}
bool m_optimize = false;
bool m_addStandardSources = false;
+ dev::solidity::CompilerStack m_compiler;
Address m_sender;
Address m_contractAddress;
eth::State m_state;
@@ -173,6 +175,7 @@ protected:
u256 const m_gas = 100000000;
bytes m_output;
eth::LogEntries m_logs;
+ u256 m_gasUsed;
};
}