God's laws started when Adam was told to stay away from the Tree of the Knowledge of Good and Evil. After that God would have also shown Adam and Eve, and Cain and Abel, as to which sacrifices were acceptable to Him and which were not. And that is why Abel offered what was acceptable. But then God gave Noah a number of laws (and also distinguished between clean and unclean creatures before the Flood). And no doubt Abraham was also shown God's laws. Then the Israelites were given specific laws before the Law of Moses, and while they in the wilderness. Finally the Law of Moses detailed everything and prevailed for 1500 years . But it was not designed to enable anyone to be saved. Salvation was always by grace through faith (Hebrews 11).
God’s law seems to predates Adam & Eve, it would have been necessary to define iniquity (I.e transgression of the law) before Satan tempted them:
[Gen 3:1-5 KJV] 1 Now the serpent was more subtil than any beast of the field which the LORD God had made. And he said unto the woman, Yea, hath God said, Ye shall not eat of every tree of the garden? 2 And the woman said unto the serpent, We may eat of the fruit of the trees of the garden: 3 But of the fruit of the tree which [is] in the midst of the garden, God hath said, Ye shall not eat of it, neither shall ye touch it, lest ye die. 4 And the serpent said unto the woman, Ye shall not surely die: 5 For God doth know that in the day ye eat thereof, then your eyes shall be opened, and ye shall be as gods, knowing good and evil.
[Eze 28:11-19 KJV] 11 Moreover the word of the LORD came unto me, saying, 12 Son of man, take up a lamentation upon the king of Tyrus, and say unto him, Thus saith the Lord GOD; Thou sealest up the sum, full of wisdom, and perfect in beauty. 13 Thou hast been in Eden the garden of God; every precious stone [was] thy covering, the sardius, topaz, and the diamond, the beryl, the onyx, and the jasper, the sapphire, the emerald, and the carbuncle, and gold: the workmanship of thy tabrets and of thy pipes was prepared in thee in the day that thou wast created. 14 Thou [art] the anointed cherub that covereth; and I have set thee [so]: thou wast upon the holy mountain of God; thou hast walked up and down in the midst of the stones of fire. 15 Thou [wast] perfect in thy ways from the day that thou wast created, till iniquity was found in thee. 16 By the multitude of thy merchandise they have filled the midst of thee with violence, and thou hast sinned: therefore I will cast thee as profane out of the mountain of God: and I will destroy thee, O covering cherub, from the midst of the stones of fire. 17 Thine heart was lifted up because of thy beauty, thou hast corrupted thy wisdom by reason of thy brightness: I will cast thee to the ground, I will lay thee before kings, that they may behold thee. 18 Thou hast defiled thy sanctuaries by the multitude of thine iniquities, by the iniquity of thy traffick; therefore will I bring forth a fire from the midst of thee, it shall devour thee, and I will bring thee to ashes upon the earth in the sight of all them that behold thee. 19 All they that know thee among the people shall be astonished at thee: thou shalt be a terror, and never [shalt] thou [be] any more.
[Eze 28:11-19 KJV] 11 Moreover the word of the LORD came unto me, saying, 12 Son of man, take up a lamentation upon the king of Tyrus, and say unto him, Thus saith the Lord GOD; Thou sealest up the sum, full of wisdom, and perfect in beauty. 13 Thou hast been in Eden the garden of God; every precious stone [was] thy covering, the sardius, topaz, and the diamond, the beryl, the onyx, and the jasper, the sapphire, the emerald, and the carbuncle, and gold: the workmanship of thy tabrets and of thy pipes was prepared in thee in the day that thou wast created. 14 Thou [art] the anointed cherub that covereth; and I have set thee [so]: thou wast upon the holy mountain of God; thou hast walked up and down in the midst of the stones of fire. 15 Thou [wast] perfect in thy ways from the day that thou wast created, till iniquity was found in thee. 16 By the multitude of thy merchandise they have filled the midst of thee with violence, and thou hast sinned: therefore I will cast thee as profane out of the mountain of God: and I will destroy thee, O covering cherub, from the midst of the stones of fire. 17 Thine heart was lifted up because of thy beauty, thou hast corrupted thy wisdom by reason of thy brightness: I will cast thee to the ground, I will lay thee before kings, that they may behold thee. 18 Thou hast defiled thy sanctuaries by the multitude of thine iniquities, by the iniquity of thy traffick; therefore will I bring forth a fire from the midst of thee, it shall devour thee, and I will bring thee to ashes upon the earth in the sight of all them that behold thee. 19 All they that know thee among the people shall be astonished at thee: thou shalt be a terror, and never [shalt] thou [be] any more.