Religion / Islamic Shariah Law is not based on logic and opinion

What is the reference for this narration of Sayyiduna ‘Ali (radiyallahu ‘anhu)?

“If the religion were based on opinion, it would be more important to wipe [masah] the under part of the leather sock than the upper”

Answer

Imam Abu Dawud (rahimahullah) has recorded this narration. Hafiz Ibn Hajar (rahimahullah) has declared the chain authentic (sahih). The full narration is as follows:

Sayyiduna ‘Ali (radiyallahu ‘anhu) said:

“If the religion were based on opinion, it would be more important to wipe [make masah on] the under part of the leather sock rather than the upper, however, I have seen Rasulullah (sallallahu ‘alayhi wa sallam) wipe the upper part.”