black powder gets the blame for pitting

but you will see pitting in fluid steel barrels made long after smokeless was the norm

as 2-piper says
much of the pitting you see was the result of corrosive primers - used in some loads until shortly after WWII