Remember how the LORD your God led you all the way in the wilderness these forty years, to humble and test you in order to know what was in your heart.
“I will make justice the measuring line and righteousness the plumb line.” -Isaiah 28:17
Righteousness is the plumbline of God, it is his measuring tool...
Cain had a nonchalant attitude towards his worship and service of God. He never wanted to do his best for God, he wanted to be allowed to put in whatever is good to him. Hence, his sacrifice and worship were rejected.