chore: fmt and slither
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.0;
|
||||
pragma solidity ^0.8.28;
|
||||
|
||||
/**
|
||||
* @title Propellerheads PrefixLengthEncoded Byte Array Library
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import {Test} from "forge-std/Test.sol";
|
||||
import {LibPrefixLengthEncodedByteArray} from "../src/lib/LibPrefixLengthEncodedByteArray.sol";
|
||||
import {LibPrefixLengthEncodedByteArray} from
|
||||
"../src/lib/LibPrefixLengthEncodedByteArray.sol";
|
||||
|
||||
contract LibPrefixLengthEncodedByteArrayTest is Test {
|
||||
using LibPrefixLengthEncodedByteArray for bytes;
|
||||
@@ -53,13 +54,13 @@ contract LibPrefixLengthEncodedByteArrayTest is Test {
|
||||
function testFailInvalidLength() public {
|
||||
// Length prefix larger than remaining data
|
||||
bytes memory invalid = hex"0004414243";
|
||||
this.next(invalid);
|
||||
(bytes memory elem, bytes memory remaining) = this.next(invalid);
|
||||
}
|
||||
|
||||
function testFailIncompletePrefix() public {
|
||||
// Only 1 byte instead of 2 bytes prefix
|
||||
bytes memory invalid = hex"01";
|
||||
this.next(invalid);
|
||||
(bytes memory elem, bytes memory remaining) = this.next(invalid);
|
||||
}
|
||||
|
||||
function testLargeElement() public {
|
||||
@@ -69,7 +70,7 @@ contract LibPrefixLengthEncodedByteArrayTest is Test {
|
||||
large[1] = bytes1(uint8(0xe8)); // E8 (1000 in hex)
|
||||
|
||||
// Fill data bytes
|
||||
for (uint i = 2; i < large.length; i++) {
|
||||
for (uint256 i = 2; i < large.length; i++) {
|
||||
large[i] = bytes1(uint8(0x01));
|
||||
}
|
||||
|
||||
@@ -93,12 +94,15 @@ contract LibPrefixLengthEncodedByteArrayTest is Test {
|
||||
assertEq(this.size(data), 2);
|
||||
}
|
||||
|
||||
function next(bytes calldata data) external pure returns (bytes memory, bytes memory) {
|
||||
return data.next();
|
||||
function next(bytes calldata data)
|
||||
external
|
||||
pure
|
||||
returns (bytes memory elem, bytes memory remaining)
|
||||
{
|
||||
(elem, remaining) = data.next();
|
||||
}
|
||||
|
||||
function size(bytes calldata data) external pure returns (uint256) {
|
||||
return data.size();
|
||||
function size(bytes calldata data) external pure returns (uint256 s) {
|
||||
s = data.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user