It’s commonly taught that God only had one law in the Garden of Eden: Thou shalt not eat of the Tree of the Knowledge of Good and evil. (Ge 2:17) The claim is that God started with just one rule to see what we’d do with it, and then added more laws as we continued breaking the ones we already had.
When Cain became angry over God accepting only Abel’s sacrifice and not his own (Ge 4:4-5), God warned Cain that sin was lying in wait if he didn’t choose wisely. (7a)
When Cain murdered Abel it was sin, and God treated Cain as if he knew better, even though there was no official law against it. Clearly, there were unstated rules related to murder and loving others that were common knowledge, long before such laws were formalized at Sinai.
And long before God formally gave us any more laws, men became exceedingly evil and wicked (Ge 6:5); they were grievously violating universally understood moral law (Ro 2:15) and were judged accordingly in the Great Flood. (Ge 6:7)
And Abraham kept God’s commandments, statutes and laws long before they were officially stated at Sinai (Ge 26:5); God’s expectations were clear, even though they were not formally written down.
So, death reigned from Adam to Moses even though no one ever broke the same law Adam and Eve did (Ro 5:14); this proves God’s commandments were revealed and known long before He had them written down in Torah: sin was imputed, and men were held accountable for their sin, but this can’t happen unless God’s Law is known and understood. (13)
Torah was given at Sinai, but it wasn’t new when God revealed it; it was in play from the very beginning. (Ps 119:160) The precepts of Torah are timeless, applicable in every age — yesterday, today, and forever. (Ps 119:152)