Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Log keys/addresses for chain operator roles for Local L1 & readme updates #108

Merged
merged 4 commits into from
Dec 13, 2024
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
13 changes: 13 additions & 0 deletions .github/tests/op-geth-reth-custom-batcher.yaml
Original file line number Diff line number Diff line change
@@ -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]
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 <enclave-name>
```

* Inspect chain state.

```
kurtosis files inspect <enclave-name> 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 <enclave-name> -- dumps all files to a enclave-name prefixed directory under the current directory
kurtosis files download <enclave-name> op-deployer-configs <where-to-download>
```

* Get logs for running services

```
kurtosis service logs <enclave-name> <service-name> -f . (-f tails the log)
```

* Stop/Start running service (restart sequencer/batcher/op-geth etc.)

```
kurtosis service stop <enclave-name> <service-name>
kurtosis service start <enclave-name> <service-name>
```
2 changes: 2 additions & 0 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion src/contracts/contract_deployer.star
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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(
Expand Down
50 changes: 32 additions & 18 deletions static_files/scripts/fund.sh
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -19,22 +20,35 @@ 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
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}"

wallets_json=$(echo "$wallets_json" | jq \
--arg role "$role" \
--arg private_key "$private_key" \
--arg 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
done

echo "Wallet private key and addresses"
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"
Loading