ethereum: fix some intermittently failing tests

Fix the assumptions to match the storage layout correctly.
This commit is contained in:
Jeff Schroeder 2023-09-08 20:05:03 +00:00
parent 049ca971df
commit d9aacf1485
1 changed files with 19 additions and 4 deletions

View File

@ -506,12 +506,19 @@ contract TestGovernance is TestUtils {
unchangedStorage(address(proxied), storageSlot)
{
vm.assume(storageSlot != hashedLocationOffset(0, GUARDIANSETS_SLOT, 1));
vm.assume(storageSlot != hashedLocationOffset(0, GUARDIANSETS_SLOT, 0));
// New GuardianSet array length should be initialized from zero to non-zero
vm.assume(storageSlot != hashedLocationOffset(1, GUARDIANSETS_SLOT, 0));
vm.assume(storageSlot != GUARDIANSETINDEX_SLOT);
vm.assume(0 < newGuardianSet.length);
vm.assume(newGuardianSet.length < 20);
for(uint8 i = 0; i < newGuardianSet.length; i++)
for(uint8 i = 0; i < newGuardianSet.length; i++) {
vm.assume(newGuardianSet[i] != address(0));
// New GuardianSet key array elements should be initialized from zero to non-zero
vm.assume(storageSlot != bytes32(uint256(keccak256(abi.encodePacked(hashedLocationOffset(1, GUARDIANSETS_SLOT, 0)))) + i));
}
vm.chainId(EVMCHAINID);
@ -751,12 +758,20 @@ contract TestGovernance is TestUtils {
unchangedStorage(address(proxied), storageSlot)
{
vm.assume(storageSlot != hashedLocationOffset(0, GUARDIANSETS_SLOT, 1));
vm.assume(storageSlot != hashedLocationOffset(0, GUARDIANSETS_SLOT, 0));
// New GuardianSet array length should be initialized from zero to non-zero
vm.assume(storageSlot != hashedLocationOffset(1, GUARDIANSETS_SLOT, 0));
vm.assume(storageSlot != GUARDIANSETINDEX_SLOT);
vm.assume(0 < newGuardianSet.length);
vm.assume(newGuardianSet.length < 20);
for(uint8 i = 0; i < newGuardianSet.length; i++)
for(uint8 i = 0; i < newGuardianSet.length; i++) {
vm.assume(newGuardianSet[i] != address(0));
// New GuardianSet key array elements should be initialized from zero to non-zero
vm.assume(storageSlot != bytes32(uint256(keccak256(abi.encodePacked(hashedLocationOffset(1, GUARDIANSETS_SLOT, 0)))) + i));
}
vm.chainId(EVMCHAINID);
bytes memory payload = payloadSubmitNewGuardianSet(MODULE, CHAINID, 1, newGuardianSet);