Skip to content

Commit dead80e

Browse files
alvrsfrolic
andauthored
fix(protocol-parser): add padding for encodedLengths (#3507)
Co-authored-by: Kevin Ingersoll <[email protected]>
1 parent a3e56e7 commit dead80e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/shaggy-shirts-work.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@latticexyz/protocol-parser": patch
3+
---
4+
5+
Added padding to make sure the `encodedLengths` field of a Store log is always 32 bytes.

packages/protocol-parser/src/decodeValueArgs.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { concatHex } from "viem";
1+
import { concatHex, padHex } from "viem";
22
import { isStaticAbiType } from "@latticexyz/schema-type/internal";
33
import { SchemaToPrimitives, ValueArgs, ValueSchema } from "./common";
44
import { decodeValue } from "./decodeValue";
@@ -13,7 +13,7 @@ export function decodeValueArgs<TSchema extends ValueSchema>(
1313
valueSchema,
1414
concatHex([
1515
readHex(staticData, 0, staticDataLength(Object.values(valueSchema).filter(isStaticAbiType))),
16-
encodedLengths,
16+
padHex(encodedLengths, { size: 32 }),
1717
dynamicData,
1818
]),
1919
);

0 commit comments

Comments
 (0)