From 6554b1632dfb72e9c338aa3e15121608337c5807 Mon Sep 17 00:00:00 2001 From: Andrey Date: Sat, 9 Dec 2023 05:24:59 +0200 Subject: [PATCH 1/4] Add WETH and MUTE. --- crawlers/mooncrawl/mooncrawl/settings.py | 1 + .../state_crawler/jobs/zksync-era-jobs.json | 75 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 crawlers/mooncrawl/mooncrawl/state_crawler/jobs/zksync-era-jobs.json diff --git a/crawlers/mooncrawl/mooncrawl/settings.py b/crawlers/mooncrawl/mooncrawl/settings.py index 79a3a8a5c..fe14e66c8 100644 --- a/crawlers/mooncrawl/mooncrawl/settings.py +++ b/crawlers/mooncrawl/mooncrawl/settings.py @@ -241,6 +241,7 @@ AvailableBlockchainType.POLYGON: "0xc8E51042792d7405184DfCa245F2d27B94D013b6", AvailableBlockchainType.MUMBAI: "0xe9939e7Ea7D7fb619Ac57f648Da7B1D425832631", AvailableBlockchainType.ETHEREUM: "0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696", + AvailableBlockchainType.ZKSYNC_ERA: "0xF9cda624FBC7e059355ce98a31693d299FACd963", } diff --git a/crawlers/mooncrawl/mooncrawl/state_crawler/jobs/zksync-era-jobs.json b/crawlers/mooncrawl/mooncrawl/state_crawler/jobs/zksync-era-jobs.json new file mode 100644 index 000000000..6301e9039 --- /dev/null +++ b/crawlers/mooncrawl/mooncrawl/state_crawler/jobs/zksync-era-jobs.json @@ -0,0 +1,75 @@ +[ + { + "constant": true, + "inputs": [], + "name": "getReserves", + "outputs": [ + { + "internalType": "uint", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "address": "0x80115c708E12eDd42E504c1cD52Aea96C547c05c", + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getReserves", + "outputs": [ + { + "internalType": "uint112", + "name": "_reserve0", + "type": "uint112" + }, + { + "internalType": "uint112", + "name": "_reserve1", + "type": "uint112" + }, + { + "internalType": "uint32", + "name": "_blockTimestampLast", + "type": "uint32" + } + ], + "payable": false, + "address": "0xb85feb6aF3412d690DFDA280b73EaED73a2315bC", + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getReserves", + "outputs": [ + { + "internalType": "uint112", + "name": "_reserve0", + "type": "uint112" + }, + { + "internalType": "uint112", + "name": "_reserve1", + "type": "uint112" + }, + { + "internalType": "uint32", + "name": "_blockTimestampLast", + "type": "uint32" + } + ], + "payable": false, + "address": "0xDFAaB828f5F515E104BaaBa4d8D554DA9096f0e4", + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file From 5a72358e994c8f60b7ce230724ad5ab5cb503e0b Mon Sep 17 00:00:00 2001 From: Andrey Date: Sat, 9 Dec 2023 10:41:51 +0200 Subject: [PATCH 2/4] Add deploy files. --- crawlers/deploy/deploy.bash | 21 +++++++++++++++++++ .../deploy/zksync-era-state-clean.service | 11 ++++++++++ crawlers/deploy/zksync-era-state-clean.timer | 9 ++++++++ crawlers/deploy/zksync-era-state.service | 11 ++++++++++ crawlers/deploy/zksync-era-state.timer | 9 ++++++++ 5 files changed, 61 insertions(+) create mode 100644 crawlers/deploy/zksync-era-state-clean.service create mode 100644 crawlers/deploy/zksync-era-state-clean.timer create mode 100644 crawlers/deploy/zksync-era-state.service create mode 100644 crawlers/deploy/zksync-era-state.timer diff --git a/crawlers/deploy/deploy.bash b/crawlers/deploy/deploy.bash index 99e8b8893..269a7cc8a 100755 --- a/crawlers/deploy/deploy.bash +++ b/crawlers/deploy/deploy.bash @@ -115,6 +115,10 @@ ZKSYNC_ERA_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE="zksync-era-historical-cra ZKSYNC_ERA_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="zksync-era-historical-crawl-transactions.timer" ZKSYNC_ERA_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE="zksync-era-historical-crawl-events.service" ZKSYNC_ERA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE="zksync-era-historical-crawl-events.timer" +ZKSYNC_ERA_STATE_SERVICE_FILE="zksync-era-state.service" +ZKSYNC_ERA_STATE_TIMER_FILE="zksync-era-state.timer" +ZKSYNC_ERA_STATE_CLEAN_SERVICE_FILE="zksync-era-state-clean.service" +ZKSYNC_ERA_STATE_CLEAN_TIMER_FILE="zksync-era-state-clean.timer" # ZkSync Era testnet ZKSYNC_ERA_TESTNET_SYNCHRONIZE_SERVICE="zksync-era-testnet-synchronize.service" @@ -550,6 +554,23 @@ cp "${SCRIPT_DIR}/${ZKSYNC_ERA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" "/home/ubunt XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${ZKSYNC_ERA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" +echo +echo +echo -e "${PREFIX_INFO} Replacing existing ZkSync Era state service and timer with: ${ZKSYNC_ERA_STATE_SERVICE_FILE}, ${ZKSYNC_ERA_STATE_TIMER_FILE}" +chmod 644 "${SCRIPT_DIR}/${ZKSYNC_ERA_STATE_SERVICE_FILE}" "${SCRIPT_DIR}/${ZKSYNC_ERA_STATE_TIMER_FILE}" +cp "${SCRIPT_DIR}/${ZKSYNC_ERA_STATE_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${ZKSYNC_ERA_STATE_SERVICE_FILE}" +cp "${SCRIPT_DIR}/${ZKSYNC_ERA_STATE_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${ZKSYNC_ERA_STATE_TIMER_FILE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${ZKSYNC_ERA_STATE_TIMER_FILE}" + +echo +echo +echo -e "${PREFIX_INFO} Replacing existing ZkSync Era state clean service and timer with: ${ZKSYNC_ERA_STATE_CLEAN_SERVICE_FILE}, ${ZKSYNC_ERA_STATE_CLEAN_TIMER_FILE}" +chmod 644 "${SCRIPT_DIR}/${ZKSYNC_ERA_STATE_CLEAN_SERVICE_FILE}" "${SCRIPT_DIR}/${ZKSYNC_ERA_STATE_CLEAN_TIMER_FILE}" +cp "${SCRIPT_DIR}/${ZKSYNC_ERA_STATE_CLEAN_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${ZKSYNC_ERA_STATE_CLEAN_SERVICE_FILE}" +cp "${SCRIPT_DIR}/${ZKSYNC_ERA_STATE_CLEAN_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${ZKSYNC_ERA_STATE_CLEAN_TIMER_FILE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${ZKSYNC_ERA_STATE_CLEAN_TIMER_FILE}" # ZkSync Era testnet echo diff --git a/crawlers/deploy/zksync-era-state-clean.service b/crawlers/deploy/zksync-era-state-clean.service new file mode 100644 index 000000000..6b650d647 --- /dev/null +++ b/crawlers/deploy/zksync-era-state-clean.service @@ -0,0 +1,11 @@ +[Unit] +Description=Execute state clean labels crawler +After=network.target + +[Service] +Type=oneshot +WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl +EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env +ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli --access-id "${NB_CONTROLLER_ACCESS_ID}" clean-state-labels --blockchain zksync-era -N 10000 +CPUWeight=60 +SyslogIdentifier=zksync-era-state-clean \ No newline at end of file diff --git a/crawlers/deploy/zksync-era-state-clean.timer b/crawlers/deploy/zksync-era-state-clean.timer new file mode 100644 index 000000000..c6e6ae99a --- /dev/null +++ b/crawlers/deploy/zksync-era-state-clean.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Execute Zksync Era state clean labels crawler each 25m + +[Timer] +OnBootSec=50s +OnUnitActiveSec=25m + +[Install] +WantedBy=timers.target diff --git a/crawlers/deploy/zksync-era-state.service b/crawlers/deploy/zksync-era-state.service new file mode 100644 index 000000000..8da611452 --- /dev/null +++ b/crawlers/deploy/zksync-era-state.service @@ -0,0 +1,11 @@ +[Unit] +Description=Execute state crawler +After=network.target + +[Service] +Type=oneshot +WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl +EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env +ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli --access-id "${NB_CONTROLLER_ACCESS_ID}" crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain polygon --infura --jobs-file /home/ubuntu/moonstream/crawlers/mooncrawl/mooncrawl/state_crawler/jobs/zksync-era-jobs.json +CPUWeight=60 +SyslogIdentifier=zksync-era-state \ No newline at end of file diff --git a/crawlers/deploy/zksync-era-state.timer b/crawlers/deploy/zksync-era-state.timer new file mode 100644 index 000000000..b67cc1fe9 --- /dev/null +++ b/crawlers/deploy/zksync-era-state.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Execute Zksync Era state crawler each 10m + +[Timer] +OnBootSec=15s +OnUnitActiveSec=10m + +[Install] +WantedBy=timers.target From f04ac73865e8fca3704f8d42f604aa5ef4afaebe Mon Sep 17 00:00:00 2001 From: Andrey Date: Sat, 9 Dec 2023 11:38:50 +0200 Subject: [PATCH 3/4] Fix blockchain in deploy script. --- crawlers/deploy/zksync-era-state.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crawlers/deploy/zksync-era-state.service b/crawlers/deploy/zksync-era-state.service index 8da611452..91ab6f4b8 100644 --- a/crawlers/deploy/zksync-era-state.service +++ b/crawlers/deploy/zksync-era-state.service @@ -6,6 +6,6 @@ After=network.target Type=oneshot WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env -ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli --access-id "${NB_CONTROLLER_ACCESS_ID}" crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain polygon --infura --jobs-file /home/ubuntu/moonstream/crawlers/mooncrawl/mooncrawl/state_crawler/jobs/zksync-era-jobs.json +ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli --access-id "${NB_CONTROLLER_ACCESS_ID}" crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain zksync-era --infura --jobs-file /home/ubuntu/moonstream/crawlers/mooncrawl/mooncrawl/state_crawler/jobs/zksync-era-jobs.json CPUWeight=60 SyslogIdentifier=zksync-era-state \ No newline at end of file From a8a0b165a226c0295381f0f0057aac4148b975af Mon Sep 17 00:00:00 2001 From: Andrey Date: Sat, 9 Dec 2023 11:47:09 +0200 Subject: [PATCH 4/4] Add fix. --- crawlers/deploy/zksync-era-state-clean.service | 2 +- crawlers/deploy/zksync-era-state.service | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crawlers/deploy/zksync-era-state-clean.service b/crawlers/deploy/zksync-era-state-clean.service index 6b650d647..4cd68f253 100644 --- a/crawlers/deploy/zksync-era-state-clean.service +++ b/crawlers/deploy/zksync-era-state-clean.service @@ -6,6 +6,6 @@ After=network.target Type=oneshot WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env -ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli --access-id "${NB_CONTROLLER_ACCESS_ID}" clean-state-labels --blockchain zksync-era -N 10000 +ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli --access-id "${NB_CONTROLLER_ACCESS_ID}" clean-state-labels --blockchain zksync_era -N 10000 CPUWeight=60 SyslogIdentifier=zksync-era-state-clean \ No newline at end of file diff --git a/crawlers/deploy/zksync-era-state.service b/crawlers/deploy/zksync-era-state.service index 91ab6f4b8..573ae5d70 100644 --- a/crawlers/deploy/zksync-era-state.service +++ b/crawlers/deploy/zksync-era-state.service @@ -6,6 +6,6 @@ After=network.target Type=oneshot WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env -ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli --access-id "${NB_CONTROLLER_ACCESS_ID}" crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain zksync-era --infura --jobs-file /home/ubuntu/moonstream/crawlers/mooncrawl/mooncrawl/state_crawler/jobs/zksync-era-jobs.json +ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli --access-id "${NB_CONTROLLER_ACCESS_ID}" crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain zksync_era --infura --jobs-file /home/ubuntu/moonstream/crawlers/mooncrawl/mooncrawl/state_crawler/jobs/zksync-era-jobs.json CPUWeight=60 SyslogIdentifier=zksync-era-state \ No newline at end of file