<!-- canonical: https://0xsimao.com/findings/vertex-encode-packed-dynamic-types -->

# Use of abi.encodePacked() with Dynamic Types

Low/Info · Three Sigma · Hybrid orderbook DEX · 3rd April 2024

Finding 3S-Vertex-N02 of the Vertex security review.

- Report: /reports/vertex
- Source: https://github.com/0xsimao/audits/blob/main/Three%20Sigma/2024-04-03-vertex.pdf

---

### Description

Using abi.encodePacked() with dynamic types, as seen in Verifier.sol on [L160](https://github.com/vertex-protocol/vertex-contracts-3sigma-audit/blob/4286c37cf4ee59d7e3231ac4683859f54d0d8e96/contracts/Verifier.sol#L160) and in
Endpoint.sol on [L749](https://github.com/vertex-protocol/vertex-contracts-3sigma-audit/blob/50601071fb44010524ce4d667c5c881af1b2533e/contracts/Endpoint.sol#L749), isn't advisable when feeding the outcome into a hashing function
like keccak256(), due to [hash collisions](https://scsfg.io/hackers/abi-hash-collisions/).

### Recommendation

Use abi.encode() instead.

### Status

Acknowledged

Disclosed by 0xSimao (https://0xsimao.com/).

---

Related findings:

- [BaseFlasher does extra abi.encode unnecessarily](https://0xsimao.com/findings/fuji-finance-flasher-abi-encode-unnecessarily): Fuji Finance
