Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
github-merge-queue[bot] committed May 2, 2024
1 parent 5ec5f50 commit 2a62fa6
Show file tree
Hide file tree
Showing 11 changed files with 240 additions and 340 deletions.
2 changes: 1 addition & 1 deletion charts/celestia-node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.3.0
version: 0.3.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
10 changes: 4 additions & 6 deletions charts/celestia-node/files/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
AdvertiseInterval = "22h0m0s"

[Header]
TrustedHash = ""
TrustedHash = {{ .Values.config.trustedHash | quote }}
TrustedPeers = []
[Header.Store]
StoreCacheSize = 4096
Expand All @@ -90,18 +90,16 @@
RangeRequestTimeout = "8s"
{{- end }}

{{- if eq .Values.config.type "light" }}
[DASer]
SamplingRange = 100
ConcurrencyLimit = 16
BackgroundStoreInterval = "10m0s"
SampleFrom = 1
SampleFrom = {{ toString .Values.config.startHeight | replace "\"" "" }}
{{- if eq .Values.config.type "light" }}
ConcurrencyLimit = 16
SampleTimeout = "4m0s"
{{- else if eq .Values.config.type "full" }}
SamplingRange = 100
ConcurrencyLimit = 6
BackgroundStoreInterval = "10m0s"
SampleFrom = 1
SampleTimeout = "3m0s"
{{- end }}

Expand Down
2 changes: 1 addition & 1 deletion charts/celestia-node/files/scripts/start-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export CELESTIA_CUSTOM=$CELESTIA_CUSTOM_TO_BE
exec /bin/celestia {{ .Values.config.type }} start \
--node.store /celestia \
{{- if not .Values.config.tokenAuthLevel }}
--rpc.skipAuth \
--rpc.skip-auth \
{{- end }}
{{- if not $isCustomNetwork }}
--core.ip {{ .Values.config.coreIp }} \
Expand Down
2 changes: 1 addition & 1 deletion charts/celestia-node/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
containers:
- name: {{ $label }}
image: {{ .Values.images.node }}
command: ["./celestia/scripts/start-node.sh"]
command: ["/celestia/scripts/start-node.sh"]
securityContext:
runAsUser: 10001
runAsGroup: 10001
Expand Down
2 changes: 2 additions & 0 deletions charts/celestia-node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ config:
tokenAuthLevel: read # can set to nil or false to disable rpc auth
coreGrpcPort: 9090
customInfo: ''
startHeight: "1"
trustedHash: "B93BBE20A0FBFDF955811B6420F8433904664D45DB4BF51022BE4200C1A1680D"

images:
pullPolicy: IfNotPresent
Expand Down
226 changes: 226 additions & 0 deletions charts/deploy.just
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
##############################################
## Deploying and Running using Helm and K8s ##
##############################################
defaultNamespace := "astria-dev-cluster"
deploy tool *ARGS:
@just deploy-{{tool}} {{ARGS}}

delete tool *ARGS:
@just delete-{{tool}} {{ARGS}}

load-image image:
kind load docker-image {{image}} --name astria-dev-cluster

deploy-all: deploy-cluster deploy-ingress-controller wait-for-ingress-controller deploy-astria-local wait-for-sequencer (deploy-chart "sequencer-faucet") deploy-dev-rollup wait-for-rollup
delete-all: clean clean-persisted-data

deploy-astria-local namespace=defaultNamespace: (deploy-chart "celestia-local" namespace) (deploy-sequencer)
delete-astria-local namespace=defaultNamespace: (delete-chart "celestia-local" namespace) (delete-sequencer)

[private]
deploy-chart chart namespace=defaultNamespace:
helm install {{chart}}-chart ./charts/{{chart}} --namespace {{namespace}} --create-namespace

[private]
delete-chart chart namespace=defaultNamespace:
helm uninstall {{chart}}-chart --namespace {{namespace}}

[private]
helm-add-if-not-exist repo url:
helm repo list | grep -q {{repo}} || helm repo add {{repo}} {{url}}

deploy-cluster namespace=defaultNamespace:
kind create cluster --config ./dev/kubernetes/kind-cluster-config.yml
@just helm-add-if-not-exist cilium https://helm.cilium.io/
helm install cilium cilium/cilium --version 1.14.3 \
-f ./dev/values/cilium.yml \
--namespace kube-system
kubectl create namespace {{namespace}}

deploy-ingress-controller:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml

[private]
deploy-celestia-local namespace=defaultNamespace: (deploy-chart "celestia-local" namespace)

[private]
delete-celestia-local namespace=defaultNamespace: (delete-chart "celestia-local" namespace)

deploy-secrets-store:
@just helm-add-if-not-exist secrets-store-csi-driver https://kubernetes-sigs.github.io/secrets-store-csi-driver/charts
helm install csi-secrets-store secrets-store-csi-driver/secrets-store-csi-driver --namespace kube-system

delete-secrets-store:
@just delete chart csi-secrets-store kube-system

wait-for-ingress-controller:
while ! kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=600s; do \
sleep 1; \
done

