From 4cb25c069c382fdd9a3a3f4f7a4b395663cb7310 Mon Sep 17 00:00:00 2001 From: Vinod Damle <5338861+vdamle@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:10:21 -0500 Subject: [PATCH 1/4] Local: Log keys/addresses for chain operator roles & readme updates * Log private keys and addresses for Chain Operator roles when running a local L1. Removed trace logs in bash script fund.sh since the relevant info is now logged. * Log L1 faucet private key and address * Log L2 faucet private key and address (useful for running tx-fuzz) * Updates to readme with info on helpful kurtosis commands for inspecting local state. --- README.md | 42 ++++++++++++++++++++++++++-- main.star | 2 ++ src/contracts/contract_deployer.star | 3 +- static_files/scripts/fund.sh | 39 +++++++++++++++----------- 4 files changed, 66 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 9fba42dc..102b40c3 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,7 @@ optimism_package: # op-geth # op-reth el_builder_type: "" - + # The Docker image that should be used for the builder EL client; leave blank to use the default for the client type # Defaults by client: # - op-geth: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:latest @@ -297,7 +297,7 @@ optimism_package: # A list of optional extra params that will be passed to the batcher container for modifying its behaviour extra_params: [] - + # Default MEV configuration mev_params: # The Docker image that should be used for rollup boost; leave blank to use the default rollup-boost image @@ -497,3 +497,41 @@ optimism_package: ### Additional configurations Please find examples of additional configurations in the [test folder](.github/tests/). + +### Useful Kurtosis commands + +#### Inspect enclave -- Container/Port information + +* List information about running containers and open ports + +``` +kurtosis enclave ls +kurtosis enclave inspect +``` + +* Inspect chain state. + +``` +kurtosis files inspect op-deployer-configs +``` + +* Dump all files generated by kurtosis to disk (for inspecting chain state/deploy configs/contract addresses etc.). A file that contains an exhaustive + set of information about the current deployment is `files/op-deployer-configs/state.json`. Deployed contract address, roles etc can all be found here. + +``` +kurtosis enclave dump -- dumps all files to a enclave-name prefixed directory under the current directory +kurtosis files download op-deployer-configs +``` + +* Get logs for running services + +``` +kurtosis service logs -f . (-f tails the log) +``` + +* Stop/Start running service (restart sequencer/batcher/op-geth etc.) + +``` +kurtosis service stop +kurtosis service start +``` diff --git a/main.star b/main.star index 36624695..dbc16209 100644 --- a/main.star +++ b/main.star @@ -56,6 +56,7 @@ def run(plan, args): plan.print(l1.network_params) # Get L1 info all_l1_participants = l1.all_participants + l1_network = "local" l1_network_params = l1.network_params l1_network_id = l1.network_id l1_rpc_url = all_l1_participants[0].el_context.rpc_http_url @@ -78,6 +79,7 @@ def run(plan, args): l1_priv_key, l1_config_env_vars, optimism_args_with_right_defaults, + l1_network ) for chain in optimism_args_with_right_defaults.chains: diff --git a/src/contracts/contract_deployer.star b/src/contracts/contract_deployer.star index c93c2f9c..049fea8b 100644 --- a/src/contracts/contract_deployer.star +++ b/src/contracts/contract_deployer.star @@ -14,6 +14,7 @@ def deploy_contracts( priv_key, l1_config_env_vars, optimism_args, + l1_network ): l2_chain_ids = ",".join( [str(chain.network_params.network_id) for chain in optimism_args.chains] @@ -163,7 +164,7 @@ def deploy_contracts( name="op-deployer-fund", description="Collect keys, and fund addresses", image=utils.DEPLOYMENT_UTILS_IMAGE, - env_vars={"PRIVATE_KEY": str(priv_key), "FUND_VALUE": "10ether"} + env_vars={"PRIVATE_KEY": str(priv_key), "FUND_VALUE": "10ether", "L1_NETWORK": str(l1_network)} | l1_config_env_vars, store=[ StoreSpec( diff --git a/static_files/scripts/fund.sh b/static_files/scripts/fund.sh index 37e83435..aa4088cf 100644 --- a/static_files/scripts/fund.sh +++ b/static_files/scripts/fund.sh @@ -1,12 +1,13 @@ #!/usr/bin/env bash -set -euxo pipefail +set -euo pipefail export ETH_RPC_URL="$L1_RPC_URL" addr=$(cast wallet address "$PRIVATE_KEY") nonce=$(cast nonce "$addr") mnemonic="test test test test test test test test test test test junk" +roles=("proposer" "batcher" "sequencer" "challenger" "L2ProxyAdmin" "L1ProxyAdmin" "BaseFeeVaultRecipient" "L1FeeVaultRecipient" "SequencerFeeVaultRecipient" "SystemConfigOwner") IFS=',';read -r -a chain_ids <<< "$1" @@ -20,21 +21,25 @@ send() { } for chain_id in "${chain_ids[@]}"; do - proposer_priv=$(cast wallet private-key "$mnemonic" "m/44'/60'/2'/$chain_id/1") - proposer_addr=$(cast wallet address "$proposer_priv") - write_keyfile "$proposer_addr" "$proposer_priv" "proposer-$chain_id" - batcher_priv=$(cast wallet private-key "$mnemonic" "m/44'/60'/2'/$chain_id/2") - batcher_addr=$(cast wallet address "$batcher_priv") - write_keyfile "$batcher_addr" "$batcher_priv" "batcher-$chain_id" - sequencer_priv=$(cast wallet private-key "$mnemonic" "m/44'/60'/2'/$chain_id/3") - sequencer_addr=$(cast wallet address "$sequencer_priv") - write_keyfile "$sequencer_addr" "$sequencer_priv" "sequencer-$chain_id" - challenger_priv=$(cast wallet private-key "$mnemonic" "m/44'/60'/2'/$chain_id/4") - challenger_addr=$(cast wallet address "$challenger_priv") - write_keyfile "$challenger_addr" "$challenger_priv" "challenger-$chain_id" - send "$proposer_addr" - send "$batcher_addr" - send "$challenger_addr" + for index in "${!roles[@]}"; do + role="${roles[$index]}" + role_idx=$((index+1)) + + # Skip wallet addrs for anything other Proposer/Batcher/Sequencer/Challenger if not on local L1 + if [[ "${L1_NETWORK}" != "local" && $role_idx -gt 4 ]]; then + continue + fi + + private_key=$(cast wallet private-key "$mnemonic" "m/44'/60'/2'/$chain_id/$role_idx") + address=$(cast wallet address "${private_key}") + write_keyfile "${address}" "${private_key}" "${role}-$chain_id" + send "${address}" + + echo "${role} on chain $chain_id, private key:"${private_key}", address:"${address}"" + done cat "/network-data/genesis-$chain_id.json" | jq --from-file /fund-script/gen2spec.jq > "/network-data/chainspec-$chain_id.json" -done \ No newline at end of file +done + +echo "L1 faucet private key:"0x${PRIVATE_KEY}", address:"${addr}"" +echo "L2 faucet private key:"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", address:"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"" From 9ae4b66a323210a371af1f9f4279206315d462ec Mon Sep 17 00:00:00 2001 From: Vinod Damle <5338861+vdamle@users.noreply.github.com> Date: Wed, 11 Dec 2024 18:09:01 -0500 Subject: [PATCH 2/4] Add sample config for geth/reth with custom batcher config used in holocene awareness testing issue#12122 --- .github/tests/op-geth-reth-custom-batcher.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/tests/op-geth-reth-custom-batcher.yaml diff --git a/.github/tests/op-geth-reth-custom-batcher.yaml b/.github/tests/op-geth-reth-custom-batcher.yaml new file mode 100644 index 00000000..3143958f --- /dev/null +++ b/.github/tests/op-geth-reth-custom-batcher.yaml @@ -0,0 +1,13 @@ +optimism_package: + chains: + - participants: + - el_type: op-geth + cl_type: op-node + - el_type: op-reth + cl_type: op-node + network_params: + fjord_time_offset: 0 + granite_time_offset: 0 + holocene_time_offset: 100 + batcher_params: + extra_params: [--max-channel-duration=60, --max-l1-tx-size-bytes=10000, --target-num-frames=5, --data-availability-type=calldata, --batch-type=0] From e7399a483d655bdac9dd685a725d568f866fe2ec Mon Sep 17 00:00:00 2001 From: Vinod Damle <5338861+vdamle@users.noreply.github.com> Date: Thu, 12 Dec 2024 12:50:51 -0500 Subject: [PATCH 3/4] Output wallet keys/addresses as JSON and write to file * key/addresses are written to `wallets.json` * fixed camel case naming for roles --- static_files/scripts/fund.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/static_files/scripts/fund.sh b/static_files/scripts/fund.sh index aa4088cf..43ad49f0 100644 --- a/static_files/scripts/fund.sh +++ b/static_files/scripts/fund.sh @@ -7,7 +7,7 @@ export ETH_RPC_URL="$L1_RPC_URL" addr=$(cast wallet address "$PRIVATE_KEY") nonce=$(cast nonce "$addr") mnemonic="test test test test test test test test test test test junk" -roles=("proposer" "batcher" "sequencer" "challenger" "L2ProxyAdmin" "L1ProxyAdmin" "BaseFeeVaultRecipient" "L1FeeVaultRecipient" "SequencerFeeVaultRecipient" "SystemConfigOwner") +roles=("proposer" "batcher" "sequencer" "challenger" "l2ProxyAdmin" "l1ProxyAdmin" "baseFeeVaultRecipient" "l1FeeVaultRecipient" "sequencerFeeVaultRecipient" "systemConfigOwner") IFS=',';read -r -a chain_ids <<< "$1" @@ -20,6 +20,8 @@ send() { nonce=$((nonce+1)) } +# Create a JSON object to store all the wallet addresses and private keys, start with an empty one +wallets_json=$(jq -n '{}') for chain_id in "${chain_ids[@]}"; do for index in "${!roles[@]}"; do role="${roles[$index]}" @@ -35,11 +37,18 @@ for chain_id in "${chain_ids[@]}"; do write_keyfile "${address}" "${private_key}" "${role}-$chain_id" send "${address}" - echo "${role} on chain $chain_id, private key:"${private_key}", address:"${address}"" - done + wallets_json=$(echo "$wallets_json" | jq \ + --arg role "$role" \ + --arg private_key "$private_key" \ + --arg address "$address" \ + '.[$role + "_private_key"] = $private_key | .[$role + "_address"] = $address') + done cat "/network-data/genesis-$chain_id.json" | jq --from-file /fund-script/gen2spec.jq > "/network-data/chainspec-$chain_id.json" done -echo "L1 faucet private key:"0x${PRIVATE_KEY}", address:"${addr}"" -echo "L2 faucet private key:"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", address:"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"" +echo "Wallet private key and addresses" +wallets_json=$(echo "$wallets_json" | jq --arg addr "$addr" --arg private_key "0x$PRIVATE_KEY" '.["l1_faucet_private_key"] = $private_key | .["l1_faucet_address"] = $addr') +wallets_json=$(echo "$wallets_json" | jq --arg addr "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" --arg private_key "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" '.["l2_faucet_private_key"] = $private_key | .["l2_faucet_address"] = $addr') +echo "$wallets_json" > "/network-data/wallets.json" +echo "$wallets_json" From 47e85eb89e7cffb1ddc29a49f1a22c2d75d960a5 Mon Sep 17 00:00:00 2001 From: Vinod Damle <5338861+vdamle@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:27:14 -0500 Subject: [PATCH 4/4] camelCase entire key --- static_files/scripts/fund.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/static_files/scripts/fund.sh b/static_files/scripts/fund.sh index 43ad49f0..84273dd6 100644 --- a/static_files/scripts/fund.sh +++ b/static_files/scripts/fund.sh @@ -41,14 +41,14 @@ for chain_id in "${chain_ids[@]}"; do --arg role "$role" \ --arg private_key "$private_key" \ --arg address "$address" \ - '.[$role + "_private_key"] = $private_key | .[$role + "_address"] = $address') + '.[$role + "PrivateKey"] = $private_key | .[$role + "Address"] = $address') done cat "/network-data/genesis-$chain_id.json" | jq --from-file /fund-script/gen2spec.jq > "/network-data/chainspec-$chain_id.json" done echo "Wallet private key and addresses" -wallets_json=$(echo "$wallets_json" | jq --arg addr "$addr" --arg private_key "0x$PRIVATE_KEY" '.["l1_faucet_private_key"] = $private_key | .["l1_faucet_address"] = $addr') -wallets_json=$(echo "$wallets_json" | jq --arg addr "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" --arg private_key "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" '.["l2_faucet_private_key"] = $private_key | .["l2_faucet_address"] = $addr') +wallets_json=$(echo "$wallets_json" | jq --arg addr "$addr" --arg private_key "0x$PRIVATE_KEY" '.["l1FaucetPrivateKey"] = $private_key | .["l1FaucetAddress"] = $addr') +wallets_json=$(echo "$wallets_json" | jq --arg addr "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" --arg private_key "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" '.["l2FaucetPrivateKey"] = $private_key | .["l2FaucetAddress"] = $addr') echo "$wallets_json" > "/network-data/wallets.json" echo "$wallets_json"