Skip to content
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
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# syntax=docker/dockerfile:1
FROM ghcr.io/foundry-rs/foundry:v1.4.2

# Install dependencies (jq)
USER root
RUN apt-get update && \
apt-get install -y jq
USER foundry

# Copy code into container
WORKDIR /app
COPY . .
Expand Down
18 changes: 18 additions & 0 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,23 @@ forge script script/Predeploys.s.sol:Predeploys \
--chain-id $CHAIN_ID \
> /dev/null

# Minify the chainConfig property in the generated genesis file
# NOTE: we need to minify the chainConfig because nitro will use it to obtain the genesis blockhash,
# and if there are any unnecessary whitespaces, the blockhash will be different from what is found on-chain.
PLACEHOLDER="__CONFIG_MINIFIED__"
GENESIS_FILE="genesis/genesis.json"
config_minified=$(jq -c '.config' "$GENESIS_FILE")

# Set the placeholder in the chainConfig property and save the result
tmp=$(mktemp)
jq --arg ph "$PLACEHOLDER" '.config = $ph' "$GENESIS_FILE" | jq '.' > "$tmp"

# Replace the placeholder with the minified config
awk -v ph="\"$PLACEHOLDER\"" -v rep="$config_minified" '
{ sub(ph, rep); print }
' "$tmp" > "$GENESIS_FILE"

rm "$tmp"

# Output the generated genesis file
cat genesis/genesis.json
34 changes: 2 additions & 32 deletions genesis/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,41 +236,11 @@
}
},
"coinbase": "0x0000000000000000000000000000000000000000",
"config": {
"chainId": 31337,
"homesteadBlock": 0,
"daoForkBlock": null,
"daoForkSupport": true,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"muirGlacierBlock": 0,
"berlinBlock": 0,
"londonBlock": 0,
"clique": {
"period": 0,
"epoch": 0
},
"arbitrum": {
"EnableArbOS": true,
"AllowDebugPrecompiles": false,
"DataAvailabilityCommittee": false,
"InitialArbOSVersion": 40,
"InitialChainOwner": "0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E",
"GenesisBlockNum": 0,
"MaxCodeSize": 24576,
"MaxInitCodeSize": 49152
}
},
"config": {"chainId":31337,"homesteadBlock":0,"daoForkBlock":null,"daoForkSupport":true,"eip150Block":0,"eip150Hash":"0x0000000000000000000000000000000000000000000000000000000000000000","eip155Block":0,"eip158Block":0,"byzantiumBlock":0,"constantinopleBlock":0,"petersburgBlock":0,"istanbulBlock":0,"muirGlacierBlock":0,"berlinBlock":0,"londonBlock":0,"clique":{"period":0,"epoch":0},"arbitrum":{"EnableArbOS":true,"AllowDebugPrecompiles":false,"DataAvailabilityCommittee":false,"InitialArbOSVersion":40,"InitialChainOwner":"0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E","GenesisBlockNum":0}},
"difficulty": "0x1",
"extraData": "0x",
"gasLimit": "0x1C9C380",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0",
"timestamp": "0x0"
}
}
2 changes: 1 addition & 1 deletion script/Predeploys.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ contract Predeploys is Script {
vm.toString(arbOSVersion),
',"InitialChainOwner":"',
vm.toString(chainOwner),
'","GenesisBlockNum":0,"MaxCodeSize":24576,"MaxInitCodeSize":49152}}'
'","GenesisBlockNum":0}}'
)
);
vm.serializeString(genesisJson, "nonce", "0x0");
Expand Down