validatorName := "single"
deploy-sequencer name=validatorName:
helm dependency update charts/sequencer > /dev/null
helm install --debug \
{{ replace('-f dev/values/validators/#.yml' , '#', name) }} \
-n astria-validator-{{name}} --create-namespace \
{{name}}-sequencer-chart ./charts/sequencer
deploy-sequencers: (deploy-sequencer "node0") (deploy-sequencer "node1") (deploy-sequencer "node2")

deploy-hermes-local:
helm install hermes-local-chart ./charts/hermes \
-n astria-dev-cluster \
-f dev/values/hermes/local.yml
delete-hermes-local:
@just delete chart hermes-local

delete-sequencer name=validatorName:
@just delete chart {{name}}-sequencer astria-validator-{{name}}
delete-sequencers: (delete-sequencer "node0") (delete-sequencer "node1") (delete-sequencer "node2")

wait-for-sequencer:
kubectl wait -n astria-dev-cluster deployment celestia-local --for=condition=Available=True --timeout=600s
kubectl rollout status --watch statefulset/sequencer -n astria-dev-cluster --timeout=600s

defaultRollupName := "astria"
defaultNetworkId := ""
defaultGenesisAllocAddress := ""
defaultPrivateKey := ""
defaultSequencerStartBlock := ""
deploy-rollup rollupName=defaultRollupName networkId=defaultNetworkId genesisAllocAddress=defaultGenesisAllocAddress privateKey=defaultPrivateKey sequencerStartBlock=defaultSequencerStartBlock:
helm dependency update charts/evm-rollup > /dev/null
helm install \
{{ if rollupName != '' { replace('--set config.rollup.name=# --set celestia-node.config.labelPrefix=#', '#', rollupName) } else { '' } }} \
{{ if networkId != '' { replace('--set config.rollup.networkId=#', '#', networkId) } else { '' } }} \
{{ if genesisAllocAddress != '' { replace('--set config.rollup.genesisAccounts[0].address=#', '#', genesisAllocAddress) } else { '' } }} \
{{ if privateKey != '' { replace('--set config.faucet.privateKey=#', '#', privateKey) } else { '' } }} \
{{ if sequencerStartBlock != '' { replace('--set config.sequencer.initialBlockHeight=#', '#', sequencerStartBlock) } else { '' } }} \
{{rollupName}}-chain-chart ./charts/evm-rollup --namespace astria-dev-cluster

deploy-dev-rollup rollupName=defaultRollupName networkId=defaultNetworkId genesisAllocAddress=defaultGenesisAllocAddress privateKey=defaultPrivateKey sequencerStartBlock=defaultSequencerStartBlock:
helm dependency update charts/evm-rollup > /dev/null
helm install \
{{ if rollupName != '' { replace('--set config.rollup.name=# --set celestia-node.config.labelPrefix=#', '#', rollupName) } else { '' } }} \
{{ if networkId != '' { replace('--set config.rollup.networkId=#', '#', networkId) } else { '' } }} \
{{ if genesisAllocAddress != '' { replace('--set config.rollup.genesisAccounts[0].address=#', '#', genesisAllocAddress) } else { '' } }} \
{{ if privateKey != '' { replace('--set config.faucet.privateKey=#', '#', privateKey) } else { '' } }} \
{{ if sequencerStartBlock != '' { replace('--set config.sequencer.initialBlockHeight=#', '#', sequencerStartBlock) } else { '' } }} \
-f dev/values/rollup/dev.yaml \
{{rollupName}}-chain-chart ./charts/evm-rollup --namespace astria-dev-cluster

delete-rollup rollupName=defaultRollupName:
@just delete chart {{rollupName}}-chain

wait-for-rollup rollupName=defaultRollupName:
kubectl rollout status --watch statefulset/{{rollupName}}-geth -n astria-dev-cluster --timeout=600s

defaultHypAgentConfig := ""
defaultHypRelayerPrivateKey := ""
defaultHypValidatorPrivateKey := ""
deploy-hyperlane-agents rollupName=defaultRollupName agentConfig=defaultHypAgentConfig relayerPrivateKey=defaultHypRelayerPrivateKey validatorPrivateKey=defaultHypValidatorPrivateKey:
helm install --debug \
{{ if rollupName != '' { replace('--set config.name=# --set global.namespace=#-dev-cluster', '#', rollupName) } else { '' } }} \
{{ if agentConfig != '' { replace('--set config.agentConfig=#', '#', agentConfig) } else { '' } }} \
{{ if relayerPrivateKey != '' { replace('--set config.relayer.privateKey=#', '#', relayerPrivateKey) } else { '' } }} \
{{ if validatorPrivateKey != '' { replace('--set config.validator.privateKey=#', '#', validatorPrivateKey) } else { '' } }} \
{{rollupName}}-hyperlane-agents-chart ./charts/hyperlane-agents --namespace astria-dev-cluster

delete-hyperlane-agents rollupName=defaultRollupName:
@just delete {{rollupName}}-hyperlane-agents

clean:
kind delete cluster --name astria-dev-cluster

clean-persisted-data:
rm -r /tmp/astria

deploy-local-metrics:
kubectl apply -f kubernetes/metrics-server-local.yml

