Is there any kind of locking protocol in ethereum, like can two transaction update the state variable same time ?, If yes then how would you avoid that ?
Smart Contract XYZ is deployed and two people want to update an variable in the XYZ, so they push transaction into the transaction pool. Now what if both transaction is executed at the same time. lets say if Transaction one wants to add 5 to the variable and transaction 2 wants to add 10 to the variable, in happy path the value in the xyz state variable must be 15(Trx 1 + trx 2), but what if both read the value same time and one of them add a block then either 5(Trx 1) is added or 10(Trx 2) is added.