Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Infoless deploy test caching #168

Merged
merged 5 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ out = 'out'
libs = ['lib']
fs_permissions = [
{ access = "read", path = "./lib/dss-test/script/input/"},
{ access = "read", path = "./out/ArbitrumDomain.sol/ArbSysOverride.json"}
{ access = "read", path = "./out/ArbitrumDomain.sol/ArbSysOverride.json"},
{ access = "read-write", path = "./spellblock.txt"}
]

[rpc_endpoints]
Expand Down
1 change: 1 addition & 0 deletions spellblock.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8451434
25 changes: 15 additions & 10 deletions src/DssSpell.t.base.sol
Original file line number Diff line number Diff line change
Expand Up @@ -292,21 +292,26 @@ contract DssSpellTestBase is Config, DssTest {
return;
}

uint256 low = 5273074; // MCD_VAT Deployed Aug-06-2021 04:26:38 PM +UTC
string memory spellBlockPath = "./spellblock.txt";

uint256 low = vm.parseUint(vm.readLine(spellBlockPath));
naszam marked this conversation as resolved.
Show resolved Hide resolved
uint256 high = block.number;
uint256 mid;

while (low < high) {
mid = (low & high) + (low ^ high) / 2; // rounds down
vm.rollFork(mid);
if (_isContractDeployed(_spell)) {
high = mid;
} else {
low = mid + 1;
vm.rollFork(low);
if (!_isContractDeployed(_spell)) {
while (low < high) {
mid = (low & high) + (low ^ high) / 2; // rounds down
vm.rollFork(mid);
if (_isContractDeployed(_spell)) {
high = mid;
} else {
low = mid + 1;
}
}
vm.writeFile(spellBlockPath, vm.toString(low));
vm.rollFork(low);
naszam marked this conversation as resolved.
Show resolved Hide resolved
}

vm.rollFork(low);
}

function _isContractDeployed(address _spell) internal view returns (bool) {
Expand Down