verify age of uncle's parent (#719)

why:
  parent must be older => check needed for bcFrontierToHomestead test
  cases UncleFromFrontierInHomestead and UnclePopulation
This commit is contained in:
Jordan Hrycaj 2021-06-18 08:37:59 +01:00 committed by GitHub
parent e7745a6456
commit cad1b5a678
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -19,7 +19,9 @@ template runTest*(suiteName: string, caseFolder: string, body: untyped) =
disableParamFiltering()
suite suiteName:
var status = initOrderedTable[string, OrderedTable[string, Status]]()
for fileName {.inject.} in walkDirRec(caseFolder):
for fileName {.inject.} in walkDirRec(
caseFolder, yieldFilter = {pcFile,pcLinkToFile}):
if not fileName.endsWith(".json"):
continue

View File

@ -249,6 +249,13 @@ proc validateUncles(chainDB: BaseChainDB; header: BlockHeader;
(uncle.parentHash == header.parentHash):
return err("Uncle's parent is not an ancestor")
# check uncle against own parent
var parent: BlockHeader
if not chainDB.getBlockHeader(uncle.parentHash,parent):
return err("Uncle's parent has gone missing")
if uncle.timestamp <= parent.timestamp:
return err("Uncle's parent must me older")
# Now perform VM level validation of the uncle
if checkSealOK:
result = hashCache.validateSeal(uncle)