In Craft 2, we could set a cookie like this...
craft()->userSession->saveCookie()
... and that would make it a state cookie. This thread describes it pretty well. Essentially, you would end up with a cookie whose name began with a hashed string.
b72b7553c36d6600e9aeb6c40513deb8MyCookie
However, it seems like that behavior has been largely removed in Craft 3. When I try to save a cookie now, I do it more like this...
$cookie = new Cookie();
$cookie->name = $cookieName;
$cookie->value = $cookieValue;
$cookie->expire = time() + $lifespan;
Craft::$app->getResponse()->getCookies()->add($cookie);
... which doesn't create a state cookie. The cookie name is very simple.
MyCookie
Generally speaking, that doesn't bother me. But I worry about compatibility issues with the Craft 2 version of my plugin. It's somewhat important that cookies from the old system are recognized when Craft is upgraded.
What is the solution for this? How do I ensure that my old cookies are recognized properly, and/or continue saving this data using the original hashed format?