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

Commit

Permalink
Implement EIP160 #417
Browse files Browse the repository at this point in the history
  • Loading branch information
konradkonrad committed Nov 2, 2016
1 parent 9b830b7 commit 2984b59
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ethereum/opcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,5 @@
CALL_CHILD_LIMIT_NUM = 63
CALL_CHILD_LIMIT_DENOM = 64
SUICIDE_SUPPLEMENTAL_GAS = 5000
# Spurious dragon HF changes
GEXPONENTBYTE_SUPPLEMENTAL_GAS = 40
2 changes: 2 additions & 0 deletions ethereum/processblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ def __init__(self, block, tx):
self.account_exists = block.account_exists
self.post_homestead_hardfork = block.number >= block.config['HOMESTEAD_FORK_BLKNUM']
self.post_anti_dos_hardfork = block.number >= block.config['ANTI_DOS_FORK_BLKNUM']
self.post_spurious_dragon_hardfork = \
block.number >= block.config['SPURIOUS_DRAGON_FORK_BLKNUM']


def apply_msg(ext, msg):
Expand Down
5 changes: 4 additions & 1 deletion ethereum/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@ def vm_execute(ext, msg, code):
# fee for exponent is dependent on its bytes
# calc n bytes to represent exponent
nbytes = len(utils.encode_int(exponent))
expfee = nbytes * opcodes.GEXPONENTBYTE
expfee = nbytes * (opcodes.GEXPONENTBYTE +
ext.post_spurious_dragon_hardforkf() * opcodes.GEXPONENTBYTE_SUPPLEMENTAL_GAS)
# ^ EIP160: increase the gas cost of EXP from 10 + 10 per
# byte in the exponent to 10 + 50 per byte in the exponent.
if compustate.gas < expfee:
compustate.gas = 0
return vm_exception('OOG EXPONENT')
Expand Down

0 comments on commit 2984b59

Please sign in to comment.