Overview
TheRelayerRegistry is a registry contract that manages a whitelist of authorized relayer addresses. Relayers are trusted entities that can submit transactions on behalf of users, typically for gasless transaction experiences or automated fulfillment processes.
Contract Location: contracts/registries/RelayerRegistry.sol
Purpose
The RelayerRegistry serves several key functions:- Relayer Whitelisting: Maintain a list of trusted relayer addresses
- Access Control: Prevent unauthorized relayers from submitting transactions
- Gasless Transactions: Enable trusted relayers to submit meta-transactions for users
- Automated Fulfillment: Allow approved relayers to automatically fulfill intents
State Variables
isWhitelistedRelayer: Maps relayer addresses to their whitelist statusrelayers: Array of all whitelisted relayer addresses
Core Functions
Adding Relayers
_relayer: Address of the relayer to whitelist
- Relayer address cannot be zero address
- Relayer must not already be whitelisted
- Only callable by owner
RelayerAdded(address indexed relayer)
Reference: contracts/registries/RelayerRegistry.sol:32
Removing Relayers
_relayer: Address of the relayer to remove
- Relayer must be currently whitelisted
- Only callable by owner
RelayerRemoved(address indexed relayer)
Reference: contracts/registries/RelayerRegistry.sol:47
View Functions
Get All Relayers
contracts/registries/RelayerRegistry.sol:60
Check Relayer Status
TheisWhitelistedRelayer mapping is public, allowing anyone to check if an address is a whitelisted relayer:
Integration with Core Contracts
Orchestrator
The Orchestrator contracts (Orchestrator.sol and OrchestratorV2.sol) use the RelayerRegistry to validate relayer submissions:
contracts/Orchestrator.sol:85
Configuration Updates
Orchestrator contracts can update their relayer registry reference:contracts/Orchestrator.sol:339
Use Cases
Gasless Transactions
Relayers enable users to interact with the protocol without holding native gas tokens:- User signs an intent off-chain
- Whitelisted relayer submits the transaction on-chain
- Relayer pays gas fees
- Relayer potentially earns fees from the intent
Automated Intent Fulfillment
Relayers can automatically fulfill intents when off-chain payment is detected:- Relayer monitors off-chain payment systems
- When payment is confirmed, relayer submits proof on-chain
- Intent is fulfilled without user needing to submit second transaction
Meta-Transaction Support
Relayers can implement meta-transaction patterns:- User signs message with intent to perform action
- Relayer wraps user’s signature in actual transaction
- Contract validates user signature and relayer authorization
- Action executes as if user submitted directly
Access Control
Owner-Only Functions
All state-modifying functions require owner privileges:addRelayer(): Add relayer to whitelistremoveRelayer(): Remove relayer from whitelist
Ownable with onlyOwner modifier
View Functions
All query functions are publicly accessible:getWhitelistedRelayers()isWhitelistedRelayer[address](public mapping)
Events
- Monitoring relayer whitelist changes
- Off-chain tracking of authorized relayers
- Audit trails for relayer management
Usage Patterns
Adding a Relayer
Removing a Relayer
Validation in Orchestrator
Relayer Security
Trust Assumptions
Whitelisted relayers are trusted to:- Submit Valid Transactions: Only submit legitimate user requests
- Protect User Data: Handle user signatures and data securely
- Fair Fees: Charge reasonable fees for relaying services
- Availability: Maintain uptime for critical operations
Security Considerations
- Centralized Trust: Relayers are centrally approved by owner
- Revocability: Malicious relayers can be removed from whitelist
- User Consent: Users must explicitly sign transactions for relayers
- Limited Scope: Relayers can only execute user-signed actions
Relayer Compromise Response
If a relayer is compromised:- Owner immediately removes relayer from whitelist
- Relayer can no longer submit new transactions
- Existing intents are not affected
- Monitor for any malicious activity from the compromised relayer
Relayer Requirements
Before whitelisting a relayer:- Identity Verification: Know who operates the relayer
- Security Audit: Review relayer infrastructure security
- Reputation: Check relayer’s history and reputation
- SLA Commitment: Ensure relayer commits to availability
- Fee Transparency: Relayer must be transparent about fees
Deployment Strategy
- Initial Deployment: Deploy registry with no relayers
- Add Trusted Relayers: Whitelist vetted relayer addresses
- Configure Orchestrator: Set registry address in Orchestrator
- Monitor Activity: Track relayer submissions via events
- Iterate: Add/remove relayers as needed
Related Contracts
- Orchestrator - Uses registry to validate relayer submissions
- OrchestratorV2 - Enhanced orchestrator with relayer support
- PaymentVerifierRegistry - Related registry for payment verifiers