Function Selector
A function selector is the first four bytes of the Keccak-256 hash of a function signature, used by the Ethereum Virtual Machine to identify which function to execute within a contract. In the Diamond Standard, the proxy contract maintains a mapping of these four-byte selectors to the specific facet address that contains the implementation.
When a user interacts with the Diamond, the proxy checks the selector to route the call to the correct facet. This mechanism is the backbone of the Diamond architecture, enabling dynamic routing and the ability to update or replace functionality without changing the contract address.
It is a fundamental concept in how smart contracts interact and execute code.