The contract and state relative to a chain fork are not related to the method used to reach consensus, e.g. PoS, PoW, something else.
In this context, "consensus" is concerned with establishing a canonical transaction order. Given a known set of transactions in a certain order, then each node can establish what the state must be. It's deterministic, so there's only one possible correct answer - any departure from that is malfunctioning node but the network itself is indifferent to that.
The contract potentially has different states on the two forked chains owning to differences in the transactions and order on those two forks.
Consider a simple contract deployed on block 10.
contract SimpleStorage {
uint public x;
function set(uint _x) public {
x = _x;
}
}
Great. X is initially 0. Anyone can set it to something else.
Suppose Alice and Bob send two transactions to setX()
to 50 and 100 respectively, and they do that more or less simultaneously.
Now the fork.
Suppose chain A mines both transactions, Alice first. x
was 50 for a moment (if anyone looked) and then 100 because Bob updated it again. That was observable to all nodes that saw the block, at block height 11.
Suppose another miner found a block 11, but in that version, Bob's transaction came first. In that version of history, the result is x == 50. That determination is supported by a version of history.
So, the question is which version of history is correct? The longest chain rule will sort that out and eventually, e.g. block 15, there will multiple confirmations of one or the other history. One is a world that could have been and one is the world we find ourselves in.
There is no known method of communication between the forks.
In summary, contract states are similar to account balances and the same thought process applies regarding confirmations. Whatever happens is always supported by a canonical description of history - everything that happened in the order it is deemed to have happened by consensus.
Hope it helps.