Recorded righteousness rewards
ויאמר אלהם ראובן אל-תשפכו-דם תשליכו אתו אל-הבור הזה אשר במדבר ויד אל-תשלחו-בו למען הציל אתו מידם להשיבו אל-אביו
Reuven said to [his brothers]: “Don’t spill blood! Cast [Yosef] into this pit that’s in the wilderness, and don’t send a hand against him”, in order to save [Yosef] from their hands, to return him to his father
An interesting Midrash is taught about Reuven, Aharon, and Boaz. Reuven unsuccessfully tried to save Yosef from the hands of his brothers by suggesting they (temporarily) throw him into a pit. The Midrash says that if Reuven had known that his actions would be recorded in the Torah, he would have carried Yosef on his shoulders home to their father. Aharon, when he heard that his younger brother Moshe was chosen by G-d to lead the Jewish people, went out to greet Moshe. Had Aharon known his actions would be recorded in the Torah, he would have greeted Moshe with tambourines and dancing. Boaz gave Rus some toasted grain to eat. Had Boaz known his actions would be recorded in the Torah, he would have given her fatted calves.
This seems surprising. Why in fact didn’t these three giants perform their mitzvah with full vigor? Very nice they would have had they known more, but why didn’t they go the extra mile? Perhaps we can say that they were afraid they’d fall into the trap of the evil inclination, becoming haughty. Or they were afraid of impure thoughts, or the potential damage that could occur. Reuven was afraid that if he rescued Yosef with his full might his brothers may turn against him. Aharon was afraid that if he came with music and dancing to greet his younger brother that he might fall prey to haughtiness. Boaz was afraid that if he fed Rus fatted calves, he might become too close with her and start having inappropriate thoughts. Due to these concerns, all three of them held back their mitzvah from being its fullest.
There’s a fascinating gemarra that if we analyze properly, we’ll come to a novel conclusion. Our Sages tell us that there is no reward for mitzvos in this world. They bring an anecdote about someone who was commanded by his parents to send away the mother bird. Both of these are mitzvos, which promise long life. However, on his way down, the person died tragically. We see that the reward for long life is referring to life in the next world. The gemarra then questions this conclusion and suggests that perhaps he was thinking inappropriate thoughts as he completed his mitzvah, for which he was punished. The gemarra responds that if there was indeed reward for mitzvos in this world, the mitzvah he was doing would have even protected him from such sinful thoughts and subsequent damage. The outcome of this gemarra is that if we could imagine the possibility of reward for mitzvos in this world, then there would be supernatural protection against the evil inclination and damage. However, the three giants mentioned above knew there was no reward in this world, so they remained afraid of going over the top.
Why isn’t there reward for mitzvos in this world? The Rashba says that every mitzvah performed is testimony that Hashem exists and commanded us to keep His Torah. Since it is prohibited to receive payment to give testimony, it’s not possible to receive reward for our mitzvah observance (at least in this world). However, we find an exception to this prohibition. Witnesses who merely sign a document are permitted to receive payment. What’s the difference? Verbal testimony is obligatory, as the Torah commands us to testify when we witness something. Since we are obliged, we cannot accept payment. However, volunteering to give a document validity by signing it isn’t obligatory. As such, a person is entitled to receive payment.
According to all of this, we’ve unlocked a deeper understanding of the Midrash. The Midrash stresses that had Reuven, Aharon, and Boaz known that their actions would be recorded for posterity, they would have exerted themselves to fulfill their mitzvah. And yet, we already suggested that they were afraid to give it their all. Why would having their actions recorded alleviate those fears? Their actions being recorded is akin to given written testimony. If their mitzvos are looked at as written testimony, then it would be permissible for them to receive payment. In order words, their mitzvos were capable of receiving reward in this world. As we proved from the gemarra, such reward includes protection from the evil inclination and physical damage. Had they known all of this, they would have had nothing to fear. They would have given it their all.
 Based on Chedvas Yaakov Introduction s.v. במדרש אילו, by Rav Tzvi Aryeh Yehuda Meisels
 Genesis 37:22
 Vayikra Rabbah 34:8, brought in Yalkut Shimoni Vayeishev § 141 and Rus § 604; Rus Rabbah 5:6. There’s some slight differences between the versions. The teaching of Vayikra Rabbah is taught by Rabbi Yitzchak, and he starts off by saying למדתך תורה דרך ארץ, although I’m not sure where the Torah is teaching me what’s to follow. In Rus Rabbah it’s taught by Rabbi Yitzchak bar Maryon, and he simply says בא הכתוב ללמדך. Vayikra Rabbah starts off that we should always fulfill mitzvos with a happy heart, whereas Rus Rabbah says to fulfill mitzvos wholeheartedly. I’m not quite sure how either of those two ideas fit with what’s to follow
 Exodus 4:14
 This middle part is missing from Vayikra Rabbah, as pointed out by Eitz Yosef ad. loc., but it appears when brought in Yalkut Shimoni
 Rus 2:14
 This Midrash is brought by Teshuvos HaRashba 1:581. He uses it as support for people who make donations to shuls and the like having their name promoted, as it encourages others to donate similarly
 Kiddushin 39b; Chullin 142a
 Deuteronomy 5:16 and 22:7
 The gemarra concludes its question as specifically referring to thoughts of idol worship, of which we do say מחשבה רעה הקב”ה מצרפה למעשה
 This last part was added by the Chedvas Yaakov, as the gemarra only mentions saving him from thoughts
 Many sources, such as the Divrei Shaul to Numbers 25:11-12 (see https://parshaponders.com/pinchas-5780/), and others that came after him, quote this idea in the name of the Rashba. After searching through his works, I was unable to find such an explanation by the Rashba. What’s strange is the earliest source I found that quoted this idea in his name was only published in 1825 (Yam HaTalmud Hakdamah § 13, citing his father (who, interestingly, happens to be the Divrei Shaul’s grandfather)). No one earlier seems to quote it. We don’t seem to have it, or maybe it’s a mistaken attribution. Or, quite possibly, I simply missed it. However I did find a contemporary sefer called Levav Chochmah to Numbers 25:11 Ofen 2 fn. 44 who also says we don’t have such a Rashba, and also points out the earliest source is the Yam HaTalmud
 See Shulchan Aruch Choshen Mishpat 34:18
 Toras Gittin § 120, written by Rabbi Yaakov MiLisa, an ancestor of the Chedvas Yaakov
 Leviticus 5:1
 Toras Gittin loc. cit.