The below is proof that Torah was already put into place in the very beginning. How else could Kayin (Cain) have known what constitutes sin? In Genesis 4:3 we see that Kayin knew he hadn't provided the "right kind" of sacrifice (as only blood covers sin); and he KNEW he was committing sin when he killed his brother because, when YHWH confronted him, he feigned ignorance and arrogance (Genesis 4:9). And when YHWH told Kayin he would be banned from His Presence in verse 4:14, we find that Kayin's immediate fear was that "whoever finds me will kill me" - because, without YHWH's covering, the world is an evil and dangerous place.
The ONLY way Kayin could have known all these things was because YHWH had already laid down His Divine Instructions in Righteousness...
Genesis 4:6 ADONAI said to Kayin, "Why are you angry? Why so downcast? 7 If you are doing what is good, shouldn't you hold your head high? And if you don't do what is good, sin is crouching at the door - it wants you, but you can rule over it." (CJB)
How could Kayin rule over sin? Through obedience to Torah!
Genesis 4:18 Kayin had words with Hevel his brother; then one time, when they were in the field, Kayin turned on Hevel his brother and killed him. 9 ADONAI said to Kayin, "Where is Hevel your brother?"And he replied, "I don't know; am I my brother's guardian?" (CJB)
He LIED to YHWH, knowing full well that YHWH knew that he had killed Hevel. Confronted by the reality of the situation, Kayin then began to fear for his own life/ Why? Because he KNEW that he was doomed to spend the rest of his life without the covering of YHWH....
Genesis 4:10 He said, "What have you done? The voice of your brother's blood is crying out to me from the ground! 3 Kayin said to ADONAI, "My punishment is greater than I can bear. 14 You are banning me today from the land and from your presence. I will be a fugitive wandering the earth, and whoever finds me will kill me." (CJB)