foundry-rs/foundry

chisel incorrectly parses the full word from storage when returning uint256 types

DrakeEvans opened this issue · 0 comments

Component

Chisel

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

chisel 0.2.0 (4817280 2024-11-11T17:07:32.412876000Z)

What command(s) is the bug in?

chisel

Operating System

macOS (Apple Silicon)

Describe the bug

When returning the full word from storage for the following code snippet
keccak256(abi.encode(uint256(keccak256("AgoraStableSwapStorage.OracleStorage")) - 1)) & ~bytes32(uint256(0xff))

The output is
Type: uint256 ├ Hex: 0xa6b316b47a0cd26c1b582ae3dcffbd175283c221c3cb3d1c614e3e47f62a700 ├ Hex (full word): 0xa6b316b47a0cd26c1b582ae3dcffbd175283c221c3cb3d1c614e3e47f62a700 └ Decimal: 4712522199592559686081775781256535485973216673499069812336538043969769219840
You can see that the Hex (full word) only contains 63 characters which is incorrect as words are 256 bits. It should instead read 0x0a6b316b47a0cd26c1b582ae3dcffbd175283c221c3cb3d1c614e3e47f62a700 (missing a 0 in first position