As I understand it, Solana will elect a leader each round and there will be multiple validators handling the transactions independently. The leader will then consolidate all the transactions.
From this understanding, I'm curious how Solana actually handles programs which increment a field. So lets say we have this counter field, which increases by 1 each time the program is called. What happens if 10 different users calls this program at the same time, how will this work if the 10 transactions are handled by the ten validators independently. For example at the start of the round, counter=50
and during the round, ten different validators handles the transactions separately so each validator will increase the counter=51
. When the leader gets back all the txns, it will say counter=51
, what happens in this scenario?
I feel like there is something missing in my assumptions.