diff --git a/.gitignore b/.gitignore index 7dbf4eb..ecfb85f 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ node_modules .devspace/ build +.idea # Ignore mkchain generated files *_values.yaml diff --git a/charts/tezos/scripts/smart-rollup-node.sh b/charts/tezos/scripts/smart-rollup-node.sh index d29e9d0..f2f112e 100644 --- a/charts/tezos/scripts/smart-rollup-node.sh +++ b/charts/tezos/scripts/smart-rollup-node.sh @@ -1,4 +1,4 @@ -set -ex +set -e TEZ_VAR=/var/tezos TEZ_BIN=/usr/local/bin @@ -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 \ No newline at end of file diff --git a/charts/tezos/scripts/smart-rollup-snapshot-downloader.sh b/charts/tezos/scripts/smart-rollup-snapshot-downloader.sh new file mode 100644 index 0000000..6fe02ad --- /dev/null +++ b/charts/tezos/scripts/smart-rollup-snapshot-downloader.sh @@ -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" \ No newline at end of file diff --git a/charts/tezos/scripts/smart-rollup-snapshot-importer.sh b/charts/tezos/scripts/smart-rollup-snapshot-importer.sh new file mode 100644 index 0000000..192858d --- /dev/null +++ b/charts/tezos/scripts/smart-rollup-snapshot-importer.sh @@ -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} \ No newline at end of file diff --git a/charts/tezos/values.yaml b/charts/tezos/values.yaml index 237b4c1..2ee65fb 100644 --- a/charts/tezos/values.yaml +++ b/charts/tezos/values.yaml @@ -372,6 +372,7 @@ smartRollupNodes: {} # ``` # smartRollupNodes: # rollup-node-0: +# mode: operator # operators: # operating: archive-baking-node-0 # cementing: archive-baking-node-0 @@ -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