From 1aaf8f97161b3005eb945c3d897fec29fdec9aa7 Mon Sep 17 00:00:00 2001 From: Voss Date: Wed, 6 Mar 2024 23:17:45 -0600 Subject: [PATCH 01/28] first pass of advanced config + editing UI etc for pruned snapshots --- docker-compose.yml | 7 +++ pocket/app.js | 23 +++++--- pocket/config_template.json | 14 ++--- pocket/entrypoint.sh | 48 +++++++++++++++- pocket/ui/src/App.tsx | 17 +++--- setup-wizard.yml | 108 +++++++++++++++++++++++++++++++++++- 6 files changed, 186 insertions(+), 31 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 89c6a8e..ee05898 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,6 +20,13 @@ services: ARIA2_SNAPSHOT: "Yes" PRUNED_SNAPSHOT: "Yes" COMPRESSED_SNAPSHOT: "Yes" + BACKFIRE_PROTECTION: false + PERSISTENT_PEERS: "" + MAX_PEERS_INBOUND: 28 + MAX_PEERS_OUTBOUND: 7 + SEEDS: "7c0d7ec36db6594c1ffaa99724e1f8300bbd52d0@seed1.mainnet.pokt.network:26662,cdcf936d70726dd724e0e6a8353d8e5ba5abdd20@seed2.mainnet.pokt.network:26663,74b4322a91c4a7f3e774648d0730c1e610494691@seed3.mainnet.pokt.network:26662,b3235089ff302c9615ba661e13e601d9d6265b15@seed4.mainnet.pokt.network:26663" + SESSION_ROLLOVER: 0 + ADVANCED_CONFIG: "No" EXTRA_OPTS: "" ulimits: nofile: diff --git a/pocket/app.js b/pocket/app.js index dd438a3..629341b 100644 --- a/pocket/app.js +++ b/pocket/app.js @@ -108,17 +108,23 @@ function checkAvalancheState(url) { } } -// TODO: Test Pokt State Functionality +// TODO: Test Pokt State Functionality + Remove other params commented out when successful with current params function checkPoktState(url) { try { - url = `https://pocket-pocket.${domain}` - const localHeight = JSON.parse(shell.exec(`curl -X POST -H {Content-Type:\ application/json} --json {} ${url}/v1/query/height`).stdout.trim()); - const currentHeight = JSON.parse(shell.exec(`curl https://mainnet.rpc.grove.city/v1/e6abbfca/v1/query/height`).stdout.trim()); - // const nodeHeight = JSON.parse(shell.exec(`pocket query height --datadir=/home/app/.pocket/ | tail -n +2`).stdout.trim()); - if (currentHeight.result.height - localHeight.result.height === 0) { + url = `tcp://localhost:26657`; + const localNodeHeight = JSON.parse(shell.exec(`curl ${url}/status`).stdout.trim()); + //if (localNodeHeight.result.sync_info.catching_up === false && prunedSnapshot.result === ........ + const prunedSnapshot = JSON.parse(shell.exec(`echo $PRUNED_SNAPSHOT`).stdout.trim()); + //const localHeight = JSON.parse(shell.exec(`curl -X POST -H {Content-Type:\ application/json} --json {} ${url}/v1/query/height`).stdout.trim()); + //const currentHeight = JSON.parse(shell.exec(`curl https://mainnet.rpc.grove.city/v1/xxxxxxxx/v1/query/height`).stdout.trim()); + //const nodeHeight = JSON.parse(shell.exec(`pocket query height --datadir=/home/app/.pocket/ | tail -n +2`).stdout.trim()); + if (localNodeHeight.result.sync_info.catching_up === false && prunedSnapshot.result === "Yes") { + return 3; + } else if (localNodeHeight.result.sync_info.catching_up === false && prunedSnapshot.result === "No") { return 2; + } else if (localNodeHeight.result.sync_info.catching_up === true) { + return 1; } - return 1; } catch (error) { return 0; } @@ -133,8 +139,7 @@ function checkStateChain(type, url) { case "avalanche": return checkAvalancheState(url); case "pokt": - return 2; - // return checkPoktState(); + return checkPoktState(); default: return 0; } diff --git a/pocket/config_template.json b/pocket/config_template.json index f8b6672..185149b 100644 --- a/pocket/config_template.json +++ b/pocket/config_template.json @@ -56,13 +56,13 @@ "RootDir": "/home/app/.pocket", "ListenAddress": "tcp://0.0.0.0:26656", "ExternalAddress": "tcp://${_DAPPNODE_GLOBAL_DOMAIN}:26656", - "Seeds": "7c0d7ec36db6594c1ffaa99724e1f8300bbd52d0@seed1.mainnet.pokt.network:26662,cdcf936d70726dd724e0e6a8353d8e5ba5abdd20@seed2.mainnet.pokt.network:26663,74b4322a91c4a7f3e774648d0730c1e610494691@seed3.mainnet.pokt.network:26662,b3235089ff302c9615ba661e13e601d9d6265b15@seed4.mainnet.pokt.network:26663", - "PersistentPeers": "", + "Seeds": "${SEEDS}", + "PersistentPeers": "${PERSISTENT_PEERS}", "UPNP": false, "AddrBook": "config/addrbook.json", "AddrBookStrict": false, - "MaxNumInboundPeers": 28, - "MaxNumOutboundPeers": 16, + "MaxNumInboundPeers": "${MAX_PEERS_INBOUND}", + "MaxNumOutboundPeers": "${MAX_PEERS_OUTBOUND}", "UnconditionalPeerIDs": "", "PersistentPeersMaxDialPeriod": 0, "FlushThrottleTimeout": 100000000, @@ -130,12 +130,11 @@ "data_dir": "/home/app/.pocket", "genesis_file": "genesis.json", "chains_name": "chains.json", - "session_db_name": "session", "evidence_db_name": "pocket_evidence", "tendermint_uri": "tcp://localhost:26657", "keybase_name": "pocket-keybase", "rpc_port": "8081", - "client_session_sync_allowance": 1, + "client_session_sync_allowance": "${SESSION_ROLLOVER}", "client_block_sync_allowance": 10, "max_evidence_cache_entries": 500, "max_session_cache_entries": 500, @@ -157,6 +156,7 @@ "chains_hot_reload": true, "generate_token_on_start": false, "lean_pocket": false, - "lean_pocket_user_key_file": "lean_nodes_keys.json" + "lean_pocket_user_key_file": "lean_nodes_keys.json", + "prevent_negative_reward_claim": "${BACKFIRE_PROTECTION}" } } diff --git a/pocket/entrypoint.sh b/pocket/entrypoint.sh index 6969b5f..8f0247f 100755 --- a/pocket/entrypoint.sh +++ b/pocket/entrypoint.sh @@ -88,7 +88,7 @@ PID_SIMULATE_RELAY=$! sleep 2 OUTPUT=$(curl -X POST --data '{"relay_network_id":"0021","payload":{"data":"{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\":[\"0x8D97689C9818892B700e27F316cc3E41e17fBeb9\", \"latest\"],\"id\":1}","method":"POST","path":"","headers":{}}}' https://pocket-pocket.${_DAPPNODE_GLOBAL_DOMAIN}/v1/client/sim) if echo "$OUTPUT" | grep "no such host"; then - echo "${ERROR} It has not been possible to simulate relay" + echo "${ERROR} It has not been possible to simulate relays" else echo "${INFO} OK" fi @@ -119,7 +119,7 @@ if [ "$NETWORK" == "mainnet" ] && ! $is_update; then SNAPSHOT_URL="$MIRROR_URL$fileName" fi - #Download Snapshot Metedata + #Download Snapshot Metedata for Latest Snapshot File start_downloading_ui mkdir -p /home/app/.pocket/ cd /home/app/.pocket/ @@ -142,11 +142,53 @@ if [ "$NETWORK" == "mainnet" ] && ! $is_update; then # echo "${INFO} aria2c -x16 -s16 -o ${latestFile} ${downloadURL}" # aria2c -x16 -s16 -o "${latestFile}" "${downloadURL}" # done + ################################################################ + # # BSC aria restart script for aria2c + #!/bin/bash +# if [ $# -eq 1 ]; then +# dir=$(pwd) +# elif [ $# -eq 2 ]; then +# dir=$2 +# else +# echo "Usage: $0 [filepath] " +# exit 1 +# fi +# uri=$1 +# filename=$(basename "$uri") +# status=-1 +# while (( status != 0 )) +# do +# PIDS=$(pgrep '^aria2c$') +# if [ -z "$PIDS" ]; then +# echo "aria2c -d $dir -o $filename -s14 -x14 -k100M $uri" +# aria2c -d $dir -o $filename -s14 -x14 -k100M $uri +# fi +# status=$? +# pid=$(pidof aria2c) +# wait $pid +# echo aria2c exit. +# case $status in +# 3) +# echo file not exist. +# exit 3 +# ;; +# 9) +# echo No space left on device. +# exit 9 +# ;; +# *) +# continue +# ;; +# esac +# done +# echo download succeed. +# exit 0 + ################################################################ echo "${INFO} Download complete!" # Extract the downloaded file to /home/app/.pocket/ directory - echo "${INFO} Extracting the downloaded file to /home/app/.pocket/..." + echo "${INFO} Extracting the downloaded file to /home/app/.pocket/ ..." extract_file # Delete the source file diff --git a/pocket/ui/src/App.tsx b/pocket/ui/src/App.tsx index 2c72bd3..631ea29 100644 --- a/pocket/ui/src/App.tsx +++ b/pocket/ui/src/App.tsx @@ -48,8 +48,6 @@ function App() { chains.forEach((chain: Chain) => { if (currentAccount?.node && currentAccount.node.chains.includes(chain.id)) { handleChange(chain.id, true); - } else if (chain.name.toLowerCase() === 'pokt') { - handleChange(chain.id, true); } }); setAvailableChains(chains); @@ -71,7 +69,7 @@ function App() { try { setTxhash(null); if ((amountToStake ?? 0) < 15100) { - throw new Error(`Minimum amount to stake is 15100 POKT`); + throw new Error(`Minimum amount to stake is 15,100 POKT`); } if ((amountToStake ?? 0) > ((Number(account?.amount ?? 0) + Number(account?.amountStaked ?? 0)) / 1000000) - 1) { throw new Error(`You do not have enough POKT to stake`); @@ -130,6 +128,7 @@ function App() { switch (state) { case 1: return "Syncing"; case 2: return "Running"; + case 3: return "Running but Pruned"; default: return "Not installed"; } } @@ -178,7 +177,7 @@ function App() { minLength={5} /> - The amount of POKT to stake. Must be higher than the current value of the StakeMinimum parameter, found here. + The amount of POKT to stake. Must be higher than the current value of the StakeMinimum parameter, found here.
@@ -190,7 +189,7 @@ function App() { onChange={e => {handleChange(chain.id, e.target.checked)}} defaultChecked={selectedChains?.get(chain.id) ?? false} label={`${chain.name} - ${chainState(chain.state)}`} - disabled={chain.name.toLowerCase() === 'pokt' ? true : chain.state !== 2} + disabled={chain.state !== 2} /> )) } @@ -207,12 +206,12 @@ function App() {
- Ensure the node is all the way synced before proceeding to stake the validator. + Ensure your Pokt Chain is fully synced before proceeding to stake the validator.
- You can ensure your node is fully synced by checking the block height at https://explorer.pokt.network + You can ensure your node is fully synced by checking the block height at https://explorer.pokt.network
@@ -239,7 +238,7 @@ function App() {
- Stake = Initial Stake. Re-stake = staking again after changing chains or amount staked. + Stake = Initial Stake. Re-stake = staking again after changing chains or amount of Pokt staked.
@@ -251,7 +250,7 @@ function App() { - - If you have limited disk space and cannot hold the full ~1TB Pokt chain or have issues downloading the chain snapshot due to disconnections from an unstable connection, etc., then you can download a pruned snapshot of the Pokt chain that currently is only ~60gb instead of ~1TB. - Note: THIS PARAMETER CANNOT BE CHANGED once set initially during setup before snapshot download. While you can technically change the setting to non-pruned after downloading the pruned snapshot, it will not work to relay as it's pruned down very heavily and if you enable fulll snapshot after downloading the pruned snapshot it will enable the ability to select Potk as a relay chain to stake in the Pokt UI but because it's not a full node it may possibly get your node penalties or which will a If you use a pruned snapshot you cannot relay the Pokt chain on your node since you only have the data needed to keep you verifying the chain but not storing any unessecary but realyed data. The app may automatically disable this option for you but if it doesn't just be sure not to enable relaying Pokt Mainnet Chain (0001) if you downloaded a pruned snapshot. + If you have limited disk space and cannot hold the full ~1.1TB Pokt chain or have issues downloading the chain snapshot due to disconnections from an unstable connection, etc., then you can download a pruned snapshot of the Pokt chain that currently is only ~60gb instead of ~1TB. + Note: THIS PARAMETER CANNOT BE CHANGED once set initially during setup, before the snapshot download begins. While you can technically change the setting to non-pruned after downloading the pruned snapshot, it will not work to relay as the Pokt chain is pruned down very heavily and if you enable full snapshot after downloading the pruned snapshot it may enable the ability to select Pokt as a relay chain to stake in the Pokt UI but because it's not nearly a full node it may possibly result in penalties for your node or if you choose to use a pruned snapshot to relay that you cannot relay the full Pokt chain on your node since you only have the pruned data needed to keep you verifying the chain but not storing any (technically and normally not needed data: Historical Transactions, Historical states, and Historical blocks, etc.). This app does or shortly will automatically disable this option for you but if it doesn't just be sure not to enable relaying/staking the Pokt Mainnet Chain (0001) if you downloaded a pruned snapshot, or pruned your own chain. - id: inlineDecompression target: type: environment @@ -43,6 +44,7 @@ fields: enum: - "Yes" - "No" + default: "Yes" description: >- If you have limited disk space, and do not have room for ~2TB to download and extract the full snapshot (as of Late December 2023 the full compressed snapshot download is over 730 GB and needs to be downloaded fully and then extracted, using an enormous amount of diskspace during the initial download and extraction but once it's done it will be only ~ 800GB total for the full (unpruned, read more on pruned snapshots below) Pokt Chain. If you don't have the space for this, but have have enugh space for the ~1TB Pokt blockchain, you can attempt to use inline decompression, this saves from needing to have double the disk space, however if you dont have a very reliable high badwidth internet connection, this method will fail and need to be restarted from the beginning and cannot be restarted from where it left off, select `No` if you would like to try this way. If you want to run a full node and have a lot of free space for install, select `Yes`. @@ -56,6 +58,7 @@ fields: enum: - "Yes" - "No" + default: "Yes" description: >- You can choose to download the snapshot file as a .tar archive, or as a compressed lz4.tar archive. The lz4.tar archive is slightly smaller, but takes more system resources to decompress. If you have a slower internet connection, or a fast node, and want to save download time and bandwidth, select `No`. - id: snapshotMirror @@ -68,7 +71,106 @@ fields: enum: - "No" - "Yes" + default: "No" description: >- You can choose to download the snapshot file from the default master server in the U.K. which is the default option and is best to select if installing on a Monday, new snapshots are uploaded once a week on Mondays at 00:00UTC, first released on the UK master server, then is copied to the slave mirrors in the U.S. and Japan. It's often best to leave this option as the default master domain which auto-selects the best mirror for your location), but on Mondays at 00:00UTC, the master server is updated first, and the slave mirrors are updated a few hours later, so if you are installing on a Monday, you may want to select `Yes` to use the U.K master server which will have the most up to date snapshot ready for download first before any of the other mirrors that would be auto-selected if you were not already in the Master UK zone anyway. - + - id: advancedConfig + description: >- + If you are an advanced user or troubleshooting with support and would like to configure the config file with more advanced configuration options such as: max peers, session rollover, edit seeds from defaults, set persistent peers, select `Yes`. + target: + type: environment + name: ADVANCED_CONFIG + service: pocket + title: "Advanced Configuration Options?" + enum: + - "Yes" + - "No" + - id: maxPeersInbound + target: + type: environment + name: MAX_PEERS_INBOUND + service: pocket + title: "Max Inbound Peers" + description: >- + The maximum number of inbound peers that your node will accept. The default is 28, but you can set this to a higher/lower number if you have limited bandwidth or system resources resulting in poor performance. + Be sure to set this to a number that is less than the number of peers you have set in the `persistentPeers` field if you have set that field. + Also if be sure to increase this value before increasing Outbound peers. + pattern: "^(?:[0-9]|[1-3][0-9]|40)$" + patternMessage: "Please enter a whole number between 0 and 40." + required: true + default: 28 + if: { "advancedConfig": { "emum": ["Yes"] } } + - id: maxPeersOutbound + target: + type: environment + name: MAX_PEERS_OUTBOUND + service: pocket + title: "Max Outbound Peers" + description: >- + The maximum number of outbound peers that your node will connect to. The default is 7, but you can set this to a higher/lower number if you have limited bandwidth or system resources resulting in poor performance, lower this number. + Be sure to set this to a number that is less than the number of peers you have set in the `persistentPeers` field if you have set that field. + Also if be sure to keep this value at default of 7 before decreasing Inbound peers, if you have unlimited fast bandwidth or bad peers shown in the logs, you may want to increase this value above the default of 7. + pattern: "^(?:[0-9]|1[0-9]|20)$" + patternMessage: "Please enter a whole number between 0 and 40." + required: true + default: 7 + if: { "advancedConfig": { "emum": ["Yes"] } } + - id: sessionRollover + target: + type: environment + name: SESSION_ROLLOVER + service: pocket + title: "Session Rollover" + description: >- + Session Rollover is an advanced option to allow claims+proofs to rollover to the next session, by default this is set to 0 and nothing rolls over sessions, possibly decreasing rewards. + If you would like to possibly increase rewards by allowing claims+proofs to rollover to the next session, set this to 1, this may have a negative effect on your node's performance and may not be recommended for all nodes. + enum: + - 0 + - 1 + required: true + default: 0 + if: { "advancedConfig": { "emum": ["Yes"] } } + - id: persistentPeers + target: + type: environment + name: PERSISTENT_PEERS + service: pocket + title: "Persistent Peers" + description: >- + A comma separated list of persistent peers to connect to. If you have a list of peers that you would like to connect to, you can enter them here. If you do not have a list of peers, leave this field blank. + Note: If you have a list of persistent peers set, be sure to set the `maxPeersInbound` and `maxPeersOutbound` fields to a number that is higher than the number of persistent peers you have set here. + pattern: "^(?:[a-zA-Z0-9]+@[0-9]+(?:\\.[0-9]+){3}:[0-9]+,?)+$" + patternMessage: "Please enter a comma separated list of known peers in the format `@:`." + if: { "advancedConfig": { "emum": ["Yes"] } } + - id: seeds + target: + type: environment + name: SEEDS + service: pocket + title: "Seeds" + description: >- + A comma separated list of seeds to connect to. If you have a list of seeds that you would like to connect to, you can enter them here. If you do not have a list of seeds, leave this field blank. + Note: If you leave this field blank, the default seeds will be applied to your config file, if you have a list of seeds set here, the default seeds will be overwritten with your selection of seeds here. If you want to add seeds to the default seeds, you can add them here in addition to the default seeds `7c0d7ec36db6594c1ffaa99724e1f8300bbd52d0@seed1.mainnet.pokt.network:26662,cdcf936d70726dd724e0e6a8353d8e5ba5abdd20@seed2.mainnet.pokt.network:26663,74b4322a91c4a7f3e774648d0730c1e610494691@seed3.mainnet.pokt.network:26662,b3235089ff302c9615ba661e13e601d9d6265b15@seed4.mainnet.pokt.network:26663` + default: "7c0d7ec36db6594c1ffaa99724e1f8300bbd52d0@seed1.mainnet.pokt.network:26662,cdcf936d70726dd724e0e6a8353d8e5ba5abdd20@seed2.mainnet.pokt.network:26663,74b4322a91c4a7f3e774648d0730c1e610494691@seed3.mainnet.pokt.network:26662,b3235089ff302c9615ba661e13e601d9d6265b15@seed4.mainnet.pokt.network:26663" + pattern: "^(?:[a-zA-Z0-9]+@[0-9]+(?:\\.[0-9]+){3}:[0-9]+,?)+$" + patternMessage: "Please enter a comma separated list of seeds in the format `@:`." + if: { "advancedConfig": { "emum": ["Yes"] } } + - id: backFirePrevention + target: + type: environment + name: BACKFIRE_PREVENTION + service: pocket + title: "Backfire Prevention Enabled?" + description: >- + Backfire Prevention is an advanced option to attempt to prevent your node from processing claims that may result in a reward lower than the cost of the claim. + Leave this setting at 0 if you do not want to enable backfire prevention, which is the default Pokt setting. + By setting this value to 1, you are allowing your node to prevent claims that may result in a reward lower than the cost of the claim, which is 0.01 Pokt currently. + Note: This is not an exact setting as the claim reward value is an estimate until the proof is submitted, so this setting may not be 100% effective in preventing claims that may result in a reward lower than the cost of the claim. + Also note that this setting may have a larger effect on nodes staked in the lowest bracket as they earn far less rewards than those in upper breackets, Also this setting may have a negative effect on your node's performance for chains with very little activity. + enum: + - 0 + - 1 + required: true + default: 0 + if: { "advancedConfig": { "emum": ["Yes"] } } From ebaafc5173c5de0967a684957a0b852de0079b95 Mon Sep 17 00:00:00 2001 From: Voss Date: Thu, 2 May 2024 16:07:41 -0500 Subject: [PATCH 02/28] Add architectures, categories+keywords + updated links and reverted backup to just the keyfle --- dappnode_package.json | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/dappnode_package.json b/dappnode_package.json index 0d45704..369a750 100644 --- a/dappnode_package.json +++ b/dappnode_package.json @@ -1,24 +1,30 @@ { "name": "pocket.dnp.dappnode.eth", - "version": "0.1.6", + "version": "0.1.5", "upstreamVersion": "RC-0.11.1", "upstreamRepo": "pokt-network/pocket-core", "upstreamArg": "UPSTREAM_VERSION", "shortDescription": "Web3 Infrastructure The Right Way.", "description": "Instead of deploying to a single service provider, paying absurd fees for random outages and leaked data, tap into Pocket's trustless API protocol and route your requests to 1000's of independent full nodes. Available for all major blockchain networks.", "type": "service", + "architectures": ["linux/amd64"], "mainService": "pocket", "author": "DAppNode Association (https://github.com/dappnode)", "contributors": ["eduadiez (https://github.com/eduadiez)", "Voss (https://github.com/alexpeterson91)", "mgarciate (https://github.com/mgarciate)"], - "categories": ["Blockchain"], + "categories": ["Blockchain", "Economic incentive"], + "keywords": ["blockchain", "ethereum", "web3", "infrastructure", "pocket", "pokt", "rpc", "dappnode"], "license": "GPL-3.0", "links": { - "ui": "http://pocket.pocket.dappnode/", - "homepage": "https://www.pokt.network", - "Wallet": "https://wallet.pokt.network/", - "Explorer": "https://explorer.pokt.network/" + "ui": "http://pocket.pocket.dappnode", + "homepage": "https://pokt.network", + "Wallet": "https://wallet.pokt.network", + "Explorer": "https://poktscan.com", + "Docs": "https://docs.pokt.network", + "api": "http://pocket.dappnode:8081", + "forum": "https://forum.pokt.network", + "discord": "https://discord.gg/pokt" }, "repository": { "type": "git", @@ -48,16 +54,6 @@ "name": "keyfile", "path": "/home/app/.pocket/config/keyfile.json", "service": "pocket" - }, - { - "name": "addrbook", - "path": "/home/app/.pocket/config/addrbook.json", - "service": "pocket" - }, - { - "name": "chains_mainnet_template", - "path": "/home/app/chains_mainnet_template.json", - "service": "pocket" } ] } From 86d46fc29f7f0a2b30edf3dc50d91dc59cc55015 Mon Sep 17 00:00:00 2001 From: Voss Date: Thu, 2 May 2024 16:25:29 -0500 Subject: [PATCH 03/28] update config for latest settings and to set config values on startup from env variables using jq --- pocket/config_template.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pocket/config_template.json b/pocket/config_template.json index 185149b..c130056 100644 --- a/pocket/config_template.json +++ b/pocket/config_template.json @@ -2,7 +2,7 @@ "tendermint_config": { "RootDir": "/home/app/.pocket", "ProxyApp": "tcp://127.0.0.1:26658", - "Moniker": "node1-DOMAIN", + "Moniker": "${DOMAIN}", "FastSyncMode": true, "DBBackend": "goleveldb", "LevelDBOptions": { @@ -61,8 +61,8 @@ "UPNP": false, "AddrBook": "config/addrbook.json", "AddrBookStrict": false, - "MaxNumInboundPeers": "${MAX_PEERS_INBOUND}", - "MaxNumOutboundPeers": "${MAX_PEERS_OUTBOUND}", + "MaxNumInboundPeers": 28, + "MaxNumOutboundPeers": 7, "UnconditionalPeerIDs": "", "PersistentPeersMaxDialPeriod": 0, "FlushThrottleTimeout": 100000000, @@ -134,7 +134,7 @@ "tendermint_uri": "tcp://localhost:26657", "keybase_name": "pocket-keybase", "rpc_port": "8081", - "client_session_sync_allowance": "${SESSION_ROLLOVER}", + "client_session_sync_allowance": 0, "client_block_sync_allowance": 10, "max_evidence_cache_entries": 500, "max_session_cache_entries": 500, @@ -157,6 +157,6 @@ "generate_token_on_start": false, "lean_pocket": false, "lean_pocket_user_key_file": "lean_nodes_keys.json", - "prevent_negative_reward_claim": "${BACKFIRE_PROTECTION}" + "prevent_negative_reward_claim": false } } From d0e5e5b181611aac09294ce4b6b8aab066380199 Mon Sep 17 00:00:00 2001 From: Voss Date: Thu, 2 May 2024 19:25:37 -0500 Subject: [PATCH 04/28] add functions file - uPoktToPokt and vice versa --- pocket/ui/src/Functions.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 pocket/ui/src/Functions.ts diff --git a/pocket/ui/src/Functions.ts b/pocket/ui/src/Functions.ts new file mode 100644 index 0000000..2147c8c --- /dev/null +++ b/pocket/ui/src/Functions.ts @@ -0,0 +1,7 @@ +export function upoktToPokt(upokt: number) { + return upokt / 1000000; +} + +export function poktToUpokt(pokt: number) { + return pokt * 1000000; +} From 8fdc458fb259da98faa3489bf2562625726641e8 Mon Sep 17 00:00:00 2001 From: Voss Date: Thu, 2 May 2024 21:37:15 -0500 Subject: [PATCH 05/28] update stake command, add jailed status and badge, update pokt status function, add beacon chains+ state check function, use functions for POKT conversions, optimize main app, test remove shorten address add to types , add checks before staking to avoid failures --- pocket/app.js | 70 +++++++++++++------ pocket/chains/chains_mainnet_template.json | 8 +++ pocket/ui/src/App.tsx | 54 ++++++++------ .../src/components/navbar/wallet/Wallet.tsx | 13 ++-- pocket/ui/src/services/app.service.ts | 7 +- pocket/ui/src/types.ts | 2 + 6 files changed, 102 insertions(+), 52 deletions(-) diff --git a/pocket/app.js b/pocket/app.js index 629341b..96f7b24 100644 --- a/pocket/app.js +++ b/pocket/app.js @@ -17,13 +17,6 @@ app.get('/version', (req, res) => { res.send(version) }) -function upoktToPokt(upokt) { - return upokt / 1000000; -} - -function poktToUpokt(pokt) { - return pokt * 1000000; -} app.get('/api/account', (req, res) => { // res.send( @@ -50,7 +43,9 @@ app.get('/api/account', (req, res) => { address: account?.address ?? address, network: network, initialized: account != null ? true : false, + shortAddress: account?.shortAddress ?? shortAddress, node: node, + jailed: node?.jailed ?? false, }; res.send(response); }); @@ -84,6 +79,32 @@ function checkEthereumState(url) { } } +// curl -X GET http://lighthouse-holesky.dappnode:3500/eth/v1/node/syncing -H "accept: application/json" | jq + +// % Total % Received % Xferd Average Speed Time Time Time Current +// Dload Upload Total Spent Left Speed +// 100 112 100 112 0 0 245 0 --:--:-- --:--:-- --:--:-- 245 +// { +// "data": { +// "is_syncing": false, +// "is_optimistic": false, +// "el_offline": false, +// "head_slot": "1475263", +// "sync_distance": "1" +// } +// } +function checkBeaconState(url) { + try { + const syncing = JSON.parse(shell.exec(`curl -X GET -H "accept: application/json" ${url}/eth/v1/node/syncing`).stdout.trim()); + if (syncing.data.is_syncing === false) { + return 2; + } + return 1; + } catch (error) { + return 0; + } +} + function checkNearState(url) { try { const syncing = JSON.parse(shell.exec(`curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"status","params":[],"id":1}' ${url}`).stdout.trim()); @@ -111,20 +132,21 @@ function checkAvalancheState(url) { // TODO: Test Pokt State Functionality + Remove other params commented out when successful with current params function checkPoktState(url) { try { - url = `tcp://localhost:26657`; - const localNodeHeight = JSON.parse(shell.exec(`curl ${url}/status`).stdout.trim()); - //if (localNodeHeight.result.sync_info.catching_up === false && prunedSnapshot.result === ........ - const prunedSnapshot = JSON.parse(shell.exec(`echo $PRUNED_SNAPSHOT`).stdout.trim()); - //const localHeight = JSON.parse(shell.exec(`curl -X POST -H {Content-Type:\ application/json} --json {} ${url}/v1/query/height`).stdout.trim()); + //url = `tcp://localhost:26657`; MUST USE HTTP for cURL to work doesn't support tcp://localhost:26657 + var newUrl = url.replace(/:8081$/, ':26657'); + //const syncing = JSON.parse(shell.exec(`curl ${newUrl}/status`).stdout.trim()); + const syncing = JSON.parse(shell.exec(`curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"status","params":[],"id":-1}' "${newUrl}"`).stdout.trim()); + //const syncing = JSON.parse(shell.exec(`curl http://localhost:26657/status`).stdout.trim()); + var prunedSnapshot = shell.exec(`echo $PRUNED_SNAPSHOT`).stdout.trim(); + //const localHeight = JSON.parse(shell.exec(`curl -X POST -H {Content-Type:\ application/json} --json {} ${url}/v1/query/height`).stdout.trim()); //const currentHeight = JSON.parse(shell.exec(`curl https://mainnet.rpc.grove.city/v1/xxxxxxxx/v1/query/height`).stdout.trim()); //const nodeHeight = JSON.parse(shell.exec(`pocket query height --datadir=/home/app/.pocket/ | tail -n +2`).stdout.trim()); - if (localNodeHeight.result.sync_info.catching_up === false && prunedSnapshot.result === "Yes") { + if (syncing.result.sync_info.catching_up === false && prunedSnapshot == 'Yes') { return 3; - } else if (localNodeHeight.result.sync_info.catching_up === false && prunedSnapshot.result === "No") { + } else if (syncing.result.sync_info.catching_up === false && prunedSnapshot == 'No') { return 2; - } else if (localNodeHeight.result.sync_info.catching_up === true) { - return 1; - } + } else if (syncing.result.sync_info.catching_up === true) { + } return 1; } catch (error) { return 0; } @@ -138,8 +160,10 @@ function checkStateChain(type, url) { return checkNearState(url); case "avalanche": return checkAvalancheState(url); + case "beacon": + return checkBeaconState(url); case "pokt": - return checkPoktState(); + return checkPoktState(url); default: return 0; } @@ -164,7 +188,6 @@ app.get('/api/availableChains', (req, res) => { state: checkStateChain(chains[chain.id].type, chain.url), } }); - res.send(response); }) @@ -188,14 +211,14 @@ app.post('/api/replaceChains', (req, res) => { if (chainsFiltered && chainsFiltered.length > 0) { let response = JSON.stringify(chainsFiltered, null, 2); shell.exec(`echo '${response}' > /home/app/.pocket/config/chains.json`); - shell.exec(`pkill pocket`); +// shell.exec(`pkill pocket`); This should no longer be needed since the addition of the config option for hot chains reload to be set to `true` this command no longer kills the Pocket process improving performance on initial test nodes so far, with no errors without kiling the process everytime it needs to reload the chains.json file. res.send(response); } else { throw new Error("Empty json"); } }) -app.post('/api/stake', (req, res) => { +app.post('/api/stakeCustodial', (req, res) => { // console.log(req.body.amount); // console.log(req.body.chains); // res.send({}); @@ -249,5 +272,6 @@ const mainnetChains = { "03DF": {"name": "EVM AVAX DFK Subnet", "type": "avalanche"}, "A003": {"name": "Avalanche Archival", "type": "avalanche"}, "A053": {"name": "Optimism Archival", "type": "ethereum"}, -} - + "B021": {"name": "Ethereum Beacon", "type": "beacon"}, + "B081": {"name": "Holesky Beacon", "type": "beacon"}, +}; diff --git a/pocket/chains/chains_mainnet_template.json b/pocket/chains/chains_mainnet_template.json index 62cca69..3a6b49d 100644 --- a/pocket/chains/chains_mainnet_template.json +++ b/pocket/chains/chains_mainnet_template.json @@ -62,5 +62,13 @@ { "id": "A053", "url": "http://optimism.optimism.public.dappnode:8545" + }, + { + "id": "B021", + "url": "http://beacon-chain.lodestar.dappnode:3500" + }, + { + "id": "B081", + "url": "http://beacon-chain.teku-holesky.dappnode:3500" } ] diff --git a/pocket/ui/src/App.tsx b/pocket/ui/src/App.tsx index 631ea29..a82d950 100644 --- a/pocket/ui/src/App.tsx +++ b/pocket/ui/src/App.tsx @@ -3,6 +3,7 @@ import { Button, Form } from "react-bootstrap"; import NavBar from "./components/navbar/NavBar"; import Footer from "./components/footer/Footer"; import { AppService } from './services/app.service'; +import { upoktToPokt } from "./Functions"; // Styles import "./App.scss"; import "bootstrap/dist/css/bootstrap.css"; @@ -27,9 +28,8 @@ function App() { setAccount(account); if (amountToStake) {} else { - setAmountToStake(account.amountStaked > 0 ? (account.amountStaked / 1000000) : 0); + setAmountToStake(account.amountStaked > 0 ? upoktToPokt(account.amountStaked) : 0); } - if (account && account.initialized) { try { await getAvailableChains(account); @@ -65,24 +65,36 @@ function App() { setCurrentBlock(block); } - const stake = async () => { + const stakeCustodial = async () => { try { setTxhash(null); + if (account?.jailed === true) { + throw new Error("Your Node is jailed, you must Unjail your Node before Staking/Re-Staking"); + } if ((amountToStake ?? 0) < 15100) { throw new Error(`Minimum amount to stake is 15,100 POKT`); } - if ((amountToStake ?? 0) > ((Number(account?.amount ?? 0) + Number(account?.amountStaked ?? 0)) / 1000000) - 1) { + if ((amountToStake ?? 0) > upoktToPokt(Number(account?.amount ?? 0) + Number(account?.amountStaked ?? 0)) - 1) { throw new Error(`You do not have enough POKT to stake`); } - const responseStake = await appService.stake(amountToStake ?? 0, Array.from(selectedChains.keys()).join(',')); - console.log(responseStake); - if (!(responseStake.code) && !(responseStake.raw_log) && responseStake.txhash) { - toast.success(`It can take 15+ minutes for the next block to process on the Pocket blockchain. This means you will likely have to wait 15+ minutes before your validator will be active.`); - setTxhash(responseStake.txhash); + if ((amountToStake ?? 0) < upoktToPokt(Number(account?.amountStaked ?? 0))) { + throw new Error(`You cannot re-stake below the amount you have already staked`); + } + if (selectedChains.keys.length === 0) { + throw new Error(`You must select at least one chain to Stake/Re-Stake`); + } + if (selectedChains.keys.length > 15) { + throw new Error(`You cannot stake more than 15 chains at a time`); + } + const responseStakeCustodial = await appService.stakeCustodial(amountToStake ?? 0, Array.from(selectedChains.keys()).join(',')); + console.log(responseStakeCustodial); + if (!(responseStakeCustodial.code) && !(responseStakeCustodial.raw_log) && responseStakeCustodial.txhash) { + toast.success(`It can take 15+ minutes for the next block to process on the Pocket blockchain. This means you may have to wait 15+ minutes before your validator will be active when staking for the first time, and similarly while re-staking chains or amounts, etc.`); + setTxhash(responseStakeCustodial.txhash); await replaceChains(); return; } - throw new Error(`Error while staking: ${JSON.stringify(responseStake)}`); + throw new Error(`Error while staking: ${JSON.stringify(responseStakeCustodial)}`); } catch (e) { toast.error((e as Error).message); console.error(e); @@ -122,14 +134,14 @@ function App() { return () => { clearInterval(interval); }; - }, [first, selectedChains, txhash]); + }, [first, selectedChains, txhash, getCurrentBlock, getAccount]); const chainState = (state: number) => { switch (state) { case 1: return "Syncing"; case 2: return "Running"; - case 3: return "Running but Pruned"; - default: return "Not installed"; + case 3: return "Running but Pruned; Cannot Relay"; + default: return "Not Installed"; } } @@ -142,33 +154,33 @@ function App() {
- Current block height + Current Block Height - Current synced block in Dappnode + Current Highest Synced Block In This Dappnode Pokt Node
Address - Target Address to stake + Target Address To Stake
- Amount {(account?.amountStaked ?? 0) > 0 ? `(Staked: ${(account?.amountStaked ?? 0) / 1000000} POKT)` : ``} + Amount {(account?.amountStaked ?? 0) > 0 ? `(Staked: ${upoktToPokt(account?.amountStaked ?? 0)} POKT)` : ``} setAmountToStake(parseInt(e.target.value))} @@ -222,7 +234,7 @@ function App() {
{txhash && ( @@ -250,7 +262,7 @@ function App() {

- {shortenAddress(account.address)} + {account.shortAddress}

- +

+ {account.jailed ? "Jailed" : "Not Jailed"} +

{account.network}

- {account.amount ? {(account.amount / 1000000).toFixed(2)} POKT : Unknown} + {account.amount ? {upoktToPokt(account.amount).toFixed(2)} POKT : Unknown}

)} diff --git a/pocket/ui/src/services/app.service.ts b/pocket/ui/src/services/app.service.ts index 4911522..ff03aec 100644 --- a/pocket/ui/src/services/app.service.ts +++ b/pocket/ui/src/services/app.service.ts @@ -1,3 +1,4 @@ +import { upoktToPokt } from "../Functions"; const axios = require('axios'); export class AppService { @@ -14,9 +15,9 @@ export class AppService { return response.data.height; } - public async stake(stakeAmount: number, chains: string) { - const amount = Math.floor(stakeAmount * 1000000); - const response = await axios.post(`/api/stake`, {amount, chains}); + public async stakeCustodial(stakeAmount: number, chains: string) { + const amount = Math.floor(upoktToPokt(stakeAmount)); + const response = await axios.post(`/api/stakeCustodial`, {amount, chains}); return response.data; } diff --git a/pocket/ui/src/types.ts b/pocket/ui/src/types.ts index 4b53ba8..aa1ef4a 100644 --- a/pocket/ui/src/types.ts +++ b/pocket/ui/src/types.ts @@ -4,6 +4,8 @@ export interface Account { address: string; network: string; node: any; + jailed: boolean; + shortAddress: string; } export interface Chain { From 3c6b32bee463aeed42fa617352a6b1cb1dda70b2 Mon Sep 17 00:00:00 2001 From: Voss Date: Thu, 2 May 2024 22:08:17 -0500 Subject: [PATCH 06/28] add seeds 5+6, create setupwizard and add configurable settings on install and in the config tab of the package --- docker-compose.yml | 14 +++++------ setup-wizard.yml | 63 +++++++++++++++++++++++++--------------------- 2 files changed, 42 insertions(+), 35 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ee05898..fb30e32 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,17 +1,16 @@ version: "3.5" services: pocket: - image: "pocket.pocket.dnp.dappnode.eth:0.1.0" + image: pocket.pocket.dnp.dappnode.eth:0.1.0 build: context: pocket args: UPSTREAM_VERSION: RC-0.11.1 restart: unless-stopped volumes: - - "pocket-mainnet:/home/app/.pocket/" + - pocket-mainnet:/home/app/.pocket/ ports: - - "26656:26656/udp" - - "26656:26656/tcp" + - 26656:26656/tcp environment: KEYFILE_PASSPHRASE: null NETWORK: mainnet @@ -20,12 +19,13 @@ services: ARIA2_SNAPSHOT: "Yes" PRUNED_SNAPSHOT: "Yes" COMPRESSED_SNAPSHOT: "Yes" - BACKFIRE_PROTECTION: false + BACKFIRE_PREVENTION: false PERSISTENT_PEERS: "" MAX_PEERS_INBOUND: 28 MAX_PEERS_OUTBOUND: 7 - SEEDS: "7c0d7ec36db6594c1ffaa99724e1f8300bbd52d0@seed1.mainnet.pokt.network:26662,cdcf936d70726dd724e0e6a8353d8e5ba5abdd20@seed2.mainnet.pokt.network:26663,74b4322a91c4a7f3e774648d0730c1e610494691@seed3.mainnet.pokt.network:26662,b3235089ff302c9615ba661e13e601d9d6265b15@seed4.mainnet.pokt.network:26663" - SESSION_ROLLOVER: 0 + SEEDS: >- + 7c0d7ec36db6594c1ffaa99724e1f8300bbd52d0@seed1.mainnet.pokt.network:26662,cdcf936d70726dd724e0e6a8353d8e5ba5abdd20@seed2.mainnet.pokt.network:26663,74b4322a91c4a7f3e774648d0730c1e610494691@seed3.mainnet.pokt.network:26662,b3235089ff302c9615ba661e13e601d9d6265b15@seed4.mainnet.pokt.network:26663,ab5776d1c9a50d47e30e90a0600e787d9fb74643@seed5.mainnet.pokt.network:26664,a6dec84acfe1bae887cd6c4f2eeb864fae29c9f7@seed6.mainnet.pokt.network:26664 + SESSION_ROLLOVER: "0" ADVANCED_CONFIG: "No" EXTRA_OPTS: "" ulimits: diff --git a/setup-wizard.yml b/setup-wizard.yml index dadf0bb..99c0da8 100644 --- a/setup-wizard.yml +++ b/setup-wizard.yml @@ -8,8 +8,7 @@ fields: title: Wallet keyfile description: >- Upload an account using an Encrypted ASCII armored keyfile. You can create a new [keyfile/wallet here](https://wallet.pokt.network/) and then upload the generated keyfile.json here. - Currently the Pocket Web Wallet allows for making these armored keyfiles needed to stake usisng a few methods, please use the keyfile option, if you use Ledger you cannot stake with that account, you can only hold coins not staked or as a cold wallet for holding non-custodial rewards in an offline wallet though it will matter more once we introduce non-custodial staking where you can stake only th minimum required stake while all rewards go to a controller address, which can be offline to keep from earning rewards in your hot wallet needed to Stake with Pokt(Make sure it's a custodial address, we do not yet have non custodial funtionality but it's on our short term roadmap along with allowing for LeanPocket use, a way to easily run multiple separate staked addresses on one machine and package using just a single Pocket Chain Instance) - Note: Please do not use a `$` or `!` in your passphrase because it may cause issues with the Pokt UI and will break the CLI. + Currently the Pocket Web Wallet allows for making these armored keyfiles needed to stake usisng a few methods, please use the keyfile option, if you use Ledger you cannot stake with that account (currently at least, there is a project in progress to enable this functionality), you can only hold coins not staked or as a cold wallet for holding non-custodial rewards in an offline wallet though it will matter more once we introduce non-custodial staking where you can stake only th minimum required stake while all rewards go to a controller address, which can be offline to keep from earning rewards in your hot wallet needed to Stake with Pokt(Make sure it's a custodial address, we do not yet have non custodial funtionality but it's on our short term roadmap along with allowing for LeanPocket use, a way to easily run multiple separate staked addresses on one machine and package using just a single Pocket Chain Instance) - id: passphrase target: type: environment @@ -17,9 +16,11 @@ fields: service: pocket title: Passphrase secret: true + required: true description: >- Passphrase to decrypt the keyfile. - Note: Please do not use a `$` or `!` in your passphrase because it may cause issues with the Pokt UI and will break the CLI used in advanced troubleshooting (Doesn't make it impossible, but adds a step). If your wallet already created has these characters please change your keyfile passphrase by going [here](https://wallet.pokt.network/) input your wallet via its private key or the keyfile and its original password, once you've logged into your wallet via one of those 2 methods you can export the wallet as a keyfile and it will have you set a new keyfile password, be sure to make it compliant with these rules. Upload this keyfile to your node and enter the new compliant password to begin the app and click update. + Note: If you get errors in the logs while starting up that keeps the logs in a loop, or if you get errors while attempting to stake/re-stake, unjail, unstake, or sign messages, there may be an issue with your chosen passphrase. There have been issues in the past where certain special characters such as `$`, `!`, and some other more obscure special characters in your passphrase may cause issues with the Pokt UI may break the CLI used in our backend. + Please reach out to Dappnode support on Discord if you have issues like this, as we discovvered the root of the issue and beleive we have resolved this issue, though we havent tested every edge case, so please contact support if you have an issue with your passphrase. - id: prunedSnapshot target: type: environment @@ -60,7 +61,7 @@ fields: - "No" default: "Yes" description: >- - You can choose to download the snapshot file as a .tar archive, or as a compressed lz4.tar archive. The lz4.tar archive is slightly smaller, but takes more system resources to decompress. If you have a slower internet connection, or a fast node, and want to save download time and bandwidth, select `No`. + You can choose to download the snapshot file as a .tar archive, or as a compressed .lz4.tar archive. The .lz4.tar archive is slightly smaller, but takes more system resources to decompress. If you have a slower internet connection, or a fast node, and want to save download time and bandwidth, feel free to select `No` in most cases you'll want the Compressed Snapshot. - id: snapshotMirror target: type: environment @@ -77,7 +78,7 @@ fields: It's often best to leave this option as the default master domain which auto-selects the best mirror for your location), but on Mondays at 00:00UTC, the master server is updated first, and the slave mirrors are updated a few hours later, so if you are installing on a Monday, you may want to select `Yes` to use the U.K master server which will have the most up to date snapshot ready for download first before any of the other mirrors that would be auto-selected if you were not already in the Master UK zone anyway. - id: advancedConfig description: >- - If you are an advanced user or troubleshooting with support and would like to configure the config file with more advanced configuration options such as: max peers, session rollover, edit seeds from defaults, set persistent peers, select `Yes`. + If you are an advanced user or troubleshooting with support and would like to configure the config file with more advanced configuration options such as: max peers, session rollover, edit seeds from defaults, set persistent peers, etc. select `Yes` to display these options. target: type: environment name: ADVANCED_CONFIG @@ -86,36 +87,40 @@ fields: enum: - "Yes" - "No" + default: "No" + required: true - id: maxPeersInbound target: type: environment name: MAX_PEERS_INBOUND service: pocket title: "Max Inbound Peers" + type: number description: >- The maximum number of inbound peers that your node will accept. The default is 28, but you can set this to a higher/lower number if you have limited bandwidth or system resources resulting in poor performance. Be sure to set this to a number that is less than the number of peers you have set in the `persistentPeers` field if you have set that field. Also if be sure to increase this value before increasing Outbound peers. pattern: "^(?:[0-9]|[1-3][0-9]|40)$" patternMessage: "Please enter a whole number between 0 and 40." - required: true default: 28 - if: { "advancedConfig": { "emum": ["Yes"] } } + required: true + if: { "advancedConfig": { "enum": ["Yes"] } } - id: maxPeersOutbound target: type: environment name: MAX_PEERS_OUTBOUND service: pocket title: "Max Outbound Peers" + type: number description: >- The maximum number of outbound peers that your node will connect to. The default is 7, but you can set this to a higher/lower number if you have limited bandwidth or system resources resulting in poor performance, lower this number. Be sure to set this to a number that is less than the number of peers you have set in the `persistentPeers` field if you have set that field. Also if be sure to keep this value at default of 7 before decreasing Inbound peers, if you have unlimited fast bandwidth or bad peers shown in the logs, you may want to increase this value above the default of 7. pattern: "^(?:[0-9]|1[0-9]|20)$" - patternMessage: "Please enter a whole number between 0 and 40." + patternMessage: "Please enter a whole number between 0 and 20." required: true default: 7 - if: { "advancedConfig": { "emum": ["Yes"] } } + if: { "advancedConfig": { "enum": ["Yes"] } } - id: sessionRollover target: type: environment @@ -124,13 +129,13 @@ fields: title: "Session Rollover" description: >- Session Rollover is an advanced option to allow claims+proofs to rollover to the next session, by default this is set to 0 and nothing rolls over sessions, possibly decreasing rewards. - If you would like to possibly increase rewards by allowing claims+proofs to rollover to the next session, set this to 1, this may have a negative effect on your node's performance and may not be recommended for all nodes. + If you would like to possibly increase rewards by allowing claims+proofs to rollover to the next session, set this to `1`, though this may have a negative effect on your node's performance and may not be recommended for all nodes. enum: - - 0 - - 1 + - "0" + - "1" required: true - default: 0 - if: { "advancedConfig": { "emum": ["Yes"] } } + default: "0" + if: { "advancedConfig": { "enum": ["Yes"] } } - id: persistentPeers target: type: environment @@ -140,9 +145,9 @@ fields: description: >- A comma separated list of persistent peers to connect to. If you have a list of peers that you would like to connect to, you can enter them here. If you do not have a list of peers, leave this field blank. Note: If you have a list of persistent peers set, be sure to set the `maxPeersInbound` and `maxPeersOutbound` fields to a number that is higher than the number of persistent peers you have set here. - pattern: "^(?:[a-zA-Z0-9]+@[0-9]+(?:\\.[0-9]+){3}:[0-9]+,?)+$" - patternMessage: "Please enter a comma separated list of known peers in the format `@:`." - if: { "advancedConfig": { "emum": ["Yes"] } } + #pattern: "^(?:[a-zA-Z0-9]+@[0-9]+(?:\\.[0-9]+){3}:[0-9]+,?)+$" + #patternMessage: "Please enter a comma separated list of peers in the format `@:`." + if: { "advancedConfig": { "enum": ["Yes"] } } - id: seeds target: type: environment @@ -151,26 +156,28 @@ fields: title: "Seeds" description: >- A comma separated list of seeds to connect to. If you have a list of seeds that you would like to connect to, you can enter them here. If you do not have a list of seeds, leave this field blank. - Note: If you leave this field blank, the default seeds will be applied to your config file, if you have a list of seeds set here, the default seeds will be overwritten with your selection of seeds here. If you want to add seeds to the default seeds, you can add them here in addition to the default seeds `7c0d7ec36db6594c1ffaa99724e1f8300bbd52d0@seed1.mainnet.pokt.network:26662,cdcf936d70726dd724e0e6a8353d8e5ba5abdd20@seed2.mainnet.pokt.network:26663,74b4322a91c4a7f3e774648d0730c1e610494691@seed3.mainnet.pokt.network:26662,b3235089ff302c9615ba661e13e601d9d6265b15@seed4.mainnet.pokt.network:26663` - default: "7c0d7ec36db6594c1ffaa99724e1f8300bbd52d0@seed1.mainnet.pokt.network:26662,cdcf936d70726dd724e0e6a8353d8e5ba5abdd20@seed2.mainnet.pokt.network:26663,74b4322a91c4a7f3e774648d0730c1e610494691@seed3.mainnet.pokt.network:26662,b3235089ff302c9615ba661e13e601d9d6265b15@seed4.mainnet.pokt.network:26663" - pattern: "^(?:[a-zA-Z0-9]+@[0-9]+(?:\\.[0-9]+){3}:[0-9]+,?)+$" - patternMessage: "Please enter a comma separated list of seeds in the format `@:`." - if: { "advancedConfig": { "emum": ["Yes"] } } + Note: If you leave this field blank, the default seeds will be applied to your config file, if you have a list of seeds set here, the default seeds will be overwritten with your selection of seeds here. If you want to add seeds to the default seeds, you can add them here in addition to the default seeds `7c0d7ec36db6594c1ffaa99724e1f8300bbd52d0@seed1.mainnet.pokt.network:26662,cdcf936d70726dd724e0e6a8353d8e5ba5abdd20@seed2.mainnet.pokt.network:26663,74b4322a91c4a7f3e774648d0730c1e610494691@seed3.mainnet.pokt.network:26662,b3235089ff302c9615ba661e13e601d9d6265b15@seed4.mainnet.pokt.network:26663,ab5776d1c9a50d47e30e90a0600e787d9fb74643@seed5.mainnet.pokt.network:26664,a6dec84acfe1bae887cd6c4f2eeb864fae29c9f7@seed6.mainnet.pokt.network:26664` + default: "7c0d7ec36db6594c1ffaa99724e1f8300bbd52d0@seed1.mainnet.pokt.network:26662,cdcf936d70726dd724e0e6a8353d8e5ba5abdd20@seed2.mainnet.pokt.network:26663,74b4322a91c4a7f3e774648d0730c1e610494691@seed3.mainnet.pokt.network:26662,b3235089ff302c9615ba661e13e601d9d6265b15@seed4.mainnet.pokt.network:26663,ab5776d1c9a50d47e30e90a0600e787d9fb74643@seed5.mainnet.pokt.network:26664,a6dec84acfe1bae887cd6c4f2eeb864fae29c9f7@seed6.mainnet.pokt.network:26664" + #pattern: "^(?:[a-zA-Z0-9]+@[0-9]+(?:\\.[0-9]+){3}:[0-9]+,?)+$" + #patternMessage: "Please enter a comma separated list of seeds in the format `@:`." + required: true + if: { "advancedConfig": { "enum": ["Yes"] } } - id: backFirePrevention target: type: environment name: BACKFIRE_PREVENTION service: pocket title: "Backfire Prevention Enabled?" + type: boolean description: >- Backfire Prevention is an advanced option to attempt to prevent your node from processing claims that may result in a reward lower than the cost of the claim. - Leave this setting at 0 if you do not want to enable backfire prevention, which is the default Pokt setting. - By setting this value to 1, you are allowing your node to prevent claims that may result in a reward lower than the cost of the claim, which is 0.01 Pokt currently. + Leave this setting as `false` if you do not want to enable backfire prevention, which is the default Pokt setting. + By setting this value to `true`, you are allowing your node to prevent claims that may result in a reward lower than the cost of the claim, which is 0.01 POKT (10,000 uPOKT) currently. Note: This is not an exact setting as the claim reward value is an estimate until the proof is submitted, so this setting may not be 100% effective in preventing claims that may result in a reward lower than the cost of the claim. Also note that this setting may have a larger effect on nodes staked in the lowest bracket as they earn far less rewards than those in upper breackets, Also this setting may have a negative effect on your node's performance for chains with very little activity. enum: - - 0 - - 1 + - "true" + - "false" required: true - default: 0 - if: { "advancedConfig": { "emum": ["Yes"] } } + default: "false" + if: { "advancedConfig": { "enum": ["Yes"] } } From cad8caa94c566b9358c39c6872ff0f84bd952350 Mon Sep 17 00:00:00 2001 From: Voss Date: Thu, 2 May 2024 22:12:26 -0500 Subject: [PATCH 07/28] Update Dockerfile to use latest version of update-browserslist-db --- pocket/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pocket/Dockerfile b/pocket/Dockerfile index 4a92f7f..855af6a 100644 --- a/pocket/Dockerfile +++ b/pocket/Dockerfile @@ -8,8 +8,9 @@ COPY ui /app/ui WORKDIR /app/ui RUN yarn && yarn build +RUN npx update-browserslist-db@latest -#Starting with version BETA-0.10.2 of the v0 Pokt Core, the Docker package registry has been replaced by the Github Container Registry at ghcr.io/pokt-network/pocket-v0:BETA-0.10.2 +#Starting with version BETA-0.10.2 of the v0 Pokt Core, the DockerHub package registry has been replaced by the Github Container Registry at ghcr.io/pokt-network/pocket-v0:latest. FROM ghcr.io/pokt-network/pocket-v0:${UPSTREAM_VERSION} WORKDIR /home/app/ @@ -17,6 +18,7 @@ WORKDIR /home/app/ USER root # RUN apk add -u gettext curl jq nginx supervisor lz4 aria2 +# RUN apk update RUN apk add -u gettext curl jq nodejs npm supervisor lz4 aria2 ADD entrypoint.sh /usr/local/bin/entrypoint.sh @@ -32,10 +34,12 @@ ADD app.js /home/app/app.js ADD chains/chains_mainnet_template.json /home/app/chains_mainnet_template.json ADD chains/chains_testnet_template.json /home/app/chains_testnet_template.json RUN npm install express shelljs +RUN npx update-browserslist-db@latest COPY --from=build-ui /app/ui/build /home/app/build COPY dummyui /home/app/dummyui +EXPOSE 80 EXPOSE 8081 EXPOSE 26656 ENTRYPOINT ["entrypoint.sh"] From d4a1ad31b0edb573071133191318994a91fc62c3 Mon Sep 17 00:00:00 2001 From: Voss Date: Thu, 2 May 2024 22:40:35 -0500 Subject: [PATCH 08/28] Create new aria download script, add cleanup funcctions, add significant error handling, add jq config scripts, add new wget inline script-needs testing still --- pocket/entrypoint.sh | 315 ++++++++++++++++++++++++++++++------------- 1 file changed, 224 insertions(+), 91 deletions(-) diff --git a/pocket/entrypoint.sh b/pocket/entrypoint.sh index 8f0247f..53dab44 100755 --- a/pocket/entrypoint.sh +++ b/pocket/entrypoint.sh @@ -1,15 +1,60 @@ #!/bin/bash -# TODO: M Remove after testing -# set -x +# TODO: V Remove after testing +set -x ERROR="[ ERROR ]" WARN="[ WARN ]" INFO="[ INFO ]" -# Replace domain +# Replace domain, seeds, max peers inbound/outbound, backfire protection, session rollover and persistent peers in the config file with environment variables export DOMAIN=${_DAPPNODE_GLOBAL_DOMAIN} -envsubst < /home/app/.pocket/config/config_template.json > /home/app/.pocket/config/config.json +export SEEDS=${SEEDS} +export PERSISTENT_PEERS=${PERSISTENT_PEERS} +export MAX_PEERS_INBOUND=${MAX_PEERS_INBOUND} +export MAX_PEERS_OUTBOUND=${MAX_PEERS_OUTBOUND} +export BACKFIRE_PREVENTION=${BACKFIRE_PREVENTION} +export SESSION_ROLLOVER=${SESSION_ROLLOVER} +export PRUNED=${PRUNED_SNAPSHOT} + +# Run envsubst before the jq commands and write the modified output to config_template.json +echo "${INFO} Substituting environment variables in the config_template.json file..." +envsubst < /home/app/.pocket/config/config_template.json > temp.json +if [ $? -ne 0 ]; then + echo "${ERROR} Failed to set ENV variables in Config. Confirm you have valid entries for the config options Seeds and Persistent Peers in the Pocket package config tab. If you don't see an issue with your config, please contact support. Exiting..." + sleep 60 + exit 1 +fi +# Process the modified config_template.json file with jq commands and write the output to config.json +jq --arg max_peers_inbound "${MAX_PEERS_INBOUND}" '.tendermint_config.P2P.MaxNumInboundPeers = ($max_peers_inbound|tonumber)' temp.json > temp2.json && rm temp.json +if [ $? -ne 0 ]; then + echo "${ERROR} Failed to set Max Inbound Peers in the Config. Confirm you have a valid entry for the Max Inbound Peers value in the Pocket package config tab. If you don't see an issue with your input please contact support. Exiting..." + sleep 60 + exit 1 +fi +jq --arg max_peers_outbound "${MAX_PEERS_OUTBOUND}" '.tendermint_config.P2P.MaxNumOutboundPeers = ($max_peers_outbound|tonumber)' temp2.json > temp3.json && rm temp2.json +if [ $? -ne 0 ]; then + echo "${ERROR} Failed to set Max Outbound Peers in the Config. Confirm you have a valid entry for the Max Outbound Peers value in the Pocket package config tab. If you don't see an issue with your input please contact support. Exiting..." + sleep 60 + exit 1 +fi +jq --arg session_rollover "${SESSION_ROLLOVER}" '.pocket_config.client_session_sync_allowance = ($session_rollover|tonumber)' temp3.json > temp4.json && rm temp3.json +if [ $? -ne 0 ]; then + echo "${ERROR} Failed to set Session Rollover in the Config. Confirm you have a valid entry for the Session Rollover value in the Pocket package config tab. If you don't see an issue with your input please contact support. Exiting..." + sleep 60 + exit 1 +fi +jq --arg backfire_prevention "${BACKFIRE_PREVENTION}" 'if $backfire_prevention == "true" then .pocket_config.prevent_negative_reward_claim = true else .pocket_config.prevent_negative_reward_claim = false end' temp4.json > /home/app/.pocket/config/config.json && rm temp4.json +if [ $? -ne 0 ]; then + echo "${ERROR} Failed to set Backfire Prevention in the Config. Confirm you have a valid entry for the Backfire Prevention value in the Pocket package config tab. If you don't see an issue with your input please contact support. Exiting..." + sleep 60 + exit 1 +else + echo "${INFO} Config file updated successfully!" +fi + +#jq --arg session_rollover "${SESSION_ROLLOVER}" 'if $session_rollover == 1 then .pocket_config.client_session_sync_allowance = 1 else .pocket_config.client_session_sync_allowance = 0 end' temp3.json > temp4.json +#jq --arg backfire_prevention "${BACKFIRE_PREVENTION}" 'if $backfire_prevention == true then .pocket_config.prevent_negative_reward_claim = true else .pocket_config.prevent_negative_reward_claim = false end' temp4.json > /home/app/.pocket/config/config.json ############# # FUNCTIONS # @@ -28,25 +73,138 @@ function stop_downloading_ui () { echo "${INFO} Downloading snapshot UI - Stopped" } +# Function to cleanup failed snapshot downloads +function cleanup_failed_snapshot () { + rm -r -f /home/app/.pocket/data \ + /home/app/.pocket/pocket* \ + /home/app/.pocket/$fileName \ + /home/app/.pocket/$latestFile \ + /home/app/.pocket/*.aria \ + /home/app/.pocket/*.tmp +} + +# Function to download latest snapshot via Aria2c +function download_snapshot() { + status=-1 + while (( status != 0 )) + do + PIDS=$(pgrep '^aria2c$') + if [ -z "$PIDS" ]; then + echo "${INFO} aria2c -o $latestFile -s16 -x16 -k100M $downloadURL &" + aria2c -o $latestFile -s16 -x16 -k100M $downloadURL & + pid=$! + fi + if kill -0 $pid 2>/dev/null; then + wait $pid + fi + status=$? + echo "${INFO} Aria Snapshot Download Exited." + case $status in + 3) + echo "${WARN} Cannot access snapshot or file does not exist on server. \ + Please check the snapshot URL and try again." + echo "${ERROR} Exiting..." + echo "${INFO} Removing incomplete snapshot files..." + cleanup_failed_snapshot + sleep 100 + exit 3 + ;; + 9) + echo "${WARN} No space left on device for this snapshot, make room or try downloading a pruned snapshot; they're orders of magnitude smaller than a full snapshot." + echo "${ERROR} Exiting..." + echo "${INFO} Removing incomplete snapshot files..." + cleanup_failed_snapshot + sleep 1000 + exit 9 + ;; + *) + continue + ;; + esac + done + # download succeeded. + return 0 +} + # Function to check if the snapshot download is complete function is_complete() { - if [[ -f "${latestFile}" ]]; then - # Check if the file is a valid tar archive - tar -tf "$latestFile" >/dev/null 2>&1 - if [[ $? -eq 0 ]]; then - return 0 - fi + if [[ -f "${latestFile}" ]]; then + # Check if the file is a valid tar archive + file "${latestFile}" + if [[ $? -eq 0 ]] && [[ "${latestFile}" == *.tar ]] || [[ "${latestFile}" == *.tar.lz4 ]]; then + if [[ "${latestFile}" == *.tar.lz4 ]]; then + lz4 -cd "${latestFile}" | tar -tf - + else + tar -tf "${latestFile}" + fi + if [[ $? -eq 0 ]]; then + return 0 + fi + fi + fi + return 1 +} + +# function is_complete() { +# if [[ -f "${latestFile}" ]]; then +# # Check if the file is a valid tar archive +# tar -tf "$latestFile" >/dev/null 2>&1 +# if [[ $? -eq 0 ]]; then +# return 0 +# fi +# fi +# return 1 +# } + +# Tabnine suggests this function to download the snapshot inline, but is not tested yet. +function download_inline_snapshot() { + local downloadURL="$1" + local latestFile="$2" + local retries=0 + local max_retries=5 + + while ! [ -f "$latestFile" ] || ! [ -s "$latestFile" ]; do + if [ $retries -ge $max_retries ]; then + echo "${ERROR} Download failed after $max_retries retries, try using aria download or a pruned download if this fails multiple times. exiting..." + echo "${INFO} Cleaning up and exiting..." + cleanup_failed_snapshot + sleep 500 + exit 1 + fi + retries=$((retries+1)) + echo "${INFO} Download failed, retrying in 10 seconds (retry $retries of $max_retries)..." + sleep 10 + + if [[ "$latestFile" == *.tar.lz4 ]]; then + echo "${INFO} Downloading and decompressing the latest compressed snapshot file..." + echo "${INFO} wget -c -O - ${downloadURL} | lz4 -d - | tar -xv -" + wget -c -O - "${downloadURL}" | lz4 -d - | tar -xv - + else + echo "${INFO} Downloading and decompressing the latest uncompressed snapshot file..." + echo "${INFO} wget -c -O - ${downloadURL} | tar -xv -" + wget -c -O - "${downloadURL}" | tar -xv - + fi + + if [ ! -f "$latestFile" ] || ! [ -s "$latestFile" ]; then + echo "${ERROR} Download failed, the downloaded file is not a valid tar archive." + rm "$latestFile" fi - return 1 -} + done + + echo "${INFO} Snapshot Downloaded and Decompressed!" + echo "${INFO} Removing temporary snapshot file metadata..." + rm "${fileName}" + echo "${INFO} Snapshot Ready!" + stop_downloading_ui +} # Function to extract the downloaded file to /home/app/.pocket/ directory function extract_file() { - if [[ $latestFile == *.tar.lz4 ]]; then - lz4 -c -d "$latestFile" | tar -xv -C /home/app/.pocket/ - elif [[ $latestFile == *.tar ]]; then - tar -xvf "$latestFile" -C /home/app/.pocket/ - fi + if [[ $latestFile == *.tar.lz4 ]]; then + lz4 -c -d "$latestFile" | tar -xv -C /home/app/.pocket/ + elif [[ $latestFile == *.tar ]]; then + tar -xvf "$latestFile" -C /home/app/.pocket/ + fi } ######## @@ -60,14 +218,15 @@ echo "${INFO} pocket accounts list --datadir=/home/app/.pocket/" pocket accounts list --datadir=/home/app/.pocket/ if ! [ "$?" -eq 0 ] ;then echo "${INFO} pocket accounts import-armored /home/app/.pocket/config/keyfile.json --datadir=/home/app/.pocket/ --pwd-decrypt --pwd-encrypt" - pocket accounts import-armored /home/app/.pocket/config/keyfile.json --datadir=/home/app/.pocket/ --pwd-decrypt ${KEYFILE_PASSPHRASE} --pwd-encrypt ${KEYFILE_PASSPHRASE} - if ! [ "$?" -eq 0 ] ;then - echo "${ERROR} It has not been possible to import the wallet" - sleep 1000 - exit 1 - fi + pocket accounts import-armored /home/app/.pocket/config/keyfile.json --datadir=/home/app/.pocket/ --pwd-decrypt ${KEYFILE_PASSPHRASE} --pwd-encrypt ${KEYFILE_PASSPHRASE} + if ! [ "$?" -eq 0 ] ;then + echo "${ERROR} It has not been possible to import the uploaded wallet. Please check the passphrase and the integrity of your keyfile.json file." + sleep 1000 + exit 1 + fi fi -## # Create an account if it doesn't exist + +## # Create an account if it doesn't exist // This is something we definitely should do (unless we add a new service to the package that runs the official Pocket WWallet) but we need to find a way to make absolutely sure that the user downloads a backup of the newly generated keystore and set keyfile_passphrase from config, not sure how to do this elegantly. ## if ! [ "$?" -eq 0 ] ;then ## pocket accounts create --pwd ${KEYFILE_PASSPHRASE} --datadir=/home/app/.pocket/ ## fi @@ -76,23 +235,23 @@ fi echo "${INFO} pocket accounts set-validator --pwd --datadir=/home/app/.pocket/ account" pocket accounts set-validator --pwd ${KEYFILE_PASSPHRASE} --datadir=/home/app/.pocket/ `pocket accounts list --datadir=/home/app/.pocket/ | cut -d' ' -f2- ` if ! [ "$?" -eq 0 ] ;then - echo "${ERROR} It has not been possible to set the validator" - sleep 1000 - exit 1 + echo "${ERROR} It has not been possible to set the validator" + sleep 1000 + exit 1 fi -# Check pocket node -echo "${INFO} pocket start --simulateRelay --datadir=/home/app/.pocket/" -pocket start --simulateRelay --datadir=/home/app/.pocket/ & -PID_SIMULATE_RELAY=$! -sleep 2 -OUTPUT=$(curl -X POST --data '{"relay_network_id":"0021","payload":{"data":"{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\":[\"0x8D97689C9818892B700e27F316cc3E41e17fBeb9\", \"latest\"],\"id\":1}","method":"POST","path":"","headers":{}}}' https://pocket-pocket.${_DAPPNODE_GLOBAL_DOMAIN}/v1/client/sim) -if echo "$OUTPUT" | grep "no such host"; then - echo "${ERROR} It has not been possible to simulate relays" -else - echo "${INFO} OK" -fi -kill $PID_SIMULATE_RELAY +## Check pocket node by simulating relays +#echo "${INFO} pocket start --simulateRelay --datadir=/home/app/.pocket/" +#pocket start --simulateRelay --datadir=/home/app/.pocket/ & +#PID_SIMULATE_RELAY=$! +#sleep 2 +#OUTPUT=$(curl -X POST --data '{"relay_network_id":"0021","payload":{"data":"{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\":[\"0x8D97689C9818892B700e27F316cc3E41e17fBeb9\", \"latest\"],\"id\":1}","method":"POST","path":"","headers":{}}}' https://pocket-pocket.${_DAPPNODE_GLOBAL_DOMAIN}/v1/client/sim) +#if echo "$OUTPUT" | grep "no such host"; then +# echo "${ERROR} It has not been possible to simulate relays" +#else +# echo "${INFO} OK" +#fi +#kill $PID_SIMULATE_RELAY # Check if the node is initialized with SNAPSHOT # Handle Snapshot Download and Decompression if needed @@ -123,7 +282,7 @@ if [ "$NETWORK" == "mainnet" ] && ! $is_update; then start_downloading_ui mkdir -p /home/app/.pocket/ cd /home/app/.pocket/ - echo "${INFO} Downloading snapshot file version..." + echo "${INFO} Downloading latest snapshot file version..." echo "${INFO} wget -O ${fileName} ${SNAPSHOT_URL}" wget -O "${fileName}" "${SNAPSHOT_URL}" echo "${INFO} ${fileName}: $(cat $fileName)" @@ -131,10 +290,10 @@ if [ "$NETWORK" == "mainnet" ] && ! $is_update; then downloadURL="${MIRROR_URL}${latestFile}" if [ "$ARIA2_SNAPSHOT" == "Yes" ]; then - echo "${INFO} Initializing with Aria2 SNAPSHOT, it could take several hours..." - echo "${INFO} Starting aria2 download..." - echo "${INFO} aria2c -x16 -s16 -o ${latestFile} ${downloadURL}" - aria2c -x16 -s16 -o "${latestFile}" "${downloadURL}" + echo "${INFO} Initializing with Aria2c SNAPSHOT, it could take several hours to complete for an non-pruned full node..." + echo "${INFO} Starting Aria2c download..." + # echo "${INFO} aria2c -x16 -s16 -o ${latestFile} ${downloadURL}" + # aria2c -x16 -s16 -o "${latestFile}" "${downloadURL}" # # Loop until the download is complete \\ This does not work so far likely a syntax error, but so far no tests have led to failures yet with this config, on my test nodes at least # while [[ ! $(is_complete) ]]; do @@ -143,64 +302,32 @@ if [ "$NETWORK" == "mainnet" ] && ! $is_update; then # aria2c -x16 -s16 -o "${latestFile}" "${downloadURL}" # done ################################################################ - # # BSC aria restart script for aria2c - #!/bin/bash -# if [ $# -eq 1 ]; then -# dir=$(pwd) -# elif [ $# -eq 2 ]; then -# dir=$2 -# else -# echo "Usage: $0 [filepath] " -# exit 1 -# fi -# uri=$1 -# filename=$(basename "$uri") -# status=-1 -# while (( status != 0 )) -# do -# PIDS=$(pgrep '^aria2c$') -# if [ -z "$PIDS" ]; then -# echo "aria2c -d $dir -o $filename -s14 -x14 -k100M $uri" -# aria2c -d $dir -o $filename -s14 -x14 -k100M $uri -# fi -# status=$? -# pid=$(pidof aria2c) -# wait $pid -# echo aria2c exit. -# case $status in -# 3) -# echo file not exist. -# exit 3 -# ;; -# 9) -# echo No space left on device. -# exit 9 -# ;; -# *) -# continue -# ;; -# esac -# done -# echo download succeed. -# exit 0 - ################################################################ - echo "${INFO} Download complete!" + # Call the Aria2c Download Snapshot Function + download_snapshot + echo "${INFO} Aria2 Download of Snapshot Complete!" # Extract the downloaded file to /home/app/.pocket/ directory echo "${INFO} Extracting the downloaded file to /home/app/.pocket/ ..." extract_file - + if [ $? -ne 0 ]; then + echo "${ERROR} extracting the downloaded snapshot exited with non-zero exit code. Exiting..." + echo "${INFO} Cleaning up and exiting..." + cleanup_failed_snapshot + sleep 500 + exit 1 + fi + # Delete the source file - echo "${INFO} Deleting the source file, and metadata file..." + echo "${INFO} Deleting the Snapshot source file and metadata file..." rm "${latestFile}" "${fileName}" echo "${INFO} Extraction and cleanup of snapshot complete!" stop_downloading_ui else - ### WGET INLINE SNAPSHOT - ############################################################################################################## - echo "${INFO} Initializing with wget inline SNAPSHOT, it could take several hours..." + ### WGET INLINE SNAPSHOT######### curl option should be faster and more resiliant curl -L -O -C - "${downloadURL}" | lz4 -d - | tar -xv - + ########################################################################################## + echo "${INFO} Initializing with wget inline SNAPSHOT, it could take several hours or days to download a NON-pruned snapshot..." max_retries=5 retries=0 @@ -210,6 +337,9 @@ if [ "$NETWORK" == "mainnet" ] && ! $is_update; then while ! wget -c -O - "${downloadURL}" | lz4 -d - | tar -xv -; do if [ $retries -ge $max_retries ]; then echo "Download failed after $max_retries retries, try using aria download or a pruned download if this fails multiple times. exiting..." + echo "${INFO} Cleaning up and exiting..." + cleanup_failed_snapshot + sleep 500 exit 1 fi retries=$((retries+1)) @@ -235,6 +365,9 @@ if [ "$NETWORK" == "mainnet" ] && ! $is_update; then while ! wget -c -O - "${downloadURL}" | tar -xv -; do if [ $retries -ge $max_retries ]; then echo "${INFO} Download failed after $max_retries retries, try using aria download or a pruned download if this fails multiple times. exiting..." + echo "${INFO} Cleaning up and exiting..." + cleanup_failed_snapshot + sleep 500 exit 1 fi retries=$((retries+1)) From 5196abe71b1ea4fdd5104d2ee02b6d9723b6d193 Mon Sep 17 00:00:00 2001 From: Voss Date: Thu, 2 May 2024 23:08:02 -0500 Subject: [PATCH 09/28] Update dappnode_package.json bump version to 0.1.6 to match master --- dappnode_package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dappnode_package.json b/dappnode_package.json index 369a750..72e6906 100644 --- a/dappnode_package.json +++ b/dappnode_package.json @@ -1,6 +1,6 @@ { "name": "pocket.dnp.dappnode.eth", - "version": "0.1.5", + "version": "0.1.6", "upstreamVersion": "RC-0.11.1", "upstreamRepo": "pokt-network/pocket-core", "upstreamArg": "UPSTREAM_VERSION", @@ -10,8 +10,8 @@ "architectures": ["linux/amd64"], "mainService": "pocket", "author": "DAppNode Association (https://github.com/dappnode)", - "contributors": ["eduadiez (https://github.com/eduadiez)", - "Voss (https://github.com/alexpeterson91)", + "contributors": ["Voss (https://github.com/alexpeterson91)", + "eduadiez (https://github.com/eduadiez)", "mgarciate (https://github.com/mgarciate)"], "categories": ["Blockchain", "Economic incentive"], "keywords": ["blockchain", "ethereum", "web3", "infrastructure", "pocket", "pokt", "rpc", "dappnode"], From 581730725b5b3a600cf1962395387b2b99285b02 Mon Sep 17 00:00:00 2001 From: Voss Date: Thu, 2 May 2024 23:39:37 -0500 Subject: [PATCH 10/28] debug config options, use string not boolean for valid compose file --- docker-compose.yml | 2 +- setup-wizard.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index fb30e32..943407f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: ARIA2_SNAPSHOT: "Yes" PRUNED_SNAPSHOT: "Yes" COMPRESSED_SNAPSHOT: "Yes" - BACKFIRE_PREVENTION: false + BACKFIRE_PREVENTION: "false" PERSISTENT_PEERS: "" MAX_PEERS_INBOUND: 28 MAX_PEERS_OUTBOUND: 7 diff --git a/setup-wizard.yml b/setup-wizard.yml index 99c0da8..3795912 100644 --- a/setup-wizard.yml +++ b/setup-wizard.yml @@ -168,7 +168,6 @@ fields: name: BACKFIRE_PREVENTION service: pocket title: "Backfire Prevention Enabled?" - type: boolean description: >- Backfire Prevention is an advanced option to attempt to prevent your node from processing claims that may result in a reward lower than the cost of the claim. Leave this setting as `false` if you do not want to enable backfire prevention, which is the default Pokt setting. From 102f59dac0e7ab5586f11db6308d4547490c040a Mon Sep 17 00:00:00 2001 From: Voss Date: Fri, 3 May 2024 00:01:14 -0500 Subject: [PATCH 11/28] remove shorten address function thats no longer called to remove error in eslinst preventing build on CI --- pocket/ui/src/components/navbar/wallet/Wallet.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pocket/ui/src/components/navbar/wallet/Wallet.tsx b/pocket/ui/src/components/navbar/wallet/Wallet.tsx index bca63c7..7b4cecb 100644 --- a/pocket/ui/src/components/navbar/wallet/Wallet.tsx +++ b/pocket/ui/src/components/navbar/wallet/Wallet.tsx @@ -1,7 +1,7 @@ import { Badge } from "react-bootstrap"; import { FaWallet } from "react-icons/fa"; import { Account } from '../../../types'; -import { upoktToPokt } from "../../../Functions"; +import { upoktToPokt } from '../../../Functions'; import "./Wallet.scss"; @@ -10,11 +10,6 @@ export default function Wallet({ }: { account: Account | undefined; }) { - -// function shortenAddress(address: string) { -// return address.substring(0, 4) + "..." + address.substring(address.length - 4); - } - return (
{account && ( @@ -37,4 +32,4 @@ export default function Wallet({ )}
); -} +} \ No newline at end of file From f94f832fc30db7d344203e5720804ce3a32090e0 Mon Sep 17 00:00:00 2001 From: Voss Date: Fri, 3 May 2024 00:03:18 -0500 Subject: [PATCH 12/28] Update README.md spelling mistake (#94) (#96) Spelling: endpoint incorrectly spelled Co-authored-by: Tom-K --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6e63c64..432e80f 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ More information about the source project can be found at their [Official Websit -Support your favorite applications and networks by sharing access to your node's enpoint via Pokt Network's by providing decentralized access for developers and users building and running applications on the Pokt Network. Join this novel decentalized infrastructure network that rewards servicer and validator nodes for the necessary work to keep public RPC endpoints for dozens of different blockchains properly decentralized and secure. +Support your favorite applications and networks by sharing access to your node's endpoint via Pokt Network's by providing decentralized access for developers and users building and running applications on the Pokt Network. Join this novel decentalized infrastructure network that rewards servicer and validator nodes for the necessary work to keep public RPC endpoints for dozens of different blockchains properly decentralized and secure. ### Requirements From 96109726eca83423ee9339b42790081adeb68598 Mon Sep 17 00:00:00 2001 From: Voss Date: Tue, 7 May 2024 21:03:35 -0500 Subject: [PATCH 13/28] update max_claim_age_for_proof_retry param to 96 as Ian from cryptonode tools suggested in discord in Jan 2024 for his own config, tripling the value --- pocket/config_template.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pocket/config_template.json b/pocket/config_template.json index c130056..8975f8e 100644 --- a/pocket/config_template.json +++ b/pocket/config_template.json @@ -146,7 +146,7 @@ "rpc_timeout": 30000, "pocket_prometheus_port": "8083", "prometheus_max_open_files": 3, - "max_claim_age_for_proof_retry": 32, + "max_claim_age_for_proof_retry": 96, "proof_prevalidation": false, "ctx_cache_size": 20, "abci_logging": false, From 8ecf34a342339a3a38cc140845db9f1ee6e9b9e2 Mon Sep 17 00:00:00 2001 From: Voss Date: Mon, 17 Jun 2024 21:25:47 -0500 Subject: [PATCH 14/28] update UI link in manifest --- dappnode_package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dappnode_package.json b/dappnode_package.json index 72e6906..5c9c922 100644 --- a/dappnode_package.json +++ b/dappnode_package.json @@ -17,7 +17,7 @@ "keywords": ["blockchain", "ethereum", "web3", "infrastructure", "pocket", "pokt", "rpc", "dappnode"], "license": "GPL-3.0", "links": { - "ui": "http://pocket.pocket.dappnode", + "ui": "http://pocket.dappnode", "homepage": "https://pokt.network", "Wallet": "https://wallet.pokt.network", "Explorer": "https://poktscan.com", From 1b04d347356a4e8ed316fff02fba35b72cf59dab Mon Sep 17 00:00:00 2001 From: Voss Date: Mon, 17 Jun 2024 21:28:11 -0500 Subject: [PATCH 15/28] update setup wizard wording, change defaults, add pattern checking for keyfile password --- setup-wizard.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/setup-wizard.yml b/setup-wizard.yml index 3795912..1661a5d 100644 --- a/setup-wizard.yml +++ b/setup-wizard.yml @@ -8,13 +8,15 @@ fields: title: Wallet keyfile description: >- Upload an account using an Encrypted ASCII armored keyfile. You can create a new [keyfile/wallet here](https://wallet.pokt.network/) and then upload the generated keyfile.json here. - Currently the Pocket Web Wallet allows for making these armored keyfiles needed to stake usisng a few methods, please use the keyfile option, if you use Ledger you cannot stake with that account (currently at least, there is a project in progress to enable this functionality), you can only hold coins not staked or as a cold wallet for holding non-custodial rewards in an offline wallet though it will matter more once we introduce non-custodial staking where you can stake only th minimum required stake while all rewards go to a controller address, which can be offline to keep from earning rewards in your hot wallet needed to Stake with Pokt(Make sure it's a custodial address, we do not yet have non custodial funtionality but it's on our short term roadmap along with allowing for LeanPocket use, a way to easily run multiple separate staked addresses on one machine and package using just a single Pocket Chain Instance) + Currently the Pocket Web Wallet allows for making these armored keyfiles needed to stake usisng a few methods, please use the keyfile option, if you use Ledger you cannot stake with that account (currently at least, when we add non-custodial staking and the new staking method a ledger wallet can be used to delegate funds to a StakeNew node, or stake non-custodially, we do not yet have non-custodial or StakeNew funtionality enabled but it's on our short term roadmap along with allowing for LeanPocket, a way to run multiple servicers on one Pokt Node). - id: passphrase target: type: environment name: KEYFILE_PASSPHRASE service: pocket title: Passphrase + pattern: ^(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*()-_=+])(?=.*[a-z]).{8,}$ # Minimum 8 characters, at least one uppercase letter, one lowercase letter, one number and one special character + patternMessage: "Please enter a passphrase that is at least 8 characters long and contains at least one uppercase letter, one lowercase letter, one number, and one special character. Usable special characters are: !@#$%^&*()-_=+" # Minimum 8 characters, at least one uppercase letter, one lowercase letter, one number and one special character from this list: !@#$%^&*()-_=+ secret: true required: true description: >- @@ -33,8 +35,8 @@ fields: - "No" default: "Yes" description: >- - If you have limited disk space and cannot hold the full ~1.1TB Pokt chain or have issues downloading the chain snapshot due to disconnections from an unstable connection, etc., then you can download a pruned snapshot of the Pokt chain that currently is only ~60gb instead of ~1TB. - Note: THIS PARAMETER CANNOT BE CHANGED once set initially during setup, before the snapshot download begins. While you can technically change the setting to non-pruned after downloading the pruned snapshot, it will not work to relay as the Pokt chain is pruned down very heavily and if you enable full snapshot after downloading the pruned snapshot it may enable the ability to select Pokt as a relay chain to stake in the Pokt UI but because it's not nearly a full node it may possibly result in penalties for your node or if you choose to use a pruned snapshot to relay that you cannot relay the full Pokt chain on your node since you only have the pruned data needed to keep you verifying the chain but not storing any (technically and normally not needed data: Historical Transactions, Historical states, and Historical blocks, etc.). This app does or shortly will automatically disable this option for you but if it doesn't just be sure not to enable relaying/staking the Pokt Mainnet Chain (0001) if you downloaded a pruned snapshot, or pruned your own chain. + If you have limited disk space and cannot hold the full ~1.3TB Pokt chain or have issues downloading the chain snapshot due to disconnections from an unstable connection, etc., then you can download a pruned snapshot of the Pokt chain that currently is only ~80GB instead of ~1.2TB. + Note: THIS PARAMETER CANNOT BE CHANGED once set initially during setup, before the snapshot download begins. While you can technically change the setting to non-pruned after downloading the pruned snapshot, it will not work to relay as the Pokt chain is pruned down very heavily and if you enable full snapshot after downloading the pruned snapshot it may enable the ability to select Pokt as a relay chain to stake in the Pokt UI but because it's not nearly a full node it may possibly result in penalties for your node or if you choose to use a pruned snapshot to relay that you cannot relay the full Pokt chain on your node since you only have the pruned data needed to keep you verifying the chain but not storing any (technically and normally not needed data: Historical Transactions, Historical states, and Historical blocks, etc.). This app does not yet but shortly will automatically disable this option for you but if it doesn't just be sure not to enable relaying/staking the Pokt Mainnet Chain (0001) if you downloaded a pruned snapshot, or pruned your own chain. - id: inlineDecompression target: type: environment @@ -45,9 +47,9 @@ fields: enum: - "Yes" - "No" - default: "Yes" + default: "No" description: >- - If you have limited disk space, and do not have room for ~2TB to download and extract the full snapshot (as of Late December 2023 the full compressed snapshot download is over 730 GB and needs to be downloaded fully and then extracted, using an enormous amount of diskspace during the initial download and extraction but once it's done it will be only ~ 800GB total for the full (unpruned, read more on pruned snapshots below) Pokt Chain. If you don't have the space for this, but have have enugh space for the ~1TB Pokt blockchain, you can attempt to use inline decompression, this saves from needing to have double the disk space, however if you dont have a very reliable high badwidth internet connection, this method will fail and need to be restarted from the beginning and cannot be restarted from where it left off, select `No` if you would like to try this way. + If you have limited disk space, and do not have room for ~2.5TB to download and extract the full snapshot seprately (as of Early June 2024 the full compressed snapshot download is over 1.1TB and needs to be downloaded fully and then extracted, using an enormous amount of diskspace (Double ~2.5TB) during the initial download and extraction but once it's done it will be only ~1.3TB total for the full (unpruned, read more on pruned snapshots below) Pokt Chain. If you don't have the space for this, but have have enugh space for the ~1.3TB Pokt blockchain, you can attempt to use inline decompression, this saves from needing to have double the disk space, however if you dont have a very reliable high badwidth internet connection, this method may fail and need to be restarted from the beginning and cannot be restarted from where it left off, select `No` if you would like to try this way. If you want to run a full node and have a lot of free space for install, select `Yes`. - id: compressedSnapshot target: @@ -170,7 +172,7 @@ fields: title: "Backfire Prevention Enabled?" description: >- Backfire Prevention is an advanced option to attempt to prevent your node from processing claims that may result in a reward lower than the cost of the claim. - Leave this setting as `false` if you do not want to enable backfire prevention, which is the default Pokt setting. + Leave this setting as `false` if you do NOT want to enable backfire prevention, which is the default Pokt setting. By setting this value to `true`, you are allowing your node to prevent claims that may result in a reward lower than the cost of the claim, which is 0.01 POKT (10,000 uPOKT) currently. Note: This is not an exact setting as the claim reward value is an estimate until the proof is submitted, so this setting may not be 100% effective in preventing claims that may result in a reward lower than the cost of the claim. Also note that this setting may have a larger effect on nodes staked in the lowest bracket as they earn far less rewards than those in upper breackets, Also this setting may have a negative effect on your node's performance for chains with very little activity. From 54c869a50fa771b7852a2a1d9adc45dcf855aa5f Mon Sep 17 00:00:00 2001 From: Voss Date: Mon, 17 Jun 2024 21:36:15 -0500 Subject: [PATCH 16/28] add unjail node functionality, add unstaking time, and public key to account params for new stake methods, add multiple checks to beacon status (check EL status and optimistic status as well as is_syncing status) begin work on NON-Custodial stake command --- pocket/app.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/pocket/app.js b/pocket/app.js index 96f7b24..4638ca7 100644 --- a/pocket/app.js +++ b/pocket/app.js @@ -43,9 +43,10 @@ app.get('/api/account', (req, res) => { address: account?.address ?? address, network: network, initialized: account != null ? true : false, - shortAddress: account?.shortAddress ?? shortAddress, node: node, jailed: node?.jailed ?? false, + publicKey: node?.public_key ?? "Unknown", + unstakingTime: node?.unstaking_time ?? "0001-01-01T00:00:00Z", }; res.send(response); }); @@ -96,7 +97,7 @@ function checkEthereumState(url) { function checkBeaconState(url) { try { const syncing = JSON.parse(shell.exec(`curl -X GET -H "accept: application/json" ${url}/eth/v1/node/syncing`).stdout.trim()); - if (syncing.data.is_syncing === false) { + if (syncing.data.is_syncing === false && syncing.data.is_optimistic === false && syncing.data.el_offline === false) { return 2; } return 1; @@ -218,6 +219,15 @@ app.post('/api/replaceChains', (req, res) => { } }) +app.post('/api/unjailNode', (req, res) => { + // pocket nodes unjail [flags] + const account = shell.exec(`pocket accounts list --datadir=/home/app/.pocket/ | cut -d' ' -f2- `).stdout.trim(); + const network = shell.exec(`echo $NETWORK`).stdout.trim(); + const passphrase = shell.exec(`echo $KEYFILE_PASSPHRASE`).stdout.trim(); + const response = shell.exec(`pocket nodes unjail ${account} ${account} ${network} 10000 false --datadir=/home/app/.pocket/ --pwd ${passphrase} | tail -n +3`).stdout.trim(); + res.send(response); +}) + app.post('/api/stakeCustodial', (req, res) => { // console.log(req.body.amount); // console.log(req.body.chains); @@ -228,10 +238,18 @@ app.post('/api/stakeCustodial', (req, res) => { const address = shell.exec(`pocket accounts list --datadir=/home/app/.pocket/ | cut -d' ' -f2- `).stdout.trim(); const domain = shell.exec(`echo $_DAPPNODE_GLOBAL_DOMAIN`).stdout.trim(); // https://discord.com/channels/553741558869131266/564836328202567725/967105908347895819 - const response = shell.exec(`pocket nodes stake custodial ${address} ${req.body.amount} ${req.body.chains} https://pocket-pocket.${domain}:443 ${network} 10000 false --datadir=/home/app/.pocket/ --pwd "${passphrase}" | tail -n +3`).stdout.trim(); + const response = shell.exec(`pocket nodes stake custodial ${address} ${req.body.amount} ${req.body.chains} https://pocket-pocket.${domain}:443 ${network} 10000 false --datadir=/home/app/.pocket/ --pwd ${passphrase} | tail -n +3`).stdout.trim(); res.send(response); }) +// app.post('/api/stakeNonCustodial', (req, res) => { +// // pocket nodes stake non-custodial [flags] +// const network = shell.exec(`echo $NETWORK`).stdout.trim(); +// const passphrase = shell.exec(`echo $KEYFILE_PASSPHRASE`).stdout.trim(); +// const domain = shell.exec(`echo $_DAPPNODE_GLOBAL_DOMAIN`).stdout.trim(); +// const operatorPublicKey = shell.exec().stdout.trim(); +// }) + var server = app.listen(CUSTOM_UI_HTTP_PORT, function () { var host = server.address().address; var port = server.address().port; From db74deddcae03d3dae2abcbb49d4ff003c7d3f4c Mon Sep 17 00:00:00 2001 From: Voss Date: Mon, 17 Jun 2024 21:41:03 -0500 Subject: [PATCH 17/28] -rename Functions.ts to utils.ts, and fix related imports -fix conversion direction for pokt > upokt -add unjail node api --- pocket/ui/src/services/app.service.ts | 8 ++++++-- pocket/ui/src/{Functions.ts => utils.ts} | 0 2 files changed, 6 insertions(+), 2 deletions(-) rename pocket/ui/src/{Functions.ts => utils.ts} (100%) diff --git a/pocket/ui/src/services/app.service.ts b/pocket/ui/src/services/app.service.ts index ff03aec..df49669 100644 --- a/pocket/ui/src/services/app.service.ts +++ b/pocket/ui/src/services/app.service.ts @@ -1,4 +1,4 @@ -import { upoktToPokt } from "../Functions"; +import { poktToUpokt } from "../utils"; const axios = require('axios'); export class AppService { @@ -16,7 +16,7 @@ export class AppService { } public async stakeCustodial(stakeAmount: number, chains: string) { - const amount = Math.floor(upoktToPokt(stakeAmount)); + const amount = Math.floor(poktToUpokt(stakeAmount)); const response = await axios.post(`/api/stakeCustodial`, {amount, chains}); return response.data; } @@ -26,4 +26,8 @@ export class AppService { return response.data; } + public async unjailNode() { + const response = await axios.post(`/api/unjailNode`); + return response.data; + } } \ No newline at end of file diff --git a/pocket/ui/src/Functions.ts b/pocket/ui/src/utils.ts similarity index 100% rename from pocket/ui/src/Functions.ts rename to pocket/ui/src/utils.ts From a9369c275dd4f3f586a51b4dfae566c79b26d27b Mon Sep 17 00:00:00 2001 From: Voss Date: Mon, 17 Jun 2024 22:27:54 -0500 Subject: [PATCH 18/28] add conditional rendered unstaking time badge, fix imports, revert unstaking time --- pocket/ui/src/components/navbar/wallet/Wallet.tsx | 14 +++++++++++--- pocket/ui/src/types.ts | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pocket/ui/src/components/navbar/wallet/Wallet.tsx b/pocket/ui/src/components/navbar/wallet/Wallet.tsx index 7b4cecb..a1123c7 100644 --- a/pocket/ui/src/components/navbar/wallet/Wallet.tsx +++ b/pocket/ui/src/components/navbar/wallet/Wallet.tsx @@ -1,7 +1,7 @@ import { Badge } from "react-bootstrap"; -import { FaWallet } from "react-icons/fa"; +import { FaWallet, FaClock } from "react-icons/fa"; import { Account } from '../../../types'; -import { upoktToPokt } from '../../../Functions'; +import { upoktToPokt } from '../../../utils'; import "./Wallet.scss"; @@ -10,15 +10,23 @@ export default function Wallet({ }: { account: Account | undefined; }) { + + function shortenAddress(address: string) { + return address.substring(0, 4) + "..." + address.substring(address.length - 4); + } + return (
{account && ( <>

- {account.shortAddress} + {shortenAddress(account.address)}

+

+ {account.unstakingTime !== '0001-01-01T00:00:00Z' && Unstaked Date: {account.unstakingTime}} +

{account.jailed ? "Jailed" : "Not Jailed"}

diff --git a/pocket/ui/src/types.ts b/pocket/ui/src/types.ts index aa1ef4a..100ec52 100644 --- a/pocket/ui/src/types.ts +++ b/pocket/ui/src/types.ts @@ -5,7 +5,8 @@ export interface Account { network: string; node: any; jailed: boolean; - shortAddress: string; + unstakingTime: Date; + publicKey: string; } export interface Chain { From 290f7041b5c01cf342a36578ab2a0b4070797f09 Mon Sep 17 00:00:00 2001 From: Voss Date: Mon, 17 Jun 2024 22:31:58 -0500 Subject: [PATCH 19/28] add link to downloading snapsnot UI page to check logs --- pocket/dummyui/index.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pocket/dummyui/index.html b/pocket/dummyui/index.html index b430193..1ee42a1 100644 --- a/pocket/dummyui/index.html +++ b/pocket/dummyui/index.html @@ -3,7 +3,7 @@ - Downloading snapshot + Downloading Snapshot