The courts have made a joke of the ban on ex post facto laws. They claim that possession of something that has been made contraband is not an ex post facto law, because your “possession” of it after the law passed is a new act. They are not punishing you because you possessed the item in the past, they are punishing you because you possess it now.
I guess that you are supposed to throw it out or turn it in to police or some such activity before you are caught.
Consider that. You did nothing. The requirement to rid yourself of something you legally possessed is not considered punishment. Insanity.