@rootzero/contracts 1.17.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -0
- package/Core.sol +1 -1
- package/Endpoints.sol +39 -38
- package/annotations/Label.sol +1 -5
- package/codec/Blocks.sol +359 -74
- package/codec/Buffers.sol +14 -0
- package/codec/Decoders.sol +59 -0
- package/codec/Writers.sol +102 -0
- package/commands/Relay.sol +2 -2
- package/commands/Repay.sol +83 -0
- package/core/Settlement.sol +16 -9
- package/docs/Schema.md +5 -0
- package/execution/Execution.sol +150 -0
- package/guards/Revoke.sol +22 -0
- package/package.json +1 -1
- package/ports/AllowAssets.sol +2 -2
- package/ports/Allowance.sol +2 -2
- package/ports/Credit.sol +2 -2
- package/ports/Debit.sol +2 -2
- package/ports/DenyAssets.sol +2 -2
- package/ports/Dispatch.sol +3 -3
- package/ports/Pipe.sol +2 -2
- package/ports/Post.sol +2 -2
- package/ports/Redeem.sol +2 -2
- package/utils/Cursors.sol +10 -3
package/utils/Cursors.sol
CHANGED
|
@@ -36,6 +36,11 @@ struct Cur {
|
|
|
36
36
|
/// to marks. A zero mark identifies the empty cursor at position zero; `before`
|
|
37
37
|
/// therefore treats it as already reached.
|
|
38
38
|
///
|
|
39
|
+
/// Cursor navigation assumes packed cursor inputs satisfy `i <= len`.
|
|
40
|
+
/// Constructors and composition helpers establish this invariant, and navigation
|
|
41
|
+
/// helpers preserve it. Manually constructing or modifying packed cursor words
|
|
42
|
+
/// may cause arithmetic panics instead of cursor-specific errors.
|
|
43
|
+
///
|
|
39
44
|
/// The zero word represents an absent cursor.
|
|
40
45
|
library Cursors {
|
|
41
46
|
/// @dev A cursor position exceeds its logical length.
|
|
@@ -214,11 +219,12 @@ library Cursors {
|
|
|
214
219
|
}
|
|
215
220
|
|
|
216
221
|
/// @notice Advance the current position of the lower cursor.
|
|
222
|
+
/// @dev Assumes `cur` satisfies the cursor invariant `i <= len`.
|
|
217
223
|
/// @param cur Packed cursor or cursor pair.
|
|
218
224
|
/// @param amount Number of bytes to advance.
|
|
219
225
|
/// @return updated Cursor advanced by `amount`.
|
|
220
226
|
function advance(uint cur, uint amount) internal pure returns (uint updated) {
|
|
221
|
-
uint i = uint32(
|
|
227
|
+
uint i = uint32(cur);
|
|
222
228
|
uint len = uint32(cur >> 64);
|
|
223
229
|
if (amount > len - i) revert OutOfBounds();
|
|
224
230
|
updated = cur + amount;
|
|
@@ -236,14 +242,15 @@ library Cursors {
|
|
|
236
242
|
|
|
237
243
|
/// @notice Create a child cursor over `[start, end)` within the lower cursor.
|
|
238
244
|
/// @dev The child starts at position zero, has no recorded count, and uses the
|
|
239
|
-
/// supplied tag. Any higher cursor is omitted.
|
|
245
|
+
/// supplied tag. Any higher cursor is omitted. Assumes `cur` satisfies the
|
|
246
|
+
/// cursor invariant `i <= len`.
|
|
240
247
|
/// @param cur Parent cursor or cursor pair.
|
|
241
248
|
/// @param start Child start relative to the parent base.
|
|
242
249
|
/// @param end Child exclusive end relative to the parent base.
|
|
243
250
|
/// @param tag Child identity tag.
|
|
244
251
|
/// @return child Packed child cursor.
|
|
245
252
|
function slice(uint cur, uint start, uint end, uint8 tag) internal pure returns (uint child) {
|
|
246
|
-
(, uint offset, uint len) = decode(
|
|
253
|
+
(, uint offset, uint len) = decode(cur);
|
|
247
254
|
if (start > end || end > len) revert OutOfBounds();
|
|
248
255
|
child = create(offset + start, end - start, 0, 0, tag);
|
|
249
256
|
}
|