Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ fs_permissions = [{ access = "read", path = "./test/data"}]
remappings = [
"forge-std=test/utils/forge-std/"
]
# remove memory-safe-assembly warning from compiler
ignored_error_codes = [2424,8429,4591]

[profile.pre_global_structs]
skip = ["*/g/*", "*/*7702*", "*/*BlockHashLib*", "*/*Transient*", "*/ext/ithaca/*", "*/ext/zksync/*"]
Expand Down Expand Up @@ -46,6 +48,9 @@ remappings = [
"forge-std=test/utils/forge-std/"
]

[lint]
lint_on_build = false

[fmt]
line_length = 100 # While we allow up to 120, we lint at 100 for readability.
ignore = ["src/accounts/EIP7702Proxy.sol"]
Expand Down
2 changes: 1 addition & 1 deletion src/utils/LibString.sol
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ library LibString {
result := mul(
or( // Load the length and the bytes of `a` and `b`.
shl(shl(3, sub(0x1f, aLen)), mload(add(a, aLen))),
mload(sub(add(b, 0x1e), aLen))
shr(shl(3, add(aLen, 1)), mload(add(b, 0x1f)))
),
// `totalLen != 0 && totalLen < 31`. Abuses underflow.
// Assumes that the lengths are valid and within the block gas limit.
Expand Down
2 changes: 1 addition & 1 deletion src/utils/g/LibString.sol
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ library LibString {
result := mul(
or( // Load the length and the bytes of `a` and `b`.
shl(shl(3, sub(0x1f, aLen)), mload(add(a, aLen))),
mload(sub(add(b, 0x1e), aLen))
shr(shl(3, add(aLen, 1)), mload(add(b, 0x1f)))
),
// `totalLen != 0 && totalLen < 31`. Abuses underflow.
// Assumes that the lengths are valid and within the block gas limit.
Expand Down
8 changes: 8 additions & 0 deletions test/LibString.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1456,6 +1456,14 @@ contract LibStringTest is SoladyTest {
testStringPackAndUnpackTwo("abcdefghijklmnopqrstuvwxyzABCD", "");
testStringPackAndUnpackTwo("The strongest community I've ever seen", "NGL");
testStringPackAndUnpackTwo("", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
testStringPackAndUnpackTwo(
"01234567890123456789012345678901_search_search_search_search_search_search_23456789012345678901234567890123456789_search_search_search_search_search_search",
""
);
testStringPackAndUnpackTwoDifferential(
"01234567890123456789012345678901_search_search_search_search_search_search_23456789012345678901234567890123456789_search_search_search_search_search_search",
""
);
}
}

Expand Down