1 Answer
1

When tx1 and tx2 are broadcast to the network they will be picked up by miners and included in blocks.

If both tx1 and tx2 originate from the same "owned" account, then they will be included in the blockchain in order (due to the transaction nonce).

If you wait until tx1 has been mined before sending tx2, then they will again be included in order.

Otherwise, there is no guarantee of the order in which the miner or miners will see, or choose to insert, tx1 and tx2 into the blockchain. In this case you could end up with either (32 + 40) * 50 as the result, or 32 * 50 + 40, unless you have some other ordering check within your contract.

Do the nodes who verify tx2, have to re-run tx1 as well to calculate state before tx2 (i.e. data +=40) again?

The role of the nodes is to validate the transactions in the order they appear in the blockchain and confirm that they get the same result. I.e. (full) nodes run every transaction in the same order as the miners included them. But they only run each transaction once.

thanks for the answer. Well, it answers my question partially. I should have clarified in my question: assume Tx2 has issued long after when Tx1 is issued and Tx1 is already in the blockchain. The question is that how the nodes validating Tx2 know that the contract state has changed to data+=40, without redoing Tx1?
– user153465Aug 11 '17 at 15:31

Sure, all nodes know the current state of the blockchain, including its storage - that's why they are always syncing. Every time a block is mined the nodes update their state accordingly. No transaction from a past block needs to be re-executed as new txs are added.
– benjaminionAug 11 '17 at 16:56