Skip to content

Commit 1a475e2

Browse files
committed
All tests passing
1 parent d63c7d4 commit 1a475e2

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/lib/V2DutchOrderLib.sol

+5-5
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ library CosignerExtraDataLib {
122122
uint256 bytesOffset = 33;
123123

124124
if (hasExclusiveFiller(extraData)) {
125-
// an address is 20 bytes long
126-
require(extraData.length >= bytesOffset + 20);
125+
// + 20 bytes for address, - 32 bytes for the length offset
126+
require(extraData.length >= bytesOffset - 12);
127127
assembly {
128128
// it loads a full 32 bytes, shift right 96 bits so only the address remains
129129
filler := shr(96, mload(add(extraData, bytesOffset)))
@@ -132,8 +132,8 @@ library CosignerExtraDataLib {
132132
}
133133

134134
if (hasInputOverride(extraData)) {
135-
// a uint256 is 32 bytes long, so we just load the next 32 bytes
136-
require(extraData.length >= bytesOffset + 32);
135+
// + 32 bytes for uint256, - 32 bytes for the length offset
136+
require(extraData.length >= bytesOffset);
137137
assembly {
138138
inputOverride := mload(add(extraData, bytesOffset))
139139
}
@@ -148,7 +148,7 @@ library CosignerExtraDataLib {
148148
}
149149
bytesOffset += 32;
150150

151-
// each element of the array is 32 bytes
151+
// each element of the array is 32 bytes, - 32 bytes for the length offset
152152
require(extraData.length == bytesOffset + (length - 1) * 32);
153153
outputOverrides = new uint256[](length);
154154

test/reactors/V2DutchOrderReactor.t.sol

+2-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ contract V2DutchOrderTest is PermitSignature, DeployPermit2, BaseDutchOrderReact
255255
}
256256

257257
function testEncoding() public {
258-
bytes memory encodedBytes = encodeExtraCosignerData(address(1111111111111111), 22222222222222, ArrayBuilder.fill(3, 5));
258+
bytes memory encodedBytes =
259+
encodeExtraCosignerData(address(1111111111111111), 22222222222222, ArrayBuilder.fill(3, 5));
259260
assertTrue(encodedBytes.hasExclusiveFiller());
260261
assertTrue(encodedBytes.hasInputOverride());
261262
assertTrue(encodedBytes.hasOutputOverrides());

0 commit comments

Comments
 (0)