mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
Increase refund counter if deleting a storage item [Delivers #81575908]
This commit is contained in:
parent
22e4d16e1f
commit
e4a77c1f69
3 changed files with 17 additions and 1 deletions
1
evmcc/test/ext/store_delete.evm
Normal file
1
evmcc/test/ext/store_delete.evm
Normal file
|
|
@ -0,0 +1 @@
|
|||
6104d26063576000606357
|
||||
9
evmcc/test/ext/store_delete.lll
Normal file
9
evmcc/test/ext/store_delete.lll
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
(asm
|
||||
1234
|
||||
99
|
||||
SSTORE
|
||||
0
|
||||
99
|
||||
SSTORE
|
||||
)
|
||||
|
|
@ -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…
Reference in a new issue