Bible Answer

Were the people in Noah’s day aware of their sin?

How could the people at the time of Noah know they were living in sin without a proper declaration of the law and righteousness?

Your question assumes that God owes mankind a "declaration of righteousness" or some other explanation of the standards of God and the consequences of sin, but the Bible makes no such promise. On the contrary, the Bible says God owes mankind nothing except judgment:

Paul explains:

Rom. 1:18 For the wrath of God is revealed from heaven against all ungodliness and unrighteousness of men who suppress the truth in unrighteousness,
Rom. 1:19 because that which is known about God is evident within them; for God made it evident to them.
Rom. 1:20 For since the creation of the world His invisible attributes, His eternal power and divine nature, have been clearly seen, being understood through what has been made, so that they are without excuse.
Rom. 1:21 For even though they knew God, they did not honor Him as God or give thanks, but they became futile in their speculations, and their foolish heart was darkened.
Rom. 1:22 Professing to be wise, they became fools,
Rom. 1:23 and exchanged the glory of the incorruptible God for an image in the form of corruptible man and of birds and four-footed animals and crawling creatures.
Rom. 1:24  Therefore God gave them over in the lusts of their hearts to impurity, so that their bodies would be dishonored among them.
Rom. 1:25 For they exchanged the truth of God for a lie, and worshiped and served the creature rather than the Creator, who is blessed forever. Amen.

In the beginning, mankind willingly traded a knowledge of God for the desires of the flesh, and in so doing they departed from Him and came under condemnation. The wrath of God is revealed against all unrighteousness, and only by His grace do some receive mercy instead. God owes no one His mercy, which is why His mercy is called “grace.” 

In the time of Noah, the world reached a peak of sinfulness:

Gen. 6:5 Then the LORD saw that the wickedness of man was great on the earth, and that every intent of the thoughts of his heart was only evil continually.
Gen. 6:6 The LORD was sorry that He had made man on the earth, and He was grieved in His heart.
Gen. 6:7 The LORD said, “I will blot out man whom I have created from the face of the land, from man to animals to creeping things and to birds of the sky; for I am sorry that I have made them.”
Gen. 6:8 But Noah found favor in the eyes of the LORD.

Therefore, the Lord was moved by the sin of mankind to destroy all life, yet in mercy the Lord gave favor (i.e., grace) to Noah and his family resulting in their salvation. Only Noah’s family received His mercy, and we have no reason to assume that God warned anyone else in humanity about the coming judgment nor did God give opportunity for the world to repent. In fact, Jesus says the world was completely unaware of the coming judgment:

Matt. 24:37 “For the coming of the Son of Man will be just like the days of Noah.
Matt. 24:38 “For as in those days before the flood they were eating and drinking, marrying and giving in marriage, until the day that Noah entered the ark,
Matt. 24:39 and they did not understand until the flood came and took them all away; so will the coming of the Son of Man be.

The people of Noah’s day had no idea a judgment was about to come, and Jesus says that in the last days the Lord will act in a similar way bringing judgment against an unholy world without warnings or explanations. Such is the sovereign prerogative of a holy and just God to save those He desires and condemn those He desires, as Paul says:

Rom. 9:15 For He says to Moses, “I WILL HAVE MERCY ON WHOM I HAVE MERCY, AND I WILL HAVE COMPASSION ON WHOM I HAVE COMPASSION.”
Rom. 9:16 So then it does not depend on the man who wills or the man who runs, but on God who has mercy.
Rom. 9:17 For the Scripture says to Pharaoh, “FOR THIS VERY PURPOSE I RAISED YOU UP, TO DEMONSTRATE MY POWER IN YOU, AND THAT MY NAME MIGHT BE PROCLAIMED THROUGHOUT THE WHOLE EARTH.”
Rom. 9:18 So then He has mercy on whom He desires, and He hardens whom He desires.

For more information on this difficult topic, please consult the following resource: Wrestling with God