Skip to content

Commit c35b9df

Browse files
committed
add revert-on-dust invariant
1 parent b17e907 commit c35b9df

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

docs/INVARIANTS.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,16 @@
190190
- **Error Codes**: `DeliveryPaymentTooLow` (EVM)
191191
- **Code Reference**: `_quoteDeliveryPrice()` and payment validation
192192

193+
### INV-021: Revert On Dust
194+
195+
- **Invariant**: All cross-chain transfers should revert if the user included more than the exact amount ("dust")
196+
- **Description**: Ensures funds do not become locked in the contracts
197+
- **Enforcement**: Amount calculations in processing
198+
- **Error Codes**: `TransferAmountHasDust` (EVM)
199+
193200
## Peer Management
194201

195-
### INV-021: Peer Management
202+
### INV-022: Peer Management
196203

197204
- **Invariant**: NTT Manager's peers must not be registered on the same chainID as the NTT Manager
198205
- **Description**: Peers refer to NTT Managers on other chains; peers must not register each other on the same chain as they are operating on
@@ -201,51 +208,51 @@
201208

202209
## Transceiver Management
203210

204-
### INV-022: Transceiver Registration Requirement
211+
### INV-023: Transceiver Registration Requirement
205212

206213
- **Invariant**: A transceiver can be enabled only when it is also registered
207214
- **Description**: It is invalid for an enabled transceiver to be unregistered
208215
- **Enforcement**: Assertions on transceiver management code paths
209216
- **Code Reference**: `TransceiverRegistry.sol` (EVM)
210217

211-
### INV-023: Minimum and Maximum Threshold Bounds
218+
### INV-024: Minimum and Maximum Threshold Bounds
212219

213220
- **Invariant**: Threshold must be 1) greater than zero and 2) less than or equal to the number of enabled transceivers
214221
- **Description**: Attestation threshold must not exceed available transceivers and must be positive
215222
- **Enforcement**: Explicit bounds checking in threshold setting functions
216223
- **Error Codes**: `ThresholdTooHigh`, `ZeroThreshold` (EVM/Solana)
217224
- **Code Reference**: `_checkThresholdInvariants()` (EVM), error enforcement (Solana), `EThresholdTooHigh` (Sui)
218225

219-
### INV-024: Minimum Transceiver Requirement
226+
### INV-025: Minimum Transceiver Requirement
220227

221228
- **Invariant**: At least one transceiver must be enabled for operations (after initial deployment)
222229
- **Description**: Prevents operations when no transceivers are available to process messages
223230
- **Enforcement**: Enabled transceiver count validation before operations
224231
- **Error Codes**: `NoEnabledTransceivers` (EVM), `NoRegisteredTransceivers` (Solana)
225232

226-
### INV-025: Transceiver Registration Requirement
233+
### INV-026: Transceiver Registration Requirement
227234

228235
- **Invariant**: A transceiver cannot be unregistered and its index must not change
229236
- **Description**: Transceivers should never be truly deleted, only disabled. This preserves their index into the bitmap which is crucial for attestation.
230237
- **Enforcement**: Assertions on transceiver management code paths
231238

232-
### INV-026: Transceiver index should always increase
239+
### INV-027: Transceiver index should always increase
233240

234241
- **Invariant**: The next transceiver index must always increase monotically
235242
- **Description**: The next transceiver index should always go up by one. This guarantees uniqueness of indices into the bitmap which is crucial for attestation.
236243
- **Enforcement**: Assertions on transceiver management code paths
237244

238245
## Timing and Release Controls
239246

240-
### INV-027: Release Timing Validation
247+
### INV-028: Release Timing Validation
241248

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

248-
### INV-028: Transfer Redemption Controls
255+
### INV-029: Transfer Redemption Controls
249256

250257
- **Invariant**: Transfers must be properly approved and not already redeemed before processing
251258
- **Description**: Prevents unauthorized or duplicate transfer redemptions
@@ -255,15 +262,15 @@
255262

256263
## Message Size Constraints
257264

258-
### INV-029: Payload Length Limitation
265+
### INV-030: Payload Length Limitation
259266

260267
- **Invariant**: NttManagerMessages and AdditionalPayloads must not exceed uint16 in size
261268
- **Description**: Prevents unbounded message sizes that could cause processing issues
262269
- **Enforcement**: Assertions in encoding logic
263270
- **Error Codes**: `PayloadTooLong` (EVM)
264271
- **Code Reference**: `TransceiverStructs.sol` (EVM), implementation of `Writable` trait for `NativeTokenTransfer` (Solana)
265272

266-
### INV-030: Transceiver Instruction Length Limitation
273+
### INV-031: Transceiver Instruction Length Limitation
267274

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

0 commit comments

Comments
 (0)