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

feat: Infra init #8

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from
Draft
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
11 changes: 11 additions & 0 deletions infra/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Infra

This folder is for scripts and configuration for our hosted sigil cluster.

The cluster is hosted on digital ocean and consists of 4 pods: `op-geth`, `op-node`, `op-batcher`, and `op-proposer`. The `op-geth` binary is from our [ethereum-optimism/op-geth fork](https://github.com/unattended-backpack/op-geth/) and the rest of the binaries `op-node`, `op-batcher`, and `op-proposer` are from our [ethereum-optimism/optimism fork](https://github.com/unattended-backpack/optimism).

This cluster is primarily for development work at the moment.

## deployments.yml

This is the cluster deploy script. It can be run with `kubectl apply -f deployments.yml`.
291 changes: 291 additions & 0 deletions infra/deployments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
---
apiVersion: v1
kind: Service
metadata:
name: op-geth
spec:
ports:
- port: 8545
name: http-rpc
targetPort: 8545
- port: 8546
name: ws
targetPort: 8546
- port: 8551
name: auth-rpc
targetPort: 8551
selector:
app: op-geth
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: op-geth
spec:
serviceName: op-geth
replicas: 1
selector:
matchLabels:
app: op-geth
template:
metadata:
labels:
app: op-geth
spec:
initContainers:
- name: geth init datadir
image: registry.digitalocean.com/sigil/op-geth:latest
command:
- /bin/sh
- -c
- |
if [ ! -d "/datadir" ]; then
geth init --datadir=/datadir --state.scheme=hash genesis.json
else
fi
containers:
- name: op-geth
image: registry.digitalocean.com/sigil/op-geth:latest
ports:
- containerPort: 8545
- containerPort: 8546
- containerPort: 8551
volumeMounts:
- name: geth-storage
mountPath: /app/datadir
- name: jwt-secret
mountPath: /app/jwt.txt
subPath: jwt.txt
args:
- --datadir=/app/datadir
- --http
- --http.corsdomain=*
- --http.vhosts=*
- --http.addr=0.0.0.0
- --http.api=web3,debug,eth,txpool,net,engine
- --ws
- --ws.addr=0.0.0.0
- --ws.port=8546
- --ws.origins=*
- --ws.api=debug,eth,txpool,net,engine
- --syncmode=full
- --gcmode=archive
- --nodiscover
- --maxpeers=0
- --networkid=42069
- --authrpc.vhosts=*
- --authrpc.addr=0.0.0.0
- --authrpc.port=8551
- --authrpc.jwtsecret=/app/jwt.txt
- --rollup.disabletxpoolgossip=true
volumes:
- name: jwt-secret
secret:
secretName: op-stack-secrets
items:
- key: jwt.txt
path: jwt.txt
volumeClaimTemplates:
- metadata:
name: geth-storage
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 100Gi
---
apiVersion: v1
kind: Service
metadata:
name: op-node
spec:
ports:
- port: 9545
name: rpc
selector:
app: op-node
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: op-node
spec:
replicas: 1
selector:
matchLabels:
app: op-node
template:
metadata:
labels:
app: op-node
spec:
containers:
- name: op-node
image: registry.digitalocean.com/sigil/op-node:latest
ports:
- containerPort: 9545
volumeMounts:
- name: jwt-secret
mountPath: /app/jwt.txt
subPath: jwt.txt
- name: rollup-config
mountPath: /app/rollup.json
subPath: rollup.json
env:
- name: GS_SEQUENCER_PRIVATE_KEY
valueFrom:
secretKeyRef:
name: op-stack-secrets
key: sequencer-key
- name: L1_RPC_URL
valueFrom:
secretKeyRef:
name: op-stack-secrets
key: l1-rpc-url
- name: L1_RPC_KIND
valueFrom:
secretKeyRef:
name: op-stack-secrets
key: l1-rpc-kind
- name: L1_BEACON_RPC_URL
valueFrom:
secretKeyRef:
name: op-stack-secrets
key: l1-beacon-rpc-url
args:
- --l2=http://op-geth:8551
- --l2.jwt-secret=/app/jwt.txt
- --l1.beacon=$(L1_BEACON_RPC_URL)
- --sequencer.enabled
- --sequencer.l1-confs=5
- --verifier.l1-confs=4
- --rollup.config=/app/rollup.json
- --rpc.addr=0.0.0.0
- --p2p.disable
- --rpc.enable-admin
- --p2p.sequencer.key=$(GS_SEQUENCER_PRIVATE_KEY)
- --l1=$(L1_RPC_URL)
- --l1.rpckind=$(L1_RPC_KIND)
volumes:
- name: jwt-secret
secret:
secretName: op-stack-secrets
items:
- key: jwt.txt
path: jwt.txt
- name: rollup-config
configMap:
name: op-stack-config
items:
- key: rollup.json
path: rollup.json
---
apiVersion: v1
kind: Service
metadata:
name: op-batcher
spec:
ports:
- port: 8548
name: rpc
selector:
app: op-batcher
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: op-batcher
spec:
replicas: 1
selector:
matchLabels:
app: op-batcher
template:
metadata:
labels:
app: op-batcher
spec:
containers:
- name: op-batcher
image: registry.digitalocean.com/sigil/op-batcher:latest
ports:
- containerPort: 8548
env:
- name: GS_BATCHER_PRIVATE_KEY
valueFrom:
secretKeyRef:
name: op-stack-secrets
key: batcher-key
- name: L1_RPC_URL
valueFrom:
secretKeyRef:
name: op-stack-secrets
key: l1-rpc-url
args:
- --l2-eth-rpc=http://op-geth:8545
- --rollup-rpc=http://op-node:9545
- --poll-interval=1s
- --sub-safety-margin=6
- --num-confirmations=1
- --safe-abort-nonce-too-low-count=3
- --resubmission-timeout=30s
- --rpc.addr=0.0.0.0
- --rpc.port=8548
- --rpc.enable-admin
- --max-channel-duration=25
- --l1-eth-rpc=$(L1_RPC_URL)
- --private-key=$(GS_BATCHER_PRIVATE_KEY)
---
apiVersion: v1
kind: Service
metadata:
name: op-proposer
spec:
ports:
- port: 8560
name: rpc
selector:
app: op-proposer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: op-proposer
spec:
replicas: 1
selector:
matchLabels:
app: op-proposer
template:
metadata:
labels:
app: op-proposer
spec:
containers:
- name: op-proposer
image: registry.digitalocean.com/sigil/op-proposer:latest
ports:
- containerPort: 8560
env:
- name: GS_PROPOSER_PRIVATE_KEY
valueFrom:
secretKeyRef:
name: op-stack-secrets
key: proposer-key
- name: L1_RPC_URL
valueFrom:
secretKeyRef:
name: op-stack-secrets
key: l1-rpc-url
- name: L2OO_ADDRESS
valueFrom:
secretKeyRef:
name: op-stack-secrets
key: l2oo-address
args:
- --poll-interval=12s
- --rpc.port=8560
- --rollup-rpc=http://op-node:9545
- --l2oo-address=$(L2OO_ADDRESS)
- --private-key=$(GS_PROPOSER_PRIVATE_KEY)
- --l1-eth-rpc=$(L1_RPC_URL)
41 changes: 41 additions & 0 deletions sigil/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sigil/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ tracing-subscriber = { version = "0.3.17", features = [
"env-filter",
] }
toml = "0.8.19"
serial_test = "3.1.1"
4 changes: 3 additions & 1 deletion sigil/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ It is our hope that we have successfully encapsulated this admittedly-convoluted

## Testing

Once built, the project may be tested as usual using the standard `cargo test`. Some integration tests rely on the ability to access a Docker image of the client to test inter-client communications.
Once built, the project may be tested as usual using the standard `cargo test`. Some integration tests rely on the ability to access a Docker image of the client to test inter-client communications.

* If the tests are manually cancelled, make sure to also manually stop any docker containers started by the test.

## Running

Expand Down
8 changes: 8 additions & 0 deletions sigil/distribute.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
./build
# nodea
echo "copying binary to nodea"
scp target/debug/sigil [email protected]:~/
# nodeb
echo "copying binary to nodeb"
scp target/debug/sigil [email protected]:~/
echo "\ndone! :)"
Loading