I recently read this paper on designing secure smart contracts, and it gives the following modifier to ensure that when an EOA (or contract address) interacts with your original contract that the values of the variables stored in the contract are predictable and do not change before their transaction is mined.
uint private transitionCounter = 0;
modifier transitionCounting(uint nextTransitionNumber) {
require(nextTransitionNumber == transitionCounter);
transitionCounter += 1;
_;}
Is there a way to write a test in JavaScript or Solidity for Truffle that would test the modifier above? Overall, you would need to simulate two transactions mined varying speeds, but is that possible with these tests? Or else how would you properly test this?