As to the potential for war, because the society of the Republic is closed, there would be no dependency on the outside world. He's concerned about those city-states governed differently and that have a proclivity for war.
"FROM EACH ACCORDING TO HIS ABILITY, TO EACH ACCORDING TO HIS NEED ..."
I was trying to make the link to that "function" in the Marx sense which is directly tied to economic need, whereas for Plato what matters above all is for people to be groomed for their class accordingly.
