Skip to content

Commit 995e10c

Browse files
authored
Merge pull request #1979 from carver/uncle-timestamp-check
Fix uncle timestamp check against its parent
2 parents 8556d4a + e1ede2e commit 995e10c

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

eth/vm/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,10 +634,10 @@ def validate_uncle(cls,
634634
f"Uncle number ({uncle.block_number}) is not one above "
635635
f"ancestor's number ({uncle_parent.block_number})"
636636
)
637-
if uncle.timestamp < uncle_parent.timestamp:
637+
if uncle.timestamp <= uncle_parent.timestamp:
638638
raise ValidationError(
639-
f"Uncle timestamp ({uncle.timestamp}) is before "
640-
f"ancestor's timestamp ({uncle_parent.timestamp})"
639+
f"Uncle timestamp ({uncle.timestamp}) is not newer than its "
640+
f"parent's timestamp ({uncle_parent.timestamp})"
641641
)
642642
if uncle.gas_used > uncle.gas_limit:
643643
raise ValidationError(

newsfragments/1979.bugfix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Uncles with the same timestamp as their parents are invalid. Reject them, and add the test from
2+
ethereum/tests.

tests/json-fixtures/test_blockchain.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,6 @@
196196
# but only in Istanbul, not in Constantinople.
197197
('GeneralStateTests/stSStoreTest/InitCollision.json', 'InitCollision_d2g0v0_Istanbul'),
198198
('GeneralStateTests/stSStoreTest/InitCollision.json', 'InitCollision_d3g0v0_Istanbul'),
199-
# It's not clear how or why this test changed. It doesn't make sense that it only tests Istanbul
200-
# either. See: https://github.com/ethereum/tests/issues/787
201-
# The test seems to claim to test what happens if the uncle timestamp is the same as
202-
# the block, but the RLP doesn't encode a matching timestamp.
203-
('InvalidBlocks/bcUncleHeaderValidity/incorrectUncleTimestamp.json', 'incorrectUncleTimestamp_Istanbul'), # noqa: E501
204-
('InvalidBlocks/bcUncleHeaderValidity/incorrectUncleTimestamp.json', 'incorrectUncleTimestamp_Berlin'), # noqa: E501
205199
}
206200

207201

0 commit comments

Comments
 (0)