pub fn set_state(&mut self, state: Box<dyn AnyFreeze>) -> Result<(), ClientError> {
        if let PssState::Never = self.state {
            Err(ClientInvariantError::IllegalStateRegistration.into())
        } else {
            self.state = PssState::Some(state);
            Ok(())
        }
    }
Adds state to this entry. This will return an error if this entry has
previously been marked as having no state.

If we're setting state for HSR, this function's should be interpreted
with caution: if the user has added state to a template/capsule that
previously didn't have state, then nothing in the code will try to
set it to never having had state (and there will be nothing in the
frozen state for it), which is fine; but, if they *removed* state
from an entity that previously had it, this will return an error to the
HSR thaw attempt (which will try to add the old state back). In that
case, the error should be discarded by the caller, who should accept
the changed data model.
packages/perseus/src/state/state_store.rs