-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rework proto cruncher to use new rust tz-proto-vanity (#575)
The previous proto cruncher was in python and embedded in this helm chart, running in the utils container. Our new one leverages Igor's project: https://github.com/oxheadalpha/tz-proto-vanity
- Loading branch information
1 parent
79bc192
commit cf7bea5
Showing
7 changed files
with
30 additions
and
100 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.
15 changes: 12 additions & 3 deletions
15
...roto-cruncher/scripts/proto-downloader.py → ...-cruncher/scripts/tezos-proto-cruncher.py
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,24 +1,33 @@ | ||
import boto3 | ||
import os | ||
import subprocess | ||
import sys | ||
|
||
BUCKET_NAME = os.environ["BUCKET_NAME"] | ||
BUCKET_ENDPOINT_URL = os.environ["BUCKET_ENDPOINT_URL"] | ||
BUCKET_REGION = os.environ["BUCKET_REGION"] | ||
|
||
PROTO_NAME = os.environ["PROTO_NAME"] | ||
|
||
import boto3 | ||
VANITY_STRING = os.environ["VANITY_STRING"] | ||
|
||
s3 = boto3.resource( | ||
"s3", region_name=BUCKET_REGION, endpoint_url=f"https://{BUCKET_ENDPOINT_URL}" | ||
) | ||
|
||
print(f"Downloading {PROTO_NAME}") | ||
proto_file = f"/{PROTO_NAME}" | ||
proto_file = f"/opt/{PROTO_NAME}" | ||
s3_bucket = s3.Bucket(BUCKET_NAME) | ||
try: | ||
s3_bucket.download_file(PROTO_NAME, proto_file) | ||
except botocore.exceptions.ClientError as e: | ||
if e.response["Error"]["Code"] == "404": | ||
print("The object does not exist.") | ||
sys.exit(1) | ||
else: | ||
raise | ||
cmd = subprocess.Popen(['/opt/tz-proto-vanity', f'/opt/{PROTO_NAME}', VANITY_STRING, '-f', 'csv'], stdout=subprocess.PIPE) | ||
next(cmd.stdout) # ignore first line of csv | ||
for line in cmd.stdout: | ||
linesplit = line.decode("utf-8").split(",") | ||
print(f"found vanity hash {linesplit[0]} with nonce {linesplit[1]}") | ||
s3.Object(BUCKET_NAME, f"{PROTO_NAME}_{linesplit[0]}").put(Body=linesplit[1]) |
11 changes: 3 additions & 8 deletions
11
charts/tezos-proto-cruncher/scripts/tezos-proto-cruncher.sh
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,11 +1,6 @@ | ||
set -eo pipefail | ||
apk add parallel | ||
apk add py3-pip | ||
pip install boto3 | ||
|
||
python /proto-downloader.py | ||
|
||
if [ -z "${NUM_PARALLEL_PROCESSES}" ]; then | ||
# Launch one process per CPU core to maximize utilization | ||
NUM_PARALLEL_PROCESSES=$(grep -c ^processor /proc/cpuinfo) | ||
fi | ||
seq $NUM_PARALLEL_PROCESSES | parallel --ungroup python /proto-cruncher.py /${PROTO_NAME} | ||
export PYTHONUNBUFFERED=1 | ||
python /tezos-proto-cruncher.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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