fisherBridgeReceive
Function Type: external
Function Signature: fisherBridgeReceive(address,address,address,uint256,uint256,bytes)
Access Control: onlyFisherExecutor
Returns: void
Processes incoming cross-chain withdrawal requests mediated by authorized fisher executors. This function validates cryptographic signatures from users and manages nonce tracking for the fisher bridge system on the external chain.
Parameters
Parameter | Type | Description |
---|---|---|
from | address | Original sender on the host chain (user requesting withdrawal) |
addressToReceive | address | Recipient address on the external chain |
tokenAddress | address | Token contract address or address(0) for native coin |
priorityFee | uint256 | Fee amount paid to the fisher executor |
amount | uint256 | Amount to transfer to the recipient |
signature | bytes | Cryptographic signature (EIP-191) from the from address authorizing this transaction. |
Access Control
modifier onlyFisherExecutor() {
if (msg.sender != fisherExecutor.current) {
revert();
}
_;
}
Only addresses with the current fisherExecutor
role can call this function.
Workflow
1. Signature Verification
if (!SignatureUtils.verifyMessageSignedForFisherBridge(
from,
addressToReceive,
nextFisherExecutionNonce[from],
tokenAddress,
priorityFee,
amount,
signature
)) revert ErrorsLib.InvalidSignature();
Validates the signature using the Fisher Bridge signature format. For complete signature requirements and verification process, see the Fisher Bridge Signature Structure documentation.
2. Nonce Management
nextFisherExecutionNonce[from]++;
Increments the user's execution nonce to prevent signature replay attacks.
External Chain Processing
Unlike the host chain station, this function only validates signatures and manages nonces. The actual token transfers on the external chain must be handled by external processes that:
- Monitor Events: Listen for
FisherBridgeSend
events from the host chain station - Validate Signatures: Use this function to verify user authorization
- Execute Transfers: Perform the actual token transfers on the external chain
- Coordinate Fees: Handle priority fee distribution to fisher executors
Signature Message Format
For more information about the signature structure, refer to the Fisher Bridge Signature Structure.
Fisher Bridge Architecture
Cross-Chain Coordination
- Host Chain: User authorizes withdrawal via
fisherBridgeSend
- Event Emission: Host chain emits
FisherBridgeSend
event - External Chain: Fisher executor calls
fisherBridgeReceive
with same signature - Validation: External station validates signature and nonce
- Execution: Off-chain services execute the actual token transfer
Nonce Synchronization
Both host and external chain stations maintain synchronized nonce counters:
- Host Chain: Increments nonce in
fisherBridgeSend
- External Chain: Increments nonce in
fisherBridgeReceive
- Coordination: Both must use the same nonce value for signature validation
Security Features
Signature Security
- EIP-191 Compliance: Standard Ethereum signed message format
- Replay Protection: Nonce-based prevention of signature reuse
- User Authorization: Cryptographic proof of user consent
- Address Binding: Signature tied to specific sender address
Access Control
- Fisher Authorization: Only authorized executors can validate signatures
- Distributed Validation: Same signature validates on both chains
Nonce Management
- Sequential Increment: Nonces increase monotonically
- Per-User Tracking: Individual nonce counters for each user
- Cross-Chain Sync: Coordination between host and external chains
Integration with External Services
Since this function only validates signatures, external services must:
Monitor Host Chain Events
event FisherBridgeSend(
address indexed from,
address indexed addressToReceive,
address indexed tokenAddress,
uint256 priorityFee,
uint256 amount,
uint256 nonce
);
Execute Token Transfers
Based on validated parameters:
- Native Coins: Transfer
amount
of native currency toaddressToReceive
- ERC20 Tokens: Transfer
amount
oftokenAddress
tokens toaddressToReceive
- Priority Fees: Handle fee distribution to fisher executor
Error Handling
- Signature Validation: Use this function to verify user authorization (see signature format)
- Nonce Tracking: Ensure nonce synchronization with host chain
- Transfer Validation: Verify successful token transfers
Error Conditions
Error | Condition |
---|---|
InvalidSignature | Signature verification fails |
Access Control Revert | Called by unauthorized address (not current fisher executor) |
Usage Flow
- Host Chain: User calls
fisherBridgeSend
with signature - Event Monitoring: External services detect
FisherBridgeSend
event - Signature Validation: Fisher calls
fisherBridgeReceive
with same parameters - Nonce Increment: External station increments user's nonce
- Token Transfer: External services execute actual transfer
- Fee Distribution: Priority fees handled by external coordination
Coordination Requirements
For proper fisher bridge operation:
Signature Consistency
- Same signature used on both host and external chains
- Identical parameter values across chains
- Synchronized nonce values
Service Integration
- Off-chain monitoring of host chain events
- External token transfer execution
- Priority fee distribution mechanisms
- Error handling and retry logic
This function only validates signatures and manages nonces. Actual token transfers on the external chain require off-chain services that coordinate between the validation and execution steps.
Nonce values must remain synchronized between host and external chain stations. Mismatched nonces will cause signature validation failures and break the fisher bridge system.