DeFiHardhatOracleProxyUpdates
100,000 USDC
View results
Submission Details
Severity: low
Invalid

[L-1] `abi.encodePacked()` should not be used with dynamic types

Summary

abi.encodePacked() should not be used with dynamic types when passing the result to a hash function such as keccak256()

Impact

Hash collisions (e.g. abi.encodePacked(0x123,0x456) => 0x123456 => abi.encodePacked(0x1,0x23456)

But with abi.encode(0x123,0x456) => 0x0...1230...456).

Recommendation

Unless there is a compelling reason, abi.encode should be used.

If there is only one argument to abi.encodePacked() it can often be cast to bytes() or bytes32() instead.

If all arguments are strings and or bytes, bytes.concat() should be used instead.

Updates

Lead Judging Commences

giovannidisiena Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.