Skip to content

Commit ef487b6

Browse files
committed
revert strings
1 parent 8cd68aa commit ef487b6

File tree

4 files changed

+21
-22
lines changed

4 files changed

+21
-22
lines changed

lcov.info

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -495,13 +495,13 @@ BRDA:90,0,1,512
495495
DA:91,512
496496
BRDA:91,1,0,2
497497
BRDA:91,1,1,510
498-
DA:93,510
499-
BRDA:93,2,0,-
500-
BRDA:93,2,1,510
501-
DA:103,258
502-
FN:103,ReadCidSha256.NullableCid
498+
DA:92,510
499+
BRDA:92,2,0,-
500+
BRDA:92,2,1,510
501+
DA:102,258
502+
FN:102,ReadCidSha256.NullableCid
503503
FNDA:258,ReadCidSha256.NullableCid
504-
DA:104,258
504+
DA:103,258
505505
FNF:3
506506
FNH:3
507507
LF:14

src/ReadCbor.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ library ReadCbor {
344344
n := add(i, len)
345345
}
346346

347-
require(n <= cbor.length, "index out of range");
347+
require(n <= cbor.length);
348348
}
349349

350350
/// @notice Reads a string item into a bytes32 and advances the index
@@ -369,15 +369,15 @@ library ReadCbor {
369369
{
370370
assert(maxLen <= 32);
371371
(i, len) = header8(cbor, i, MajorText);
372-
require(len <= maxLen, "string length out of range");
372+
require(len <= maxLen);
373373

374374
assembly ("memory-safe") {
375375
ret := mload(add(cbor, add(0x20, i)))
376376
ret := and(ret, not(shr(mul(len, 8), not(0))))
377377
n := add(i, len)
378378
}
379379

380-
require(n <= cbor.length, "index out of range");
380+
require(n <= cbor.length);
381381
}
382382

383383
/// @notice Reads a single-byte string item and advances the index
@@ -405,7 +405,7 @@ library ReadCbor {
405405
uint32 len;
406406
(i, len) = header32(cbor, i, MajorText);
407407
n = i + len;
408-
require(n <= cbor.length, "index out of range");
408+
require(n <= cbor.length);
409409
}
410410

411411
/// @notice Checks if the next item is a byte string
@@ -434,7 +434,7 @@ library ReadCbor {
434434
n := add(i, len)
435435
}
436436

437-
require(n <= cbor.length, "index out of range");
437+
require(n <= cbor.length);
438438
}
439439

440440
/// @notice Reads a byte string item into a bytes32 and advances the index
@@ -458,15 +458,15 @@ library ReadCbor {
458458
{
459459
assert(maxLen <= 32);
460460
(i, len) = header8(cbor, i, MajorBytes);
461-
require(len <= maxLen, "bytes length out of range");
461+
require(len <= maxLen);
462462

463463
assembly ("memory-safe") {
464464
ret := mload(add(cbor, add(0x20, i)))
465465
ret := and(ret, not(shr(mul(len, 8), not(0))))
466466
n := add(i, len)
467467
}
468468

469-
require(n <= cbor.length, "index out of range");
469+
require(n <= cbor.length);
470470
}
471471

472472
/// @notice Skips a byte string item and advances the index
@@ -477,7 +477,7 @@ library ReadCbor {
477477
uint32 len;
478478
(i, len) = header32(cbor, i, MajorBytes);
479479
n = i + len;
480-
require(n <= cbor.length, "index out of range");
480+
require(n <= cbor.length);
481481
}
482482

483483
/// @notice Checks if the next item is a tag

src/tags/ReadBignum.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ library ReadBignum {
2525
)
2626
n := add(i, len)
2727
}
28-
require(n <= cbor.length, "index out of range");
28+
require(n <= cbor.length);
2929
}
3030

3131
function NInt256(bytes memory cbor, uint32 i) internal pure returns (uint32 n, int256 nbn) {
@@ -46,17 +46,17 @@ library ReadBignum {
4646
n := add(i, len)
4747
}
4848

49-
require(bn < uint256(type(int256).min), "two's complement int256 will overflow");
49+
require(bn < uint256(type(int256).min), "int256 will overflow");
5050
nbn = -1 - int256(bn);
51-
require(n <= cbor.length, "index out of range");
51+
require(n <= cbor.length);
5252
}
5353

5454
function Int256(bytes memory cbor, uint32 i) internal pure returns (uint32 n, int256 ibn) {
5555
(, uint64 tag) = cbor.Tag(i);
5656
if (tag == TagUnsignedBignum) {
5757
uint256 ubn;
5858
(n, ubn) = UInt256(cbor, i);
59-
require(ubn <= uint256(type(int256).max), "two's complement int256 will overflow");
59+
require(ubn <= uint256(type(int256).max), "int256 will overflow");
6060
ibn = int256(ubn);
6161
} else if (tag == TagNegativeBignum) {
6262
return NInt256(cbor, i);

src/tags/ReadCidSha256.sol

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,9 @@ library ReadCidSha256 {
8787
n := add(i, 41) // 4 bytes cbor header + 5 bytes multibase header + 32 bytes hash
8888
}
8989

90-
require(expect == cborHeader, "Expected CBOR tag 42 and 37-byte CIDv1");
91-
require(!cidSha256.isNull(), "Expected non-zero CID value");
92-
93-
require(n <= cbor.length, "index out of range");
90+
require(expect == cborHeader, "expected CBOR tag 42 and 37-byte CIDv1");
91+
require(!cidSha256.isNull(), "expected non-zero CID");
92+
require(n <= cbor.length);
9493
}
9594

9695
/**

0 commit comments

Comments
 (0)