BaseRelayRecipient vs. ERC2771Context vs. ContextMixin

All of these provide a function e.g. _msgSender() to replace msg.sender:

https://github .com/opengsn/forwarder/blob/master/contracts/BaseRelayRecipient.sol

https://github .com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol

(continued in next post since I can’t post more than 2 links)

ERC2771Context is mentioned in opengsn troubleshooting FAQ.

ContextMixin: https://github .com/maticnetwork/pos-portal/blob/master/contracts/common/ContextMixin.sol

ContextMixin is mentioned by OpenSea for Polygon meta-transactions support. It doesn’t offer a replacement for msg.data.

Do they all do exactly the same thing in replacing msg.sender?
Can either BaseRelayRecipient or ERC2771Context replace the other two?

ERC2771Context is equivalent to BaseRelayRecipient. Use whichever is easier for you.
The difference is if/when you can change the trusted-forwarder address: I think in ERC2771Context it is immutable