Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit f22482d

Browse files
committed
Distinguish chain branches by state root
1 parent 3471297 commit f22482d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/trinity/core/p2p-proto/bcc/test_requests.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ async def test_get_unknown_block_by_hash(request, event_loop):
101101
async def test_get_canonical_block_range_by_slot(request, event_loop):
102102
chain_db = get_fresh_chain_db()
103103
base_branch = create_branch(3, root=chain_db.get_canonical_block_by_slot(0))
104-
non_canonical_branch = create_branch(3, root=base_branch[-1])
105-
canonical_branch = create_branch(4, root=base_branch[-1])
104+
non_canonical_branch = create_branch(3, root=base_branch[-1], state_root=b"\x00" * 32)
105+
canonical_branch = create_branch(4, root=base_branch[-1], state_root=b"\x11" * 32)
106106
for branch in [base_branch, non_canonical_branch, canonical_branch]:
107107
chain_db.persist_block_chain(branch)
108108

@@ -121,8 +121,8 @@ async def test_get_canonical_block_range_by_slot(request, event_loop):
121121
async def test_get_canonical_block_range_by_hash(request, event_loop):
122122
chain_db = get_fresh_chain_db()
123123
base_branch = create_branch(3, root=chain_db.get_canonical_block_by_slot(0))
124-
non_canonical_branch = create_branch(3, root=base_branch[-1])
125-
canonical_branch = create_branch(4, root=base_branch[-1])
124+
non_canonical_branch = create_branch(3, root=base_branch[-1], state_root=b"\x00" * 32)
125+
canonical_branch = create_branch(4, root=base_branch[-1], state_root=b"\x11" * 32)
126126
for branch in [base_branch, non_canonical_branch, canonical_branch]:
127127
chain_db.persist_block_chain(branch)
128128

@@ -141,8 +141,8 @@ async def test_get_canonical_block_range_by_hash(request, event_loop):
141141
async def test_get_incomplete_canonical_block_range(request, event_loop):
142142
chain_db = get_fresh_chain_db()
143143
base_branch = create_branch(3, root=chain_db.get_canonical_block_by_slot(0))
144-
non_canonical_branch = create_branch(3, root=base_branch[-1])
145-
canonical_branch = create_branch(4, root=base_branch[-1])
144+
non_canonical_branch = create_branch(3, root=base_branch[-1], state_root=b"\x00" * 32)
145+
canonical_branch = create_branch(4, root=base_branch[-1], state_root=b"\x11" * 32)
146146
for branch in [base_branch, non_canonical_branch, canonical_branch]:
147147
chain_db.persist_block_chain(branch)
148148

@@ -161,8 +161,8 @@ async def test_get_incomplete_canonical_block_range(request, event_loop):
161161
async def test_get_non_canonical_branch(request, event_loop):
162162
chain_db = get_fresh_chain_db()
163163
base_branch = create_branch(3, root=chain_db.get_canonical_block_by_slot(0))
164-
non_canonical_branch = create_branch(3, root=base_branch[-1])
165-
canonical_branch = create_branch(4, root=base_branch[-1])
164+
non_canonical_branch = create_branch(3, root=base_branch[-1], state_root=b"\x00" * 32)
165+
canonical_branch = create_branch(4, root=base_branch[-1], state_root=b"\x11" * 32)
166166
for branch in [base_branch, non_canonical_branch, canonical_branch]:
167167
chain_db.persist_block_chain(branch)
168168

@@ -173,5 +173,5 @@ async def test_get_non_canonical_branch(request, event_loop):
173173

174174
assert isinstance(response.command, BeaconBlocks)
175175
assert len(response.payload) == 1
176-
assert [block.slot for block in response.payload] == [2]
176+
assert [block.slot for block in response.payload] == [5]
177177
assert response.payload == (non_canonical_branch[1],)

0 commit comments

Comments
 (0)