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

Commit 611252b

Browse files
vubvub
authored andcommitted
Possible DAO HF impl for reference
1 parent d5c822c commit 611252b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

ethereum/blocks.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,14 @@ def revert(self, mysnapshot):
11771177
self.ether_delta = mysnapshot['ether_delta']
11781178

11791179
def initialize(self, parent):
1180+
# DAO fork
1181+
if self.number == self.config["DAO_FORK_BLKNUM"]:
1182+
dao_main_addr = utils.normalize_address(self.config["DAO_MAIN_ADDR"])
1183+
for acct in map(utils.normalize_address, self.config["DAO_ADDRESS_LIST"]):
1184+
self.delta_balance(dao_main_addr, self.get_balance(addr))
1185+
self.set_balance(addr, 0)
1186+
self.set_code(dao_main_addr, self.config["DAO_NEWCODE"])
1187+
# Likely metropolis changes
11801188
if self.number == self.config["METROPOLIS_FORK_BLKNUM"]:
11811189
self.set_code(utils.normalize_address(self.config["METROPOLIS_STATEROOT_STORE"]), self.config["METROPOLIS_GETTER_CODE"])
11821190
self.set_code(utils.normalize_address(self.config["METROPOLIS_BLOCKHASH_STORE"]), self.config["METROPOLIS_GETTER_CODE"])

ethereum/config.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@
5454
METROPOLIS_WRAPAROUND=65536,
5555
METROPOLIS_GETTER_CODE='6000355460205260206020f3'.decode('hex'),
5656
METROPOLIS_DIFF_ADJUSTMENT_CUTOFF=9,
57-
# Metropolis fork
57+
# DAO fork
58+
DAO_FORK_BLKNUM = 9999998,
59+
DAO_ADDRESS_LIST = [],
60+
DAO_MAIN_ADDR = '0xbb9bc244d798123fde783fcc1c72d3bb8c189413',
61+
DAO_NEWCODE = ''
5862
)
5963
assert default_config['NEPHEW_REWARD'] == \
6064
default_config['BLOCK_REWARD'] // 32

0 commit comments

Comments
 (0)