Suppose a new law was passed in a US state banning jaywalking, which was not previously illegal in this state. (That's just a random example; the particular offense is not relevant.)
It is common for laws to increase penalties for repeated violations. For example, this jaywalking law might specify a $50 fine for a first offense, $100 for a second, $150 for a third, and $300 for a fourth or greater violation.
Suppose, however, that it also specifies that if the government can prove that the person did what is now illegal jaywalking before the law was passed, each incident that can be proved counts as a past violation for the purposes of the law. For example, if someone is caught jaywalking for the first time under this law, but the government can also prove that they jaywalked legally twice before the law took effect, this is considered a third offense and leads to a $150 fine.
Is this an unconstitutional ex post facto law?