Skip to content

Commit 99cb879

Browse files
committed
docs: Update and clarify invariants
1 parent e06ef71 commit 99cb879

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

docs/INVARIANTS.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126

127127
### INV-014: Pause Functionality
128128

129-
- **Invariant**: The protocol must be pausable in emergency situations
129+
- **Invariant**: The protocol must be pausable in emergency situations. This should prevent inbound and outbound flows of assets.
130130
- **Description**: Allows immediate halt of operations if vulnerabilities are discovered
131131
- **Enforcement**: Pause state with operation blocking modifiers/constraints
132132
- **Error Codes**: `Paused` (Solana), **MISSING** (Sui)
@@ -218,31 +218,42 @@
218218

219219
### INV-024: Non-Zero Threshold Requirement
220220

221-
- **Invariant**: When transceivers are registered, threshold must be greater than zero
221+
- **Invariant**: Threshold must be greater than zero (after initial deployment)
222222
- **Description**: Prevents configuration where messages cannot be approved due to zero threshold
223223
- **Enforcement**: Zero threshold validation when transceivers exist
224224
- **Error Codes**: `ZeroThreshold` (EVM/Solana), `EZeroThreshold` (Sui)
225225
- **Code Reference**: `if (numTransceivers.registered > 0 && threshold == 0) revert ZeroThreshold();`
226226

227227
### INV-025: Minimum Transceiver Requirement
228228

229-
- **Invariant**: At least one transceiver must be enabled for operations
229+
- **Invariant**: At least one transceiver must be enabled for operations (after initial deployment)
230230
- **Description**: Prevents operations when no transceivers are available to process messages
231231
- **Enforcement**: Enabled transceiver count validation before operations
232232
- **Error Codes**: `NoEnabledTransceivers` (EVM), `NoRegisteredTransceivers` (Solana)
233-
- **Code Reference**: `if (numEnabledTransceivers == 0) revert NoEnabledTransceivers();`
233+
234+
### INV-026: Transceiver Registration Requirement
235+
236+
- **Invariant**: A transceiver cannot be unregistered and its index must not change
237+
- **Description**: Transceivers should never be truly deleted, only disabled. This preserves their index into the bitmap which is crucial for attestation.
238+
- **Enforcement**: Assertions on transceiver management code paths
239+
240+
### INV-027: Transceiver Registration Requirement
241+
242+
- **Invariant**: The next transceiver index must always increase monotically
243+
- **Description**: The next transceiver index should always go up by one. This guarantees uniqueness of indices into the bitmap which is crucial for attestation.
244+
- **Enforcement**: Assertions on transceiver management code paths
234245

235246
## Timing and Release Controls
236247

237-
### INV-026: Release Timing Validation
248+
### INV-028: Release Timing Validation
238249

239250
- **Invariant**: Transfers can only be released after rate limit delay expires
240251
- **Description**: Enforces time-based delays for rate-limited transfers
241252
- **Enforcement**: Timestamp validation before transfer release
242253
- **Error Codes**: `CantReleaseYet` (Solana), `ECantReleaseYet` (Sui)
243254
- **Code Reference**: Rate limiter queue system with timestamp checks, `try_release()` functions
244255

245-
### INV-027: Transfer Redemption Controls
256+
### INV-029: Transfer Redemption Controls
246257

247258
- **Invariant**: Transfers must be properly approved and not already redeemed before processing
248259
- **Description**: Prevents unauthorized or duplicate transfer redemptions
@@ -252,15 +263,15 @@
252263

253264
## Message Size Constraints
254265

255-
### INV-028: Payload Length Limitation
266+
### INV-030: Payload Length Limitation
256267

257268
- **Invariant**: NttManagerMessages and AdditionalPayloads must not exceed uint16 in size
258269
- **Description**: Prevents unbounded message sizes that could cause processing issues
259270
- **Enforcement**: Assertions in encoding logic
260271
- **Error Codes**: `PayloadTooLong` (EVM)
261272
- **Code Reference**: `TransceiverStructs.sol` (EVM), implementation of `Writable` trait for `NativeTokenTransfer` (Solana)
262273

263-
### INV-029: Transceiver Instruction Length Limitation
274+
### INV-031: Transceiver Instruction Length Limitation
264275

265276
- **Invariant**: Individual transceiver instruction payloads must not exceed uint8 in size
266277
- **Description**: Prevents unbounded message sizes that could cause processing issues

0 commit comments

Comments
 (0)