Commit 39e4a91e authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: visibility into flake

A flake in CI was introduced when https://github.com/ethereum-optimism/optimism/pull/7928
was merged. It is probably due to a race condition when reading a file
from disk. Is there a way to have foundry only do something once for the
entire test suite? Tried moving things to the constructor instead of
`setUp` but that did not work. Ideally we do not need to read the file
from disk for each contract deployed, this adds a lot of overhead.
A solution around this is to refactor the way that the deploy script
works or to add in the env var that will skip the check that sometimes
fails.
parent 5ebbc08f
......@@ -88,7 +88,10 @@ abstract contract Deployer is Script {
string memory chainIdPath = string.concat(deploymentsDir, "/.chainId");
try vm.readFile(chainIdPath) returns (string memory localChainId) {
if (vm.envOr("STRICT_DEPLOYMENT", true)) {
require(vm.parseUint(localChainId) == chainId, "Misconfigured networks");
require(
vm.parseUint(localChainId) == chainId,
string.concat("Misconfigured networks: ", localChainId, " != ", vm.toString(chainId))
);
}
} catch {
vm.writeFile(chainIdPath, vm.toString(chainId));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment