-
Notifications
You must be signed in to change notification settings - Fork 49
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
1 parent
126f4e4
commit 87836c2
Showing
6 changed files
with
85 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.12 |
Empty file.
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,6 @@ | ||
def main(): | ||
print("Hello from python-db-explorations!") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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,10 @@ | ||
[project] | ||
name = "python-db-explorations" | ||
version = "0.1.0" | ||
description = "Add your description here" | ||
readme = "README.md" | ||
requires-python = ">=3.12" | ||
dependencies = [] | ||
|
||
[project.scripts] | ||
query-proofs = "query_proofs.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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import sqlite3 | ||
from enum import Enum | ||
|
||
class ProofType(Enum): | ||
SPAN = 1 | ||
AGG = 2 | ||
|
||
class ProofStatus(Enum): | ||
UNREQ = 1 | ||
REQ = 2 | ||
COMPLETE = 3 | ||
FAILED = 4 | ||
|
||
def query_span_proofs(db_path, start_block): | ||
conn = sqlite3.connect(db_path) | ||
cursor = conn.cursor() | ||
|
||
# query = """ | ||
# SELECT * FROM proof_requests | ||
# WHERE type = ? AND status = ? AND start_block = ? | ||
# """ | ||
# cursor.execute(query, (ProofType.SPAN.value, ProofStatus.COMPLETE.value, start_block)) | ||
|
||
query = """ | ||
SELECT * FROM proof_requests | ||
WHERE type = 'SPAN' AND start_block = ? | ||
""" | ||
cursor.execute(query, (start_block,)) | ||
|
||
results = cursor.fetchall() | ||
if results: | ||
first_result = results[0] | ||
# print(f"ID: {first_result[0]}") | ||
# print(f"Type: {first_result[1]}") | ||
# print(f"Start Block: {first_result[2]}") | ||
# print(f"End Block: {first_result[3]}") | ||
# print(f"Status: {first_result[4]}") | ||
# print(f"Request Added Time: {first_result[5]}") | ||
# print(f"Prover Request ID: {first_result[6]}") | ||
# print(f"Proof Request Time: {first_result[7]}") | ||
# print(f"L1 Block Number: {first_result[8]}") | ||
# print(f"L1 Block Hash: {first_result[9]}") | ||
# print(f"Proof: {first_result[10]}") | ||
|
||
# print("Results:", results) | ||
conn.close() | ||
|
||
return results | ||
|
||
if __name__ == "__main__": | ||
print("Querying span proofs") | ||
db_path = "../db/proofs.db" | ||
|
||
start_block = 16843141 # Replace with the desired start block | ||
for i in range(1000): | ||
|
||
proofs = query_span_proofs(db_path, start_block) | ||
|
||
for proof in proofs: | ||
print(f"Proof ID: {proof[0]}, Start Block: {proof[2]}, End Block: {proof[3]}, Status: {proof[4]}, Prover Request ID: {proof[6]}") | ||
start_block += 1 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.