-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
618c2f1
commit 857e111
Showing
12 changed files
with
376 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ node_modules | |
.devspace/ | ||
build | ||
|
||
.idea | ||
|
||
# Ignore mkchain generated files | ||
*_values.yaml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
set -ex | ||
|
||
TEZ_VAR=/var/tezos | ||
TEZ_BIN=/usr/local/bin | ||
ROLLUP_DATA_DIR="${TEZ_VAR}/rollup" | ||
EVM_DATA_DIR="${TEZ_VAR}/evm" | ||
EVM_CONFIG_FILE="${EVM_DATA_DIR}/config.json" | ||
|
||
EVM_CONFIGMAP_DIR="${TEZ_VAR}/evm-config" | ||
EVM_CONFIGMAP_CONFIG_FILE="${EVM_CONFIGMAP_DIR}/config.json" | ||
|
||
# Wait till rollup node to be fully synchronized to run init from rollup command | ||
WAIT_LIMIT=30 | ||
COUNTER=1 | ||
while [ "$(curl -s http://localhost:8932/local/synchronized | sed 's/^"//;s/"$//')" != "synchronized" ] && [ $COUNTER -lt $WAIT_LIMIT ]; do | ||
COUNTER=$((COUNTER + 1)) | ||
echo "polling ${COUNTER}/${WAIT_LIMIT}: rollup node not synchronized yet" | ||
sleep 60 | ||
done | ||
|
||
if [ "$(curl -s http://localhost:8932/local/synchronized | sed 's/^"//;s/"$//')" != "synchronized" ]; then | ||
echo "ERROR: rollup node not synchronized within wait limit, exiting...." | ||
exit 1 | ||
fi | ||
|
||
if [ ! -e "${EVM_DATA_DIR}/store.sqlite" ]; then | ||
$TEZ_BIN/octez-evm-node init from rollup node ${ROLLUP_DATA_DIR} --data-dir ${EVM_DATA_DIR} | ||
fi | ||
|
||
# Provide basic config if there is no config specified in values.yaml | ||
if [ ! -e "${EVM_CONFIGMAP_CONFIG_FILE}" ]; then | ||
cat > "${EVM_CONFIG_FILE}" << EOF | ||
{ "rpc-addr": "0.0.0.0", "cors_origins": [ "*" ], | ||
"cors_headers": [ "*" ], | ||
"rollup_node_endpoint": "http://127.0.0.1:8932", "verbose": "notice", | ||
"max_active_connections": 8000 } | ||
EOF | ||
else | ||
cp -vf ${EVM_CONFIGMAP_CONFIG_FILE} ${EVM_CONFIG_FILE} | ||
fi | ||
|
||
CMD="$TEZ_BIN/octez-evm-node run observer \ | ||
--evm-node-endpoint ${EVM_NODE_ENDPOINT} \ | ||
--rollup-node-endpoint http://127.0.0.1:8932 \ | ||
--data-dir ${EVM_DATA_DIR} \ | ||
--preimages-endpoint ${ROLLUP_PREIMAGES_ENDPOINT} \ | ||
--rpc-addr 0.0.0.0 --rpc-port 8545" | ||
|
||
exec $CMD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
set -e | ||
|
||
TEZ_VAR=/var/tezos | ||
TEZ_BIN=/usr/local/bin | ||
ROLLUP_DATA_DIR="$TEZ_VAR/rollup" | ||
EVM_DATA_DIR="$TEZ_VAR/evm" | ||
|
||
set -x | ||
|
||
if [ ! -e "${EVM_DATA_DIR}/store/store.dict" ]; then | ||
$TEZ_BIN/octez-evm-node init from rollup node ${ROLLUP_DATA_DIR} --data-dir ${EVM_DATA_DIR} | ||
fi | ||
|
||
|
||
CMD="$TEZ_BIN/octez-evm-node run sequencer \ | ||
with endpoint http://127.0.0.1:8932 \ | ||
signing with edsk3rw6fcwjPe5xkGWAbSquLDQALKP8XyMhy4c6PQGr7qQKTYa8rX \ | ||
--data-dir ${EVM_DATA_DIR} \ | ||
--time-between-blocks 6 \ | ||
--rpc-addr 0.0.0.0" | ||
|
||
exec $CMD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
set -ex | ||
|
||
TEZ_VAR=/var/tezos | ||
TEZ_BIN=/usr/local/bin | ||
ROLLUP_DATA_DIR="${TEZ_VAR}/rollup" | ||
|
||
$TEZ_BIN/octez-smart-rollup-node init observer \ | ||
config for "${ROLLUP_ADDRESS}" \ | ||
with operators \ | ||
--history-mode archive \ | ||
--data-dir "${ROLLUP_DATA_DIR}" \ | ||
--rpc-addr 0.0.0.0 \ | ||
--pre-images-endpoint "${ROLLUP_PREIMAGES_ENDPOINT}" \ | ||
--force | ||
|
||
CMD="$TEZ_BIN/octez-smart-rollup-node \ | ||
--endpoint http://tezos-node-rpc:8732 \ | ||
run \ | ||
--data-dir ${ROLLUP_DATA_DIR} \ | ||
--acl-override allow-all \ | ||
--log-kernel-debug" | ||
|
||
exec $CMD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/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" | ||
|
||
chown -R 1000:1000 "$data_dir" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
Oops, something went wrong.