forked from Overclock-Validator/autoclock-validator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dubbelosix
committed
Mar 4, 2023
1 parent
8295770
commit 01e1a5c
Showing
27 changed files
with
887 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
--- | ||
accounts_disk: "nvme1n1" | ||
ledger_disk: "nvme1n1" | ||
swap_mb: 100000 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
sudo systemctl stop sol.service | ||
python3 /mnt/snapshot-finder.py --snapshot_path /mnt/solana-snapshots | ||
sudo systemctl start sol.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import urllib.request | ||
import threading | ||
import json | ||
import time | ||
|
||
MAINNET = "https://api.mainnet-beta.solana.com" | ||
LOCAL = "http://localhost:8899" | ||
PAYLOAD = {"jsonrpc":"2.0","id":1, "method":"getSlot", "params":[{"commitment":"processed"}]} | ||
|
||
def get_slot(req, jsondata, result, idx): | ||
response = urllib.request.urlopen(req, jsondata) | ||
res = response.read() | ||
slotnum = json.loads(res)["result"] | ||
result[idx] = slotnum | ||
|
||
|
||
if __name__ == "__main__": | ||
jsondata = json.dumps(PAYLOAD) | ||
jsondataasbytes = jsondata.encode('utf-8') | ||
content_len = len(jsondataasbytes) | ||
while True: | ||
tlist = [] | ||
reqlist = [] | ||
resultlist = [0,0] | ||
for c,u in enumerate([LOCAL, MAINNET]): | ||
req = urllib.request.Request(u) | ||
req.add_header('Content-Type', 'application/json; charset=utf-8') | ||
req.add_header('Content-Length', content_len) | ||
req.add_header('User-Agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36') | ||
reqlist.append((req, jsondataasbytes, resultlist, c)) | ||
for r in reqlist: | ||
tlist.append(threading.Thread(target = get_slot, args = r)) | ||
for t in tlist: | ||
t.start() | ||
for t in tlist: | ||
t.join() | ||
print("reference : %s"%(resultlist[1])) | ||
print("my node : %s"%(resultlist[0])) | ||
print("slots behind reference : %s"%(resultlist[1] - resultlist[0])) | ||
print("=====\n") | ||
time.sleep(10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
if [ $# -eq 0 ] | ||
then | ||
python3 /mnt/snapcheck.py | ||
fi | ||
sudo systemctl stop sol.service | ||
sudo systemctl start sol.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import urllib.request | ||
import threading | ||
import json | ||
import time | ||
|
||
LOCAL = "http://localhost:8899" | ||
PAYLOAD = {"jsonrpc":"2.0","id":1,"method":"getHighestSnapshotSlot"} | ||
|
||
def get_snap_slot(req, jsondata): | ||
response = urllib.request.urlopen(req, jsondata) | ||
res = response.read() | ||
slotnum = json.loads(res)["result"]["incremental"] | ||
return slotnum | ||
|
||
if __name__ == "__main__": | ||
jsondata = json.dumps(PAYLOAD) | ||
jsondataasbytes = jsondata.encode('utf-8') | ||
content_len = len(jsondataasbytes) | ||
latest_snap = None | ||
while True: | ||
req = urllib.request.Request(LOCAL) | ||
req.add_header('Content-Type', 'application/json; charset=utf-8') | ||
req.add_header('Content-Length', content_len) | ||
req.add_header('User-Agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36') | ||
if latest_snap is None: | ||
latest_snap = get_snap_slot(req,jsondataasbytes) | ||
print("current incr snapshot slot: %s\nsleeping..."%(latest_snap)) | ||
stime = int(time.time()) | ||
time.sleep(1) | ||
latest_incr = get_snap_slot(req,jsondataasbytes) | ||
if latest_incr == latest_snap: | ||
time.sleep(1) | ||
else: | ||
etime = int(time.time()) - stime | ||
break | ||
print("latest incr snapshot slot: %s\nslept: %s seconds"%(latest_incr,etime)) |
Oops, something went wrong.