filecoin-project / eudico

lotus, but also other things
Other
19 stars 14 forks source link

Test coverage for atomic execution protocol #183

Closed adlrocha closed 2 years ago

adlrocha commented 2 years ago

The test coverage for HC's atomic execution needs to be improved. We currently only have a few unit tests for the offline execution, and the unit tests for the SCA. This issue will be fixed when:

adlrocha commented 2 years ago

Idea to deterministically iterate over a map and overcome the flakiness on expected messages (caveat, it uses generics and requires go >1.18:

func iterateSorted[K constraints.Ordered, V any](m map[K]V, f func(key K, value V) (cont bool)) {
  keys := make([]K, 0, len(m))
  for k := range m {
   keys = append(keys, k)
  }
sort.Slice(keys, func(i, j int) bool {
  return keys[i] < keys[j]
})

for _, k := range keys {
  if !f(k, m[k]) {
   break
  }
}
}