From 391297b77a4691d43a336b55ebd2bdcc0bed0328 Mon Sep 17 00:00:00 2001 From: Shane Fontaine <9441295+shanefontaine@users.noreply.github.com> Date: Sun, 19 May 2024 06:16:11 -0700 Subject: [PATCH 1/4] wh: add scripts and notes --- ops/webhooks/README.md | 15 ++++++++++---- ops/webhooks/install_dependencies.sh | 30 ++++++++++++++++++++++++++++ ops/webhooks/stop_webook_server.sh | 16 +++++++++++++++ 3 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 ops/webhooks/install_dependencies.sh create mode 100644 ops/webhooks/stop_webook_server.sh diff --git a/ops/webhooks/README.md b/ops/webhooks/README.md index 45fe8cd572..191872a073 100644 --- a/ops/webhooks/README.md +++ b/ops/webhooks/README.md @@ -10,8 +10,15 @@ Set up a webhook [on GitHub](https://github.com/hop-protocol/hop/settings/hooks) ### On the server -Ensure port `4665` can accept incoming requests. - -- Set the `DOCKER_IMAGE_NAME` and `WEBHOOK_SECRET` envs in `~/.bashrc` and source it. -- Add the scripts in this repo to the server. +- Set up the environment + - Set the `DOCKER_IMAGE_NAME` and `WEBHOOK_SECRET` envs in `~/.bashrc` and source it. + - Ensure port `4665` can accept incoming requests. +- Installation + - Add the appropriate files from this directory to the server and make them executable with `chmod +x` + - Run `./install_webhook_server.sh` + - Run `/.install-_dependencies.sh` - Run the webhook server in the background with `./run_webhook_server.sh &` + +Ensure that you have a `docker.sh` executable file in the directly where these files are being executed. + +To stop the webhook server, run `./stop_webhook_server.sh`. diff --git a/ops/webhooks/install_dependencies.sh b/ops/webhooks/install_dependencies.sh new file mode 100644 index 0000000000..6d2f710bcf --- /dev/null +++ b/ops/webhooks/install_dependencies.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Function to install jq +install_jq() { + if command -v jq > /dev/null 2>&1; then + echo "jq is already installed." + return + fi + + # Detect package manager and install jq + if command -v apt > /dev/null 2>&1; then + echo "Using apt to install jq..." + sudo apt update + sudo apt install -y jq + elif command -v dnf > /dev/null 2>&1; then + echo "Using dnf to install jq..." + sudo dnf install -y jq + elif command -v yum > /dev/null 2>&1; then + echo "Using yum to install jq..." + sudo yum install -y jq + else + echo "Package manager not supported. Please install jq manually." + exit 1 + fi + + echo "jq installation complete." +} + +# Call the install function +install_jq \ No newline at end of file diff --git a/ops/webhooks/stop_webook_server.sh b/ops/webhooks/stop_webook_server.sh new file mode 100644 index 0000000000..69c451bc9b --- /dev/null +++ b/ops/webhooks/stop_webook_server.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Port number to check +PORT=4665 + +# Find process using the port and get its PID +pid=$(lsof -t -i:$PORT) + +# Check if any process was found +if [ -z "$pid" ]; then + echo "No process is using port $PORT." +else + echo "Process $pid is using port $PORT. Killing it..." + kill $pid + echo "Process killed." +fi From 7cf30bdcb0713d0a7a114ab96d08155beefbad76 Mon Sep 17 00:00:00 2001 From: Shane Fontaine <9441295+shanefontaine@users.noreply.github.com> Date: Sun, 19 May 2024 06:40:11 -0700 Subject: [PATCH 2/4] fe: udpated list --- packages/frontend/src/config/blocklist.ts | 33 ++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/config/blocklist.ts b/packages/frontend/src/config/blocklist.ts index ab3907df05..c645ebb76f 100644 --- a/packages/frontend/src/config/blocklist.ts +++ b/packages/frontend/src/config/blocklist.ts @@ -138,5 +138,36 @@ export const blocklist = blocklistEnabled ? [ '0x5a14e72060c11313e38738009254a90968f58f51', '0xefe301d259f525ca1ba74a7977b80d5b060b3cca', '0x39d908dac893cbcb53cc86e0ecc369aa4def1a29', - '0x4ea83653ecea38b51730c14776698e19f5ca6e65' + '0x4f47bc496083c727c5fbe3ce9cdf2b0f6496270c', + '0x38735f03b30FbC022DdD06ABED01F0Ca823C6a94', + '0x97b1043abd9e6fc31681635166d430a458d14f9c', + '0xb6f5ec1a0a9cd1526536d3f0426c429529471f40', + '0xdcbEfFBECcE100cCE9E4b153C4e15cB885643193', + '0x5f48c2a71b2cc96e3f0ccae4e39318ff0dc375b2', + '0x5a7a51bfb49f190e5a6060a5bc6052ac14a3b59f', + '0xed6e0a7e4ac94d976eebfb82ccf777a3c6bad921', + '0x797d7ae72ebddcdea2a346c1834e04d1f8df102b', + '0x931546D9e66836AbF687d2bc64B30407bAc8C568', + '0x43fa21d92141BA9db43052492E0DeEE5aa5f0A93', + '0x6be0ae71e6c41f2f9d0d1a3b8d0f75e6f6a0b46e', + '0x9c2bc757b66f24d60f016b6237f8cdd414a879fa', + '0x530a64c0ce595026a4a556b703644228179e2d57', + '0xfac583c0cf07ea434052c49115a4682172ab6b4f', + '0x961c5be54a2ffc17cf4cb021d863c42dacd47fc1', + '0x983a81ca6fb1e441266d2fbcb7d8e530ac2e05a2', + '0xf3701f445b6bdafedbca97d1e477357839e4120d', + '0xe950dc316b836e4eefb8308bf32bf7c72a1358ff', + '0x21b8d56bda776bbe68655a16895afd96f5534fed', + '0x175d44451403edf28469df03a9280c1197adb92c', + '0x19f8f2b0915daa12a3f5c9cf01df9e24d53794f7', + '0x4ea83653ecea38b51730c14776698e19f5ca6e65', + '0xae4a7cde7c99fb98b0d5fa414aa40f0300531f43', + '0x4ab93fc50b82d4dc457db85888dfdae28d29b98d', + '0x02fa2625825917e9b1f8346a465de1bbc150c5b9', + '0xbd18100a168321701955e348f03d0df4f517c13b', + '0x7e97b74252b6df53caf386fb4c54d4fb59cb6928', + '0xae4a7cde7c99fb98b0d5fa414aa40f0300531f43', + '0x9f09ec563222fe52712dc413d0b7b66cb5c7c795', + '0x5d0d99e9886581ff8fcb01f35804317f5ed80bbb', + '0x6277ab36a67cfb5535b02ee95c835a5eec554c07' ] : [] From e1ab7100b6ee188019afea5d3bd756fc672ee312 Mon Sep 17 00:00:00 2001 From: Shane Fontaine <9441295+shanefontaine@users.noreply.github.com> Date: Sun, 19 May 2024 06:47:22 -0700 Subject: [PATCH 3/4] v2eb: rm cachebust --- packages/v2-explorer-backend/src/config/config.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/v2-explorer-backend/src/config/config.ts b/packages/v2-explorer-backend/src/config/config.ts index 6db8c77c8f..6fa99b664b 100644 --- a/packages/v2-explorer-backend/src/config/config.ts +++ b/packages/v2-explorer-backend/src/config/config.ts @@ -45,5 +45,3 @@ export const postgresConfig = { port: process.env.POSTGRES_PORT ? parseInt(process.env.POSTGRES_PORT, 10) : 5432, maxConnections: process.env.POSTGRES_MAX_CONNECTIONS ? parseInt(process.env.POSTGRES_MAX_CONNECTIONS, 10) : 10 } - -const cacheBuster = 23 \ No newline at end of file From 3818a0eee922d71a89298e6a6695189dfa220c73 Mon Sep 17 00:00:00 2001 From: Shane Fontaine <9441295+shanefontaine@users.noreply.github.com> Date: Sun, 19 May 2024 06:58:15 -0700 Subject: [PATCH 4/4] all: rm cachebust --- packages/frontend/src/config/config.ts | 2 -- packages/hop-node/src/types/error.ts | 1 - packages/sdk/src/config/index.ts | 2 -- packages/v2-explorer-backend/src/config/config.ts | 2 -- 4 files changed, 7 deletions(-) diff --git a/packages/frontend/src/config/config.ts b/packages/frontend/src/config/config.ts index a26bf57b7a..25a2c00df9 100644 --- a/packages/frontend/src/config/config.ts +++ b/packages/frontend/src/config/config.ts @@ -9,8 +9,6 @@ if (process.env.REACT_APP_NETWORK === 'goerli') { showRewards = false } -const cacheBuster: number = 15 - export { showRewards } export const transferTimes = { diff --git a/packages/hop-node/src/types/error.ts b/packages/hop-node/src/types/error.ts index 50491477a9..d6ebd17064 100644 --- a/packages/hop-node/src/types/error.ts +++ b/packages/hop-node/src/types/error.ts @@ -2,4 +2,3 @@ export class BonderFeeTooLowError extends Error {} export class RelayerFeeTooLowError extends Error {} export class BonderTooEarlyError extends Error {} export class UnfinalizedTransferBondError extends Error {} -const cacheBuster = 31 diff --git a/packages/sdk/src/config/index.ts b/packages/sdk/src/config/index.ts index 7cc346d8c0..1f90636b2a 100644 --- a/packages/sdk/src/config/index.ts +++ b/packages/sdk/src/config/index.ts @@ -5,8 +5,6 @@ import { config as goerli } from './goerli.js' import { config as mainnet } from './mainnet.js' import { config as sepolia } from './sepolia.js' -const cachebuster: number = 7 - let sdkConfig: any = {} const bondableChainsSet = new Set([]) const config: any = { goerli, sepolia, mainnet } diff --git a/packages/v2-explorer-backend/src/config/config.ts b/packages/v2-explorer-backend/src/config/config.ts index 6db8c77c8f..6fa99b664b 100644 --- a/packages/v2-explorer-backend/src/config/config.ts +++ b/packages/v2-explorer-backend/src/config/config.ts @@ -45,5 +45,3 @@ export const postgresConfig = { port: process.env.POSTGRES_PORT ? parseInt(process.env.POSTGRES_PORT, 10) : 5432, maxConnections: process.env.POSTGRES_MAX_CONNECTIONS ? parseInt(process.env.POSTGRES_MAX_CONNECTIONS, 10) : 10 } - -const cacheBuster = 23 \ No newline at end of file