If I have a StorageValue which is for example a rust BTree, and my custom pallets interacts with that BTree which should an invariant - let's say it's a BTree of integers, and n can be added to that BTree if and only if n-1 and n+1 are not present in that BTree.
How does it deal with synchronization issues between nodes? For example, let's say I am the one who created the block, and I tried inserting the number 8 to it. Then, another node tries inserting the number 9 to it. I assume that since I am the one who created the block, 8 was added and 9 was not. But how does the other node verify that I altered the storage item according to protocol and that it still holds the invariant we assume that BTree should always hold? What if my node is a malicious node and added 8 and 9 together? How is it checked?