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

Commit bd8e1d6

Browse files
committed
Added experimental new State implementation
1 parent 1d67f9e commit bd8e1d6

File tree

9 files changed

+431
-22
lines changed

9 files changed

+431
-22
lines changed

ethereum/genesis_helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ethereum.state import State
1+
from ethereum.new_state import State
22
from ethereum.block import Block, BlockHeader, FakeHeader, BLANK_UNCLES_HASH
33
from ethereum.utils import decode_hex, big_endian_to_int, encode_hex, \
44
parse_as_bin, parse_as_int, normalize_address
@@ -40,7 +40,7 @@ def state_from_genesis_declaration(genesis_data, env, block=None, allow_empties=
4040
state.set_nonce(addr, parse_as_int(data['nonce']))
4141
if 'storage' in data:
4242
for k, v in data['storage'].items():
43-
state.set_storage_data(addr, parse_as_bin(k), parse_as_bin(v))
43+
state.set_storage_data(addr, big_endian_to_int(parse_as_bin(k)), big_endian_to_int(parse_as_bin(v)))
4444
get_consensus_strategy(state.config).initialize(state, block)
4545
state.commit(allow_empties=allow_empties)
4646
block.header.state_root = state.trie.root_hash

ethereum/messages.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from ethereum.trie import Trie
1515
from ethereum.securetrie import SecureTrie
1616
from ethereum import opcodes
17-
from ethereum.state import State, get_block
1817
from ethereum.transactions import Transaction
1918
from ethereum.consensus_strategy import get_consensus_strategy
2019
from ethereum import vm
@@ -259,7 +258,7 @@ def apply_transaction(state, tx):
259258
r = mk_receipt(state, state.logs)
260259
_logs = list(state.logs)
261260
state.logs = []
262-
state.add_to_list('receipts', r)
261+
state.add_receipt(r)
263262
state.set_param('bloom', state.bloom | r.bloom)
264263
state.set_param('txindex', state.txindex + 1)
265264

@@ -286,7 +285,7 @@ def __init__(self, state, tx):
286285
self.set_storage_data = state.set_storage_data
287286
self.get_storage_data = state.get_storage_data
288287
self.log_storage = lambda x: state.account_to_dict(x)
289-
self.add_suicide = lambda x: state.add_to_list('suicides', x)
288+
self.add_suicide = lambda x: state.add_suicide(x)
290289
self.add_refund = lambda x: \
291290
state.set_param('refunds', state.refunds + x)
292291
self.block_hash = lambda x: state.get_block_hash(state.block_number - x - 1) \

ethereum/meta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from ethereum.consensus_strategy import get_consensus_strategy
88
from ethereum.messages import apply_transaction
99
from ethereum.state import State
10-
from ethereum.utils import sha3
10+
from ethereum.utils import sha3, encode_hex
1111
import rlp
1212

1313
# Applies the block-level state transition function

0 commit comments

Comments
 (0)