I was thinking about a scenario where one contract depends on another contract's state.
For example, contract a
may want to decide on its next state update based on the current state of contract b
by calling contract b
's read function.
But what happens if:
- Alice triggers this function on
contract a
. - At the same time (In the same block) Bob triggers a function that updates the state on
contract b
. - When this function from
contract a
tries to get the state fromcontract b
, it could be that the state has already changed forcontract b
because of Bob's transaction from step 2 has already executed BEFORE Alice's transaction, or it could be Bob's transaction hasn't executed yet.
So it looks like there can be two different scenarios depending on the order in which Alice's function and Bob's function gets executed within the same block. Am I missing something?
How do people deal with this situation?