@@ -96,23 +96,33 @@ func TestVerifyExecutionResultHash(t *testing.T) {
9696
9797func VerifyExecutionResultsForSpork (t * testing.T , ctx context.Context , spork * config.Spork , startHeight uint64 , endHeight uint64 ) {
9898 client := spork .AccessNodes .Client ()
99- sealedResults := make (map [string ]string )
99+ sealedResults := make (map [flow.Identifier ]flow.Identifier )
100+ computedResults := make (map [flow.Identifier ]flow.Identifier )
100101 for blockHeight := startHeight ; blockHeight < endHeight ; blockHeight ++ {
101102 block , err := client .BlockByHeight (ctx , blockHeight )
102103 require .NoError (t , err )
103104 execResult , err := client .ExecutionResultForBlockID (ctx , block .Id )
104105 require .NoError (t , err )
106+ // Store the Result ID for any seals of previous blocks
105107 for _ , seal := range block .BlockSeals {
106- sealedResults [string (seal .BlockId )] = string (seal .ResultId )
108+ sealedResults [flow . Identifier (seal .BlockId )] = flow . Identifier (seal .ResultId )
107109 }
110+ // Compute the result ID for the current block
108111 exec , ok := convertExecutionResult (spork .Version , block .Id , blockHeight , execResult )
109112 require .True (t , ok , "unable to convert execution result" )
110113 resultID := deriveExecutionResult (spork , exec )
111- sealedResult , foundOk := sealedResults [string (block .Id )]
112- if foundOk {
113- require .Equal (t , string (resultID [:]), sealedResult , "target error" )
114+ computedResults [flow .Identifier (block .Id )] = resultID
115+ }
116+ checkedResults := 0
117+ for blockID := range computedResults {
118+ if sealedResult , ok := sealedResults [blockID ]; ok {
119+ // we found a seal for the block with the canonical ResultID
120+ require .Equal (t , sealedResult .String (), computedResults [blockID ].String (), "mismatched result ID" )
121+ checkedResults ++
114122 }
115123 }
124+ require .NotZero (t , checkedResults )
125+ t .Logf ("checked results: %d" , checkedResults )
116126}
117127
118128func TestDeriveEventsHash (t * testing.T ) {
0 commit comments