Browse Source

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

cl-refactor
Paweł Bylica 10 years ago
parent
commit
e4a77c1f69
  1. 1
      evmcc/test/ext/store_delete.evm
  2. 9
      evmcc/test/ext/store_delete.lll
  3. 8
      libevmjit/Ext.cpp

1
evmcc/test/ext/store_delete.evm

@ -0,0 +1 @@
6104d26063576000606357

9
evmcc/test/ext/store_delete.lll

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

8
libevmjit/Ext.cpp

@ -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)

Loading…
Cancel
Save