Skip to content

Commit 41b4048

Browse files
unnawuttcoratger
andauthored
chore: use more direct source-target comparison (leanEthereum#178)
* chore: use more direct source-target comparison * Update src/lean_spec/subspecs/forkchoice/store.py Co-authored-by: Thomas Coratger <60488569+tcoratger@users.noreply.github.com> --------- Co-authored-by: Thomas Coratger <60488569+tcoratger@users.noreply.github.com>
1 parent c1aa2bc commit 41b4048

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

  • src/lean_spec/subspecs/forkchoice

src/lean_spec/subspecs/forkchoice/store.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,14 @@ def validate_attestation(self, signed_attestation: SignedAttestation) -> None:
163163

164164
# Topology Check
165165
#
166-
# History is linear and monotonic. Source must be an ancestor of Target.
167-
source_block = self.blocks[data.source.root]
168-
target_block = self.blocks[data.target.root]
169-
170-
assert source_block.slot <= target_block.slot, "Source slot must not exceed target"
166+
# History is linear and monotonic. Source must be older than Target.
167+
assert data.source.slot <= data.target.slot, "Source checkpoint slot must not exceed target"
171168

172169
# Consistency Check
173170
#
174171
# Validate checkpoint slots match block slots
172+
source_block = self.blocks[data.source.root]
173+
target_block = self.blocks[data.target.root]
175174
assert source_block.slot == data.source.slot, "Source checkpoint slot mismatch"
176175
assert target_block.slot == data.target.slot, "Target checkpoint slot mismatch"
177176

0 commit comments

Comments
 (0)