|
1 | 1 | // SPDX-License-Identifier: Apache 2
|
2 | 2 | pragma solidity >=0.8.8 <0.9.0;
|
3 | 3 |
|
4 |
| -/// @dev This contract is responsible for handling the registration of Transceivers. |
| 4 | +/// @title TransceiverRegistry |
| 5 | +/// @author Wormhole Project Contributors. |
| 6 | +/// @notice This contract is responsible for handling the registration of Transceivers. |
| 7 | +/// edev This contract a few critical invariants hold when transceivers are added or removed, |
| 8 | +/// including: |
| 9 | +/// 1. if a transceiver is not registered, it should be enabled. |
| 10 | +/// 2. The value set in the bitmap of trannsceivers |
| 11 | +/// should directly correspond to the whether the transceiver is enabled |
5 | 12 | abstract contract TransceiverRegistry {
|
6 | 13 | constructor() {
|
7 | 14 | _checkTransceiversInvariants();
|
@@ -33,11 +40,33 @@ abstract contract TransceiverRegistry {
|
33 | 40 |
|
34 | 41 | uint8 constant MAX_TRANSCEIVERS = 64;
|
35 | 42 |
|
| 43 | + /// @notice Error when the caller is not the transceiver. |
| 44 | + /// @dev Selector 0xa0ae911d. |
| 45 | + /// @param caller The address of the caller. |
36 | 46 | error CallerNotTransceiver(address caller);
|
| 47 | + |
| 48 | + /// @notice Error when the transceiver is the zero address. |
| 49 | + /// @dev Selector 0x2f44bd77. |
37 | 50 | error InvalidTransceiverZeroAddress();
|
| 51 | + |
| 52 | + /// @notice Error when the transceiver is disabled. |
| 53 | + /// @dev Selector 0x1f61ba44. |
38 | 54 | error DisabledTransceiver(address transceiver);
|
| 55 | + |
| 56 | + /// @notice Error when the number of registered transceivers |
| 57 | + /// exceeeds (MAX_TRANSCEIVERS = 64). |
| 58 | + /// @dev Selector 0x891684c3. |
39 | 59 | error TooManyTransceivers();
|
| 60 | + |
| 61 | + /// @notice Error when attempting to remove a transceiver |
| 62 | + /// that is not registered. |
| 63 | + /// @dev Selector 0xd583f470. |
| 64 | + /// @param transceiver The address of the transceiver. |
40 | 65 | error NonRegisteredTransceiver(address transceiver);
|
| 66 | + |
| 67 | + /// @notice Error when attempting to enable a transceiver that is already enabled. |
| 68 | + /// @dev Selector 0x8d68f84d. |
| 69 | + /// @param transceiver The address of the transceiver. |
41 | 70 | error TransceiverAlreadyEnabled(address transceiver);
|
42 | 71 |
|
43 | 72 | modifier onlyTransceiver() {
|
|
0 commit comments