Ex post facto laws are forbidden by the US Constitution, both at federal and state levels. [1]
At least, at this time, with current interpretation- "the Supreme Court has explained that people must have notice of the possible criminal penalties for their actions at the time they act" [2] (See also Weaver v Graham[3])
This might be subject to change.
[1]https://constitution.congress.gov/browse/essay/artI-S9-C3-3-...
[2]https://constitution.congress.gov/browse/essay/artI-S9-C3-3-...
[3]http://cdn.loc.gov/service/ll/usrep/usrep450/usrep450024/usr...