Skip to content

Commit 0c70094

Browse files
authored
fix(filler): fix shared-pre-state generation (#1738)
1 parent 971214c commit 0c70094

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/ethereum_test_fixtures/shared_alloc.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ class SharedPreStateGroup(CamelModel):
3030
fork: Fork = Field(..., alias="network")
3131
pre: Alloc
3232

33-
def __model_post_init__(self) -> None:
33+
def model_post_init(self, __context):
3434
"""Post-init hook to ensure pre is not None."""
35+
super().model_post_init(__context)
36+
3537
self.pre = Alloc.merge(
3638
Alloc.model_validate(self.fork.pre_allocation_blockchain()),
3739
self.pre,
@@ -56,12 +58,9 @@ def to_file(self, file: Path) -> None:
5658
f.read()
5759
)
5860
for account in previous_shared_pre_state_group.pre:
59-
if account in self.pre:
60-
raise ValueError(
61-
f"Account {account} already exists in shared pre-allocation"
62-
)
63-
self.pre[account] = previous_shared_pre_state_group.pre[account]
64-
self.pre_account_count += 1
61+
if account not in self.pre:
62+
self.pre[account] = previous_shared_pre_state_group.pre[account]
63+
self.pre_account_count += previous_shared_pre_state_group.pre_account_count
6564
self.test_count += previous_shared_pre_state_group.test_count
6665
self.test_ids.extend(previous_shared_pre_state_group.test_ids)
6766

0 commit comments

Comments
 (0)