ASSERT-KTH / solidity-hack-labs

Repository to store our work on recreating attacks for smart contracts
MIT License
3 stars 1 forks source link

Test internal/private variables in contracts #2

Open Mokita-J opened 5 months ago

Mokita-J commented 5 months ago

When testing the attacks it is good to have access to values of internal or private variables of the vulnerable contracts because it allows us to access wether the vulnerability was exploited or not.

Currently hardhat does not allow that: https://github.com/NomicFoundation/hardhat/issues/2645

Mokita-J commented 5 months ago

hardhat-exposed automatically exposes internal functions. However, it is not useful for internal/private variables and it supports solidity version >= 0.6.0.

Mokita-J commented 2 months ago

use ethers.provider.getStorage(address, slot) for reading private variables from a contract