From 344cc836e7c0a5c3216940b16990152d9cb8ce8c Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Mon, 2 Feb 2026 15:05:23 +0400 Subject: [PATCH 1/3] fix line size in bytesConstantString --- src/lib/LibCodeGen.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/LibCodeGen.sol b/src/lib/LibCodeGen.sol index 0fa7cc0..33d3efe 100644 --- a/src/lib/LibCodeGen.sol +++ b/src/lib/LibCodeGen.sol @@ -222,7 +222,7 @@ library LibCodeGen { "\nbytes constant ", name, " =", - 17 + bytes(name).length + 6 + bytes(hexData).length + 2 > MAX_LINE_LENGTH ? NEWLINE_DUE_TO_MAX_LENGTH : " ", + 15 + 2 + bytes(name).length + 1 + 4 + bytes(hexData).length + 2 > MAX_LINE_LENGTH ? NEWLINE_DUE_TO_MAX_LENGTH : " ", "hex\"", hexData, "\";\n" From e16234edfe457df76d59ce40698079e57fc6f5da Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Mon, 2 Feb 2026 15:13:27 +0400 Subject: [PATCH 2/3] fix line length calcs --- src/lib/LibCodeGen.sol | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/LibCodeGen.sol b/src/lib/LibCodeGen.sol index 33d3efe..724bdc0 100644 --- a/src/lib/LibCodeGen.sol +++ b/src/lib/LibCodeGen.sol @@ -222,7 +222,7 @@ library LibCodeGen { "\nbytes constant ", name, " =", - 15 + 2 + bytes(name).length + 1 + 4 + bytes(hexData).length + 2 > MAX_LINE_LENGTH ? NEWLINE_DUE_TO_MAX_LENGTH : " ", + 15 + bytes(name).length + 2 + 1 + 4 + bytes(hexData).length + 2 > MAX_LINE_LENGTH ? NEWLINE_DUE_TO_MAX_LENGTH : " ", "hex\"", hexData, "\";\n" @@ -241,14 +241,15 @@ library LibCodeGen { pure returns (string memory) { + string memory intString = vm.toString(data); return string.concat( "\n", comment, "\nuint8 constant ", name, " =", - 17 + bytes(name).length + 6 + 3 + 2 > MAX_LINE_LENGTH ? NEWLINE_DUE_TO_MAX_LENGTH : " ", - vm.toString(data), + 15 + bytes(name).length + 2 + 1 + bytes(intString).length + 1 > MAX_LINE_LENGTH ? NEWLINE_DUE_TO_MAX_LENGTH : " ", + intString, ";\n" ); } From c07c8cbf16a9f008f82b7851dc46b4b420edd3e6 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Mon, 2 Feb 2026 15:16:40 +0400 Subject: [PATCH 3/3] fmt --- src/lib/LibCodeGen.sol | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/LibCodeGen.sol b/src/lib/LibCodeGen.sol index 724bdc0..ceb442b 100644 --- a/src/lib/LibCodeGen.sol +++ b/src/lib/LibCodeGen.sol @@ -222,7 +222,9 @@ library LibCodeGen { "\nbytes constant ", name, " =", - 15 + bytes(name).length + 2 + 1 + 4 + bytes(hexData).length + 2 > MAX_LINE_LENGTH ? NEWLINE_DUE_TO_MAX_LENGTH : " ", + 15 + bytes(name).length + 2 + 1 + 4 + bytes(hexData).length + 2 > MAX_LINE_LENGTH + ? NEWLINE_DUE_TO_MAX_LENGTH + : " ", "hex\"", hexData, "\";\n" @@ -248,7 +250,9 @@ library LibCodeGen { "\nuint8 constant ", name, " =", - 15 + bytes(name).length + 2 + 1 + bytes(intString).length + 1 > MAX_LINE_LENGTH ? NEWLINE_DUE_TO_MAX_LENGTH : " ", + 15 + bytes(name).length + 2 + 1 + bytes(intString).length + 1 > MAX_LINE_LENGTH + ? NEWLINE_DUE_TO_MAX_LENGTH + : " ", intString, ";\n" );