state server upgrade sync refactoring

Various clean ups for the recent state server upgrade synchronisation work.
Hmm... the main point of the method is the type assertion...