defaultTag := ""

deploy-smoke-test tag=defaultTag:
@echo "Deploying ingress controller..." && just deploy-ingress-controller > /dev/null
@just wait-for-ingress-controller > /dev/null
@echo "Deploying local celestia instance..." && just deploy celestia-local > /dev/null
@helm dependency update charts/sequencer > /dev/null
@helm dependency update charts/evm-rollup > /dev/null
@echo "Setting up single astria sequencer..." && helm install \
-n astria-validator-single single-sequencer-chart ./charts/sequencer \
-f dev/values/validators/single.yml \
{{ if tag != '' { replace('--set images.sequencer.devTag=# --set sequencer-relayer.images.sequencerRelayer.devTag=#', '#', tag) } else { '' } }} \
--create-namespace > /dev/null
@just wait-for-sequencer > /dev/null
@echo "Starting EVM rollup..." && helm install -n astria-dev-cluster astria-chain-chart ./charts/evm-rollup -f dev/values/rollup/dev.yaml \
{{ if tag != '' { replace('--set images.conductor.devTag=# --set images.composer.devTag=#', '#', tag) } else { '' } }} \
--set config.blockscout.enabled=false \
--set config.faucet.enabled=false > /dev/null
@just wait-for-rollup > /dev/null
@sleep 15

run-smoke-test:
#!/usr/bin/env bash
ETH_RPC_URL="http://executor.astria.localdev.me/"
MAX_RUNS=30
echo "Testing Transfer..."
TRANSFER_RUNS=0
EXPECTED_BALANCE=1000000000000000000
curl -X POST $ETH_RPC_URL -s -d '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0xf86d80843c54e7f182520894830b0e9bb0b1ebad01f2805278ede64c69e068fe880de0b6b3a764000080820a96a045cac19cec50c92e356c665172ec70de5f3cd3721ba09bf3cbad1976d3e83487a00ff4d49607db9ac3c4bb71160be41600f8d1b56ac20b092c0e042f0d226e5277"],"id":1}' -H 'Content-Type: application/json' -s
balance() {
HEX_NUM=$(curl -X POST $ETH_RPC_URL -s -d '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x830B0e9Bb0B1ebad01F2805278Ede64c69e068FE", "latest"],"id":1}' -H 'Content-Type: application/json' | jq -r '.result')
echo "$(printf "%d" $HEX_NUM)"
}
while [ $TRANSFER_RUNS -lt $MAX_RUNS ]; do
if [ $(balance) -eq $EXPECTED_BALANCE ]; then
echo "Transfer success"
break
else
sleep 1
fi
TRANSFER_RUNS=$((TRANSFER_RUNS+1))
done
if [ $TRANSFER_RUNS -eq $MAX_RUNS ]; then
echo "Transfer failure"
exit 1
fi
echo "Testing soft commits..."
SOFT_RUNS=0
soft() {
HEX_NUM=$(curl -X POST $ETH_RPC_URL -s -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["safe", false],"id":1}' -H 'Content-Type: application/json' | jq -r '.result.number')
echo "$(printf "%d" $HEX_NUM)"
}
while [ $SOFT_RUNS -lt $MAX_RUNS ]; do
if [ $(soft) -gt 0 ]; then
echo "Soft commit success"
break
else
sleep 1
fi
SOFT_RUNS=$((SOFT_RUNS+1))
done

echo "Testing finalization..."
FINALIZED_RUNS=0
finalized() {
HEX_NUM=$(curl -X POST $ETH_RPC_URL -s -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["finalized", false],"id":1}' -H 'Content-Type: application/json' | jq -r '.result.number')
echo "$(printf "%d" $HEX_NUM)"
}
while [ $FINALIZED_RUNS -lt $MAX_RUNS ]; do
FINAL=$(finalized)
if [ $FINAL -gt 0 ]; then
echo "Finalized success"
exit 0
else
sleep 1
fi
echo "Finalized block: $FINAL, Check number: $FINALIZED_RUNS"
FINALIZED_RUNS=$((FINALIZED_RUNS+1))
done
echo "Finalization failure"
exit 1

delete-smoke-test:
just delete celestia-local
just delete sequencer
just delete rollup
6 changes: 3 additions & 3 deletions charts/evm-rollup/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: celestia-node
repository: file://../celestia-node
version: 0.3.0
digest: sha256:11880d5ac9449bd674625fe78e6af327ba9b8fadacbfe2b43d53f849c80a9860
generated: "2024-04-26T14:51:12.590892-07:00"
version: 0.3.1
digest: sha256:ad93a19d54455cd6d3abaf20a2e9a662d986651998f81089983da6744435c5ff
generated: "2024-05-02T15:44:33.852501-07:00"
4 changes: 2 additions & 2 deletions charts/evm-rollup/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.15.1
version: 0.15.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand All @@ -25,7 +25,7 @@ appVersion: "0.10.0"

dependencies:
- name: celestia-node
version: "0.3.0"
version: "0.3.1"
repository: "file://../celestia-node"
condition: celestia-node.enabled

Expand Down
Loading

0 comments on commit 2a62fa6

Please sign in to comment.