Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion solc/CommandLineInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void CommandLineInterface::handleGasEstimation(string const& _contract)
if (eth::AssemblyItems const* items = m_compiler->assemblyItems(_contract))
{
Gas gas = GasEstimator::functionalEstimation(*items);
u256 bytecodeSize(m_compiler->runtimeObject(_contract).bytecode.size());
u256 bytecodeSize(m_compiler->object(_contract).bytecode.size());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was correct. The part after the + is the costs of code deployment. The cost of the transaction is not visible here at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cost of the transaction is the cost of deployment. The creation code only does a return. Am I missing something?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the return, you still have to pay a fee that is linear with the code deposit size.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, found it in the YP:

If the initialization code completes successfully, a fi-
nal contract-creation cost is paid, the code-deposit cost,
c, proportional to the size of the created contract’s code:
(96) c ≡ Gcodedeposit × |o

codeDepositCost seems appropriate then to keep in line with the YP.

cout << "construction:" << endl;
cout << " " << gas << " + " << (bytecodeSize * eth::GasCosts::createDataGas) << " = ";
gas += bytecodeSize * eth::GasCosts::createDataGas;
Expand Down
2 changes: 1 addition & 1 deletion solc/jsonCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Json::Value estimateGas(CompilerStack const& _compiler, string const& _contract)
if (eth::AssemblyItems const* items = _compiler.assemblyItems(_contract))
{
Gas gas = GasEstimator::functionalEstimation(*items);
u256 bytecodeSize(_compiler.runtimeObject(_contract).bytecode.size());
u256 bytecodeSize(_compiler.object(_contract).bytecode.size());
Json::Value creationGas(Json::arrayValue);
creationGas[0] = gasToJson(gas);
creationGas[1] = gasToJson(bytecodeSize * eth::GasCosts::createDataGas);
Expand Down