From Madison's Memorial and Remonstrance, and his contribution in the Federalist, he was, at this time, no doubt a Calvinist, adhereing to total depravity. His three main teachers in his education were all Calvinist Clergyman. Does not sin corrupt the whole lump, or only parts of the lump? Yes, man can be good; that is not the issue, rather, man is prone to sin, and requires many checks that Calvinism supplies:
"The first is an arrogant pretension falsified by the contradictory opinions of Rulers in all ages, and throughout the world: the second an unhallowed perversion of the means of salvation...Because the establishment proposed by the Bill is not requisite for the support of the Christian Religion. To say that it is, is a contradiction to the Christian Religion itself, for every page of it disavows a dependence on the powers of this world: it is a contradiction to fact; for it is known that this Religion both existed and flourished, not only without the support of human laws, but in spite of every opposition from them, and not only during the period of miraculous aid, but long after it had been left to its own evidence and the ordinary care of Providence. Nay, it is a contradiction in terms; for a Religion not invented by human policy, must have pre-existed and been supported, before it was established by human policy. It is moreover to weaken in those who profess this Religion a pious confidence in its innate excellence and the patronage of its Author; and to foster in those who still reject it, a suspicion that its friends are too conscious of its fallacies to trust it to its own merits...Because the policy of the Bill is adverse to the diffusion of the light of Christianity. The first wish of those who enjoy this precious gift ought to be that it may be imparted to the whole race of mankind. Compare the number of those who have as yet received it with the number still remaining under the dominion of false Religions; and how small is the former! Does the policy of the Bill tend to lessen the disproportion? No; it at once discourages those who are strangers to the light of revelation from coming into the Region of it; and countenances by example the nations who continue in darkness, in shutting out those who might convey it to them." [bold face mine]
-James Madison, Memorial and Remonstrance, 1785.
Madison believed salvation was by grace through faith; a gift, that cannot be earned, not that salvation was by character, as Unitarians, Thomas Jefferson, John Adams, and Benjamin Franklin believed.
"The genius of republican liberty seems to demand on one side, not only that all power should be derived from the people, but that those intrusted with it should be kept in independence on the people, by a short duration of their appointments; and that even during this short period the trust should be placed not in a few, but a number of hands...The history of almost all the great councils and consultations held among mankind for reconciling their discordant opinions, assuaging their mutual jealousies, and adjusting their respective interests, is a history of factions, contentions, and disappointments, and may be classed among the most dark and degraded pictures which display the infirmities and depravities of the human character."
-Madison, Federalist #37.
Madison understood what depravity was, and how man acquired it.