The Langlands-Kottwitz method and deformation spaces of $p$-divisible   groups
  We extend the results of Kottwitz on points of Shimura varieties over finite fields to cases of bad reduction. The "test function" whose twisted orbital integrals appear in the final expression is defined geometrically using deformation spaces of p-divisible groups. 
Peter Scholze
math.AG math.NT