Skip to content

Commit

Permalink
Add integration for etherlink
Browse files Browse the repository at this point in the history
  • Loading branch information
puppetninja committed Jul 24, 2024
1 parent 1616ee6 commit 1e971d9
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ node_modules
.devspace/
build

.idea

# Ignore mkchain generated files
*_values.yaml
Expand Down
18 changes: 13 additions & 5 deletions charts/tezos/scripts/smart-rollup-node.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set -ex
set -e

TEZ_VAR=/var/tezos
TEZ_BIN=/usr/local/bin
Expand All @@ -9,12 +9,20 @@ ROLLUP_DATA_DIR_PREIMAGES="$ROLLUP_DATA_DIR/wasm_2_0_0"
xxd -p -c 0 /usr/local/share/tezos/evm_kernel/evm_installer.wasm | tr -d '\n' > /var/tezos/smart-rollup-boot-sector
mkdir -p "$ROLLUP_DATA_DIR_PREIMAGES"
cp /usr/local/share/tezos/evm_kernel/* "$ROLLUP_DATA_DIR_PREIMAGES"
CMD="$TEZ_BIN/octez-smart-rollup-node \

set -x
$TEZ_BIN/octez-smart-rollup-node \
--endpoint http://tezos-node-rpc:8732 \
-d $CLIENT_DIR \
run operator for ${ROLLUP_ADDRESS} with operators ${OPERATORS_PARAMS} \
init operator config for ${ROLLUP_ADDRESS} with operators ${OPERATORS_PARAMS} \
--data-dir ${ROLLUP_DATA_DIR} \
--boot-sector-file /var/tezos/smart-rollup-boot-sector \
--rpc-addr 0.0.0.0"
--rpc-addr 0.0.0.0 \
--force

exec $CMD
CMD="$TEZ_BIN/octez-smart-rollup-node \
--endpoint http://tezos-node-rpc:8732 \
-d $CLIENT_DIR \
run \
--data-dir ${ROLLUP_DATA_DIR}"
exec $CMD
28 changes: 28 additions & 0 deletions charts/tezos/scripts/smart-rollup-snapshot-downloader.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

set -e

data_dir="/var/tezos"
rollup_data_dir="$data_dir/rollup"
snapshot_file=$rollup_data_dir/rollup.snapshot

if [ ! -d "$data_dir" ]; then
echo "ERROR: /var/tezos doesn't exist. There should be a volume mounted."
exit 1
fi

if [ -e "$rollup_data_dir/storage/l2_blocks/data" ]; then
echo "Smart rollup snapshot has already been imported. Exiting."
exit 0
fi

# if [ -e "${snapshot_file}" ]; then
# echo "Temporary - snapshot file already dl'd, not doing it again"
# exit 0
# fi

echo "Did not find a pre-existing smart rollup snapshot."

echo "Downloading ${SNAPSHOT_URL}"
mkdir -p "$rollup_data_dir"
curl -LfsS ${SNAPSHOT_URL} | tee >(sha256sum > ${snapshot_file}.sha256sum) > "$snapshot_file"
22 changes: 22 additions & 0 deletions charts/tezos/scripts/smart-rollup-snapshot-importer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
set -ex

bin_dir="/usr/local/bin"
data_dir="/var/tezos"
rollup_data_dir="$data_dir/rollup"
smart_rollup_node="$bin_dir/octez-smart-rollup-node"
snapshot_file=${rollup_data_dir}/rollup.snapshot

if [ ! -f ${snapshot_file} ]; then
echo "No snapshot to import."
exit 0
fi

if [ -e "$rollup_data_dir/storage/l2_blocks/data" ]; then
echo "Smart rollup snapshot has already been imported. Exiting."
exit 0
fi

${smart_rollup_node} --endpoint ${NODE_RPC_URL} snapshot import ${snapshot_file} --data-dir ${rollup_data_dir} --no-check
find ${node_dir}

rm -rvf ${snapshot_file}
28 changes: 27 additions & 1 deletion charts/tezos/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ smartRollupNodes: {}
# ```
# smartRollupNodes:
# rollup-node-0:
# mode: operator
# operators:
# operating: archive-baking-node-0
# cementing: archive-baking-node-0
Expand All @@ -390,7 +391,32 @@ smartRollupNodes: {}
# labels: {}
# pathType: Prefix
# tls: []
# evm_proxy:
# evm:
# mode: observer
# annotations: {}
# ingress:
# enabled: false
# host: ""
# annotations: {}
# className: ""
# labels: {}
# pathType: Prefix
# tls: []
# rollup-node-1:
# mode: observer
# rollup_address: sr1RYurGZtN8KNSpkMcCt9CgWeUaNkzsAfXf
# annotations: {}
# ingress:
# enabled: false
# host: ""
# annotations: {}
# className: ""
# labels: {}
# pathType: Prefix
# tls: []
# evm:
# mode: observer
# replicas: 2
# annotations: {}
# ingress:
# enabled: false
Expand Down

0 comments on commit 1e971d9

Please sign in to comment.