Conversation
| m_context << dupInstruction(m_context.baseToCurrentStackOffset(gasStackPos)); | ||
| else if (m_context.experimentalFeatureActive(ExperimentalFeature::V050)) | ||
| else if (m_context.evmVersion().canOverchargeGasForCall()) | ||
| // Send all gas (requires tangerine whistle EVM) |
There was a problem hiding this comment.
How about actually adding tanginewhistle as a level? Should be pretty straightfoward, one place to change it.
There was a problem hiding this comment.
We can do that. It was between homestead and byzantium, right?
There was a problem hiding this comment.
Then I'll also add spurious dragon.
There was a problem hiding this comment.
That could be used for the code size limit and the exp repricing check if we implement it.
|
The send-all-gas change looks good. |
d8fe874 to
9e4a911
Compare
| m_context << u256(retSize) << Instruction::ADD << Instruction::MSTORE; | ||
| // Touch the end of the output area so that we do not pay for memory resize during the call | ||
| // (which we would have to subtract from the gas left) | ||
| // We could also just use MLOAD; POP right before the gas calculation, but the optimizer |
There was a problem hiding this comment.
Even this comment is outdated at this point, since mload was changed in the optimiser :)
| // We could also just use MLOAD; POP right before the gas calculation, but the optimizer | ||
| // would remove that, so we use MSTORE here. | ||
| if (!_functionType.gasSet() && retSize > 0) | ||
| if (!m_context.evmVersion().canOverchargeGasForCall()) |
There was a problem hiding this comment.
Actually this code piece may still be useful if there is out of gas condition, it stops at memory expansion and not at the time of the return of the call (it is an edge case though).
Also not sure this doesn't depend on hasReturndata the option?
There was a problem hiding this comment.
I'm not 100% sure I understand. The problem is that the CALL opcode performs memory expansion for the return area. If I remember correctly, the CALL opcode first performs memory expansion to accomodate both the argument and the return data memory area. After that, pre-tangerine-whistle VMs would check if there is still enough gas left to send the specified amount with the call. Post-tangerine-whistle VMs would not fail if this check is negative, but just send as much gas as is still left.
"it stops .. not at the time of the return of the call" - as far as I know, this can never happen, since the memory is expanded before the call is performed. Moving this to after the call was one of the early suggestions as part of EIP5.
This should be unrelated to hasReturndata.
There was a problem hiding this comment.
Had to check this again also discussed with @chfast. Apparently memory expansion happens before the call and the remainder gas is taken as you've said. My comment is invalid then.
Also not including this code should make no difference in behaviour but should save gas by not doing it manually.
9e4a911 to
e472893
Compare
|
Changed the backticks. |
|
Tests fail on gas disagreement: |
|
@axic I think this is an error in travis, because it is not present in circle |
e472893 to
83fcf00
Compare
|
The error is already in develop, not in this branch. I think it came with "evmVersion". |
Depends on #3569