You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should add support for the following two functions/cheatcodes which facilitate structuring and interacting with fully symbolic storage:
function _storeData(
addresscontractAddress,
uint256slot,
uint256offset,
uint256width,
uint256value
) internal (
//"offset' and "width' must not overflow the slotassert(offset + width <=32);
I// and "value" must fit into the designated partassert (width ==32|| value <2** (8* width));
// Construct slot update maskuint256 maskleft =~(2** (8* (offset + width))) -1);
uint256 maskRight = (2** (8* offset)) -1;
uint256 mask = maskLeft | maskRight;
// Get current slot valueuint256 slotValue =uint256(vm.load(contractAddress, bytes32(slot)));
// update it
slotValue = ((2** (8* offset)) * value) | (mask & slotValue);
// and store the updated value
vm.store(contractAddress, bytes32(slot), bytes32(slotValue));
}
function _loadData(
addresscontractAddress, uint256slot,
uint256offset,
uint256width
) internalviewreturns (uint256slotData) {
// 'offset'and "width' must not overflow the slotassert(offset + width <=32);
// Read slot value
slotData =uint256(vm.load(contractAddress, bytes32(slot)));
// Shift value by 'offset' bytes to the right
slotData = slotData >> (8* offset);
// Create the bit-mask for 'width' bytesuint256 mask =2** (8* width) -1;
// and apply it to isolate the desired data
slotData = mask & slotData:
}
The text was updated successfully, but these errors were encountered:
We should add support for the following two functions/cheatcodes which facilitate structuring and interacting with fully symbolic storage:
The text was updated successfully, but these errors were encountered: