Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 0eb63fe

Browse files
author
Jan Xie
committed
spurious dragon check
1 parent 01e3fd4 commit 0eb63fe

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

ethereum/state.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def set_storage_data (self, addr, k, v):
198198
self.set_storage(addr, k, encode_int(v) if is_numeric(v) and k not in ACCOUNT_SPECIAL_PARAMS else v)
199199

200200
def account_exists(self, addr):
201-
if self.is_CLEARING():
201+
if self.is_SPURIOUS_DRAGON():
202202
return self.get_nonce(addr) or self.get_balance(addr) or self.get_code(addr)
203203
if addr not in self.modified:
204204
o = self.trie.get(addr) != trie.BLANK_NODE
@@ -251,8 +251,7 @@ def commit(self, allow_empties=False):
251251
if addr in self.modified or True:
252252
if not acct.deleted:
253253
acct._cached_rlp = None
254-
# print 'moose', addr.encode('hex'), self.is_CLEARING(), acct.is_blank(), acct.nonce, acct.balance, repr(acct.code)
255-
if self.is_CLEARING() and acct.is_blank() and not allow_empties:
254+
if self.is_SPURIOUS_DRAGON() and acct.is_blank() and not allow_empties:
256255
self.trie.delete(addr)
257256
else:
258257
self.trie.update(addr, rlp.encode(acct))
@@ -455,8 +454,8 @@ def is_SERENITY(self, at_fork_height=False):
455454
def is_ANTI_DOS(self, at_fork_height=False):
456455
return self._is_X_fork('ANTI_DOS', at_fork_height)
457456

458-
def is_CLEARING(self, at_fork_height=False):
459-
return self._is_X_fork('CLEARING', at_fork_height)
457+
def is_SPURIOUS_DRAGON(self, at_fork_height=False):
458+
return self._is_X_fork('SPURIOUS_DRAGON', at_fork_height)
460459

461460
def is_DAO(self, at_fork_height=False):
462461
return self._is_X_fork('DAO', at_fork_height)

ethereum/state_transition.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ def __init__(self, state, tx):
430430
self.post_metropolis_hardfork = lambda: state.is_METROPOLIS()
431431
self.post_serenity_hardfork = lambda: state.is_SERENITY()
432432
self.post_anti_dos_hardfork = lambda: state.is_ANTI_DOS()
433-
self.post_clearing_hardfork = lambda: state.is_CLEARING()
433+
self.post_spurious_dragon_hardfork = lambda: state.is_SPURIOUS_DRAGON()
434434
self.blockhash_store = state.config['METROPOLIS_BLOCKHASH_STORE']
435435
self.snapshot = state.snapshot
436436
self.revert = state.revert
@@ -477,7 +477,7 @@ def __init__(self, state):
477477
self.post_metropolis_hardfork = lambda: state.is_METROPOLIS()
478478
self.post_serenity_hardfork = lambda: state.is_SERENITY()
479479
self.post_anti_dos_hardfork = lambda: state.is_ANTI_DOS()
480-
self.post_clearing_hardfork = lambda: state.is_CLEARING()
480+
self.post_spurious_dragon_hardfork = lambda: state.is_SPURIOUS_DRAGON()
481481
self.blockhash_store = state.config['METROPOLIS_BLOCKHASH_STORE']
482482
self.snapshot = state.snapshot
483483
self.revert = state.revert

ethereum/vm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def vm_execute(ext, msg, code):
289289
# calc n bytes to represent exponent
290290
nbytes = len(utils.encode_int(exponent))
291291
expfee = nbytes * opcodes.GEXPONENTBYTE
292-
if ext.post_clearing_hardfork():
292+
if ext.post_spurious_dragon_hardfork():
293293
expfee += opcodes.EXP_SUPPLEMENTAL_GAS * nbytes
294294
if compustate.gas < expfee:
295295
compustate.gas = 0
@@ -579,7 +579,7 @@ def vm_execute(ext, msg, code):
579579
return vm_exception('OOG EXTENDING MEMORY')
580580
to = utils.encode_int(to)
581581
to = ((b'\x00' * (32 - len(to))) + to)[12:]
582-
extra_gas = (not ext.account_exists(to)) * (value > 0 or not ext.post_clearing_hardfork()) * opcodes.GCALLNEWACCOUNT + \
582+
extra_gas = (not ext.account_exists(to)) * (value > 0 or not ext.post_spurious_dragon_hardfork()) * opcodes.GCALLNEWACCOUNT + \
583583
(value > 0) * opcodes.GCALLVALUETRANSFER + \
584584
ext.post_anti_dos_hardfork() * opcodes.CALL_SUPPLEMENTAL_GAS
585585
submsg_gas = gas + opcodes.GSTIPEND * (value > 0)
@@ -692,7 +692,7 @@ def vm_execute(ext, msg, code):
692692
xfer = ext.get_balance(msg.to)
693693
if ext.post_anti_dos_hardfork():
694694
extra_gas = opcodes.SUICIDE_SUPPLEMENTAL_GAS + \
695-
(not ext.account_exists(to)) * (xfer > 0 or not ext.post_clearing_hardfork()) * opcodes.GCALLNEWACCOUNT
695+
(not ext.account_exists(to)) * (xfer > 0 or not ext.post_spurious_dragon_hardfork()) * opcodes.GCALLNEWACCOUNT
696696
if not eat_gas(compustate, extra_gas):
697697
return vm_exception("OUT OF GAS")
698698
ext.set_balance(to, ext.get_balance(to) + xfer)

0 commit comments

Comments
 (0)