Increase refund counter if deleting a storage item [Delivers #81575908]

This commit is contained in:
Paweł Bylica 2014-10-30 11:12:18 +01:00
parent 22e4d16e1f
commit e4a77c1f69
3 changed files with 17 additions and 1 deletions

View file

@ -0,0 +1 @@
6104d26063576000606357

View file

@ -0,0 +1,9 @@
(asm
1234
99
SSTORE
0
99
SSTORE
)

View file

@ -6,6 +6,7 @@
#include <llvm/IR/IntrinsicInst.h>
#include <libdevcrypto/SHA3.h>
#include <libevm/FeeStructure.h>
#include "Runtime.h"
#include "Type.h"
@ -179,7 +180,12 @@ extern "C"
{
auto index = llvm2eth(*_index);
auto value = llvm2eth(*_value);
_rt->getExt().setStore(index, value); // Interface uses native endianness
auto& ext = _rt->getExt();
if (value == 0 && ext.store(index) != 0) // If delete
ext.sub.refunds += c_sstoreRefundGas; // Increase refund counter
ext.setStore(index, value); // Interface uses native endianness
}
EXPORT void ext_calldataload(Runtime* _rt, i256* _index, i256* _value)