Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
echo "Image SHA256: $(sha256sum volara-proof-${{ github.run_number }}.tar.gz | cut -d' ' -f1)" >> release_body.txt

- name: Upload image
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: volara-proof-image
path: volara-proof-${{ github.run_number }}.tar.gz
Expand Down
18 changes: 15 additions & 3 deletions volara_proof/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import os
import sys
import traceback
import zipfile
from typing import Dict, Any

from volara_proof.proof import Proof
from volara_proof.constants import VOLARA_DLP_OWNER_ADDRESS, VOLARA_DLP_OWNER_PUBLIC_KEY_HEX

INPUT_DIR, OUTPUT_DIR = "/input", "/output"

Expand All @@ -25,13 +25,25 @@ def load_config() -> Dict[str, Any]:
}
return config

def assess_validity(validated_permissions) -> bool:
"""Assess the validity of a validated permission."""
for permission in validated_permissions:
if permission["address"] == VOLARA_DLP_OWNER_ADDRESS and permission["public_key"] == VOLARA_DLP_OWNER_PUBLIC_KEY_HEX:
return True
return False


def run() -> None:
"""Generate proofs for all input files."""
config = load_config()
input_files_exist = os.path.isdir(INPUT_DIR) and bool(os.listdir(INPUT_DIR))
print(os.listdir(INPUT_DIR))
print(os.environ)
validated_permissions_str = os.environ.get("VALIDATED_PERMISSIONS", None)
if validated_permissions_str is None:
raise ValueError("VALIDATED_PERMISSIONS environment variable is not set")

validated_permissions = json.loads(validated_permissions_str)
if not assess_validity(validated_permissions):
raise ValueError("Permissions failed to validate")

if not input_files_exist:
raise FileNotFoundError(f"No input files found in {INPUT_DIR}")
Expand Down
2 changes: 2 additions & 0 deletions volara_proof/constants.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
VOLARA_API_URL = "https://api.volara.xyz"
VOLARA_DLP_OWNER_ADDRESS = "0x07cdb997c45a008B803FCC6904a0f7E4383a63b6"
VOLARA_DLP_OWNER_PUBLIC_KEY_HEX = "0xebd0b3dbe1ba0b298bc05c5f22e9b9c0816ac4d5bbfe00d8da2ec11a2be5aa9f3532e107b2bfa9b2b3e521c570392f1868f05ae8e697a499a9d1883777102252"