There is a law irrevocably decreed in Heaven
By Porter
There is a law, irrevocably decreed in heaven before the foundations of this world

20 There is a law, irrevocably decreed in bheaven before the foundations of this world, upon which all blessings are predicated— 21 And when we obtain any blessing from God, it is by obedience to that law upon which it is predicated. D&C 130
When this verse was revealed, Joseph Smith was asking Jesus Christ questions. A very intruiging verse to say the least. It means the blessings we receive in life are contingent upon our obedience to God’s laws. It means when we receive any blessing from God, it is because we were obedient to the law that blessing was predicated upon.
There are lots of real world examples it is difficult to see how this verse applies. In fact, we will not know exactly who obey and in the next will recieve all the blessings available.
But in this earth life, to anyone who thinks for a second it is pretty clear life does not play out as this verse describes. Afflictions happen to righteous people, blessings are bestowed upon unrighteous people. As the story of Job illustrates, men cannot always understand why God does things to people. A big part of this is because our finite minds cannot comprehend the eternal laws of heaven. Another part is that it many of the details of God’s mercy and justice have not been revealed. The veil convers our memory on purpose so we are tested if we will trust God without having a perfect understanding of His purposes.
In the book of Job we learn of God’s response to Job’s accusations of God’s unjustice. God basically responds that Job cannot comprehend the laws of justice and mercy in such a complex universe and therefore can’t conclude that God is unjust.
7 And, if you keep my commandments and endure to the end you shall have eternal life, which gift is the greatest of all the gifts of God. D&C 14:7