• Matthew Slipper's avatar
    ctb: Fix data race in generate-l2-genesis · 9bb13a09
    Matthew Slipper authored
    Forge reads the genesis outfile before it is completely written. This leads to errors like the following:
    
    ```
    [FAIL. Reason: setup failed: failed to parse json file: "/root/project/packages/contracts-bedrock/.testdata/genesis.json": EOF while parsing a value at line 1 column 0]
    ```
    
    To fix this, this PR adds a loop at the end of the file that checks if the L2 outfile is over 8 megabytes. This is a hack - a longer term fix would be to investigate why the process Forge calls via `vm.ffi` exits prior to fully writing the file. I tried calling `Sync()` from within the Go code, but it didn't fix the issue.
    9bb13a09
generate-l2-genesis.sh 1.45 KB