proof-of-portfolio 0.0.50__py3-none-any.whl → 0.0.52__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- proof_of_portfolio/__init__.py +6 -0
- proof_of_portfolio/_version.py +1 -1
- proof_of_portfolio/proof_generator.py +44 -4
- {proof_of_portfolio-0.0.50.dist-info → proof_of_portfolio-0.0.52.dist-info}/METADATA +1 -1
- {proof_of_portfolio-0.0.50.dist-info → proof_of_portfolio-0.0.52.dist-info}/RECORD +8 -8
- {proof_of_portfolio-0.0.50.dist-info → proof_of_portfolio-0.0.52.dist-info}/WHEEL +0 -0
- {proof_of_portfolio-0.0.50.dist-info → proof_of_portfolio-0.0.52.dist-info}/entry_points.txt +0 -0
- {proof_of_portfolio-0.0.50.dist-info → proof_of_portfolio-0.0.52.dist-info}/top_level.txt +0 -0
proof_of_portfolio/__init__.py
CHANGED
@@ -59,6 +59,7 @@ def _prove_worker(
|
|
59
59
|
annual_risk_free_percentage=4.19,
|
60
60
|
use_weighting=False,
|
61
61
|
bypass_confidence=False,
|
62
|
+
daily_checkpoints=2,
|
62
63
|
):
|
63
64
|
"""
|
64
65
|
Worker function to run proof generation in a separate process.
|
@@ -73,6 +74,7 @@ def _prove_worker(
|
|
73
74
|
annual_risk_free_percentage=annual_risk_free_percentage,
|
74
75
|
use_weighting=use_weighting,
|
75
76
|
bypass_confidence=bypass_confidence,
|
77
|
+
daily_checkpoints=daily_checkpoints,
|
76
78
|
)
|
77
79
|
|
78
80
|
return {
|
@@ -102,6 +104,7 @@ async def prove(
|
|
102
104
|
annual_risk_free_percentage=4.19,
|
103
105
|
use_weighting=False,
|
104
106
|
bypass_confidence=False,
|
107
|
+
daily_checkpoints=2,
|
105
108
|
):
|
106
109
|
"""
|
107
110
|
Generate zero-knowledge proof for miner portfolio data asynchronously.
|
@@ -127,6 +130,7 @@ async def prove(
|
|
127
130
|
annual_risk_free_percentage,
|
128
131
|
use_weighting,
|
129
132
|
bypass_confidence,
|
133
|
+
daily_checkpoints,
|
130
134
|
)
|
131
135
|
return result
|
132
136
|
except Exception as e:
|
@@ -144,6 +148,7 @@ def prove_sync(
|
|
144
148
|
annual_risk_free_percentage=4.19,
|
145
149
|
use_weighting=False,
|
146
150
|
bypass_confidence=False,
|
151
|
+
daily_checkpoints=2,
|
147
152
|
):
|
148
153
|
"""
|
149
154
|
Synchronous wrapper for the prove function for backward compatibility.
|
@@ -163,4 +168,5 @@ def prove_sync(
|
|
163
168
|
annual_risk_free_percentage,
|
164
169
|
use_weighting,
|
165
170
|
bypass_confidence,
|
171
|
+
daily_checkpoints,
|
166
172
|
)
|
proof_of_portfolio/_version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
# This file is auto-generated during build
|
2
|
-
__version__ = "0.0.
|
2
|
+
__version__ = "0.0.52"
|
@@ -253,6 +253,45 @@ def run_bb_prove(circuit_dir):
|
|
253
253
|
return None, False
|
254
254
|
|
255
255
|
|
256
|
+
def aggregate_daily_returns(cps, target_duration, daily_checkpoints=2):
|
257
|
+
"""
|
258
|
+
Aggregate checkpoint returns into daily returns following subnet's daily_return_log logic.
|
259
|
+
Only includes complete days with proper checkpoint accumulation.
|
260
|
+
|
261
|
+
Args:
|
262
|
+
cps: List of checkpoint dictionaries
|
263
|
+
target_duration: Target checkpoint duration in ms
|
264
|
+
daily_checkpoints: Number of checkpoints expected per day (from ValiConfig.DAILY_CHECKPOINTS)
|
265
|
+
"""
|
266
|
+
from datetime import datetime, timezone
|
267
|
+
|
268
|
+
if not cps:
|
269
|
+
return []
|
270
|
+
|
271
|
+
TARGET_CHECKPOINT_DURATION_MS = target_duration
|
272
|
+
|
273
|
+
daily_groups = {}
|
274
|
+
|
275
|
+
for cp in cps:
|
276
|
+
start_time = cp["last_update_ms"] - cp["accum_ms"]
|
277
|
+
full_cell = cp["accum_ms"] == TARGET_CHECKPOINT_DURATION_MS
|
278
|
+
|
279
|
+
running_date = datetime.fromtimestamp(start_time / 1000, tz=timezone.utc).date()
|
280
|
+
|
281
|
+
if full_cell:
|
282
|
+
if running_date not in daily_groups:
|
283
|
+
daily_groups[running_date] = []
|
284
|
+
daily_groups[running_date].append(cp)
|
285
|
+
|
286
|
+
daily_returns = []
|
287
|
+
for running_date, day_checkpoints in sorted(daily_groups.items()):
|
288
|
+
if len(day_checkpoints) == daily_checkpoints:
|
289
|
+
daily_return = sum(cp["gain"] + cp["loss"] for cp in day_checkpoints)
|
290
|
+
daily_returns.append(daily_return)
|
291
|
+
|
292
|
+
return daily_returns
|
293
|
+
|
294
|
+
|
256
295
|
def generate_proof(
|
257
296
|
data=None,
|
258
297
|
miner_hotkey=None,
|
@@ -260,6 +299,7 @@ def generate_proof(
|
|
260
299
|
annual_risk_free_percentage=4.19,
|
261
300
|
use_weighting=False,
|
262
301
|
bypass_confidence=False,
|
302
|
+
daily_checkpoints=2,
|
263
303
|
):
|
264
304
|
"""
|
265
305
|
Core proof generation logic.
|
@@ -274,6 +314,7 @@ def generate_proof(
|
|
274
314
|
annual_risk_free_percentage: Annual risk-free rate percentage (default 4.19)
|
275
315
|
use_weighting: Whether to use weighted calculations (default False)
|
276
316
|
bypass_confidence: Whether to bypass confidence thresholds (default False)
|
317
|
+
daily_checkpoints: Number of checkpoints expected per day (default 2)
|
277
318
|
|
278
319
|
Returns:
|
279
320
|
Dictionary with proof results including status, portfolio_metrics, etc.
|
@@ -611,10 +652,9 @@ def generate_proof(
|
|
611
652
|
|
612
653
|
# Calculate MinMetrics (Python) for comparison with ZK circuit
|
613
654
|
try:
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
daily_log_returns.append(cp["gain"] + cp["loss"])
|
655
|
+
daily_log_returns = aggregate_daily_returns(
|
656
|
+
cps, target_duration, daily_checkpoints
|
657
|
+
)
|
618
658
|
|
619
659
|
if len(daily_log_returns) > 0:
|
620
660
|
python_avg_daily_pnl = MinMetrics.average(daily_log_returns)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: proof-of-portfolio
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.52
|
4
4
|
Summary: Zero-Knowledge Proof framework for verifiable, private portfolio performance metrics
|
5
5
|
Author-email: "Inference Labs, Inc." <info@inferencelabs.com>
|
6
6
|
Requires-Python: >=3.10
|
@@ -1,12 +1,12 @@
|
|
1
|
-
proof_of_portfolio/__init__.py,sha256=
|
2
|
-
proof_of_portfolio/_version.py,sha256=
|
1
|
+
proof_of_portfolio/__init__.py,sha256=YTYX7P0aBNCoRyG_wEX5fTQBMIjF1S4-1VpFqNRWsfQ,4587
|
2
|
+
proof_of_portfolio/_version.py,sha256=nbfRvwjdZE1U_FHiBunVBSCMbjmHZB6Wla5okiWNEbk,66
|
3
3
|
proof_of_portfolio/analyze_data.py,sha256=t80ueFtBUzcWTrPiamiC1HXvw5Em-151zXJx0cCk8sQ,3709
|
4
4
|
proof_of_portfolio/main.py,sha256=JbvdAK7B6hw2sQdjT0EVCiglCQZgN3urKphdeWcW43w,30994
|
5
5
|
proof_of_portfolio/min_metrics.py,sha256=U16B7YRl0UbCterdJ1ksqFOxR5DiQeslUzMVGEWNyog,13211
|
6
6
|
proof_of_portfolio/miner.py,sha256=eGXcPMRQVAepzXJj1ePbbDAf-72E9Yj9n-yfP7GohLw,17177
|
7
7
|
proof_of_portfolio/parsing_utils.py,sha256=Hx61Sby5mEbC6uzhG9G69K7YPCLbjU6vK8fazpNBeLc,6463
|
8
8
|
proof_of_portfolio/post_install.py,sha256=e-57Z_h-svQdjA8ibsM985MXmdV6-KLyymQm3Cgu8YM,5654
|
9
|
-
proof_of_portfolio/proof_generator.py,sha256=
|
9
|
+
proof_of_portfolio/proof_generator.py,sha256=8mNNbp0tILCLMI1wjs-8IYR7wxb7YzKv6f_sShvv69I,29976
|
10
10
|
proof_of_portfolio/signal_processor.py,sha256=JQjnkMJEbv_MWIgKNrjKjrBIcIT5pAkAlCneEOGsqT0,6702
|
11
11
|
proof_of_portfolio/validator.py,sha256=kt3BeaXOffv-h52PZBKV1YHUWtiGsnPte16m3EJpITY,3839
|
12
12
|
proof_of_portfolio/circuits/Nargo.toml,sha256=D6ycN7H3xiTcWHH5wz4qXYTXn7Ht0WgPr9w4B7d8ZGw,141
|
@@ -81,8 +81,8 @@ proof_of_portfolio/tree_generator/Nargo.toml,sha256=O6iSvb-EpV0XcETiDxNgSp7XKNiY
|
|
81
81
|
proof_of_portfolio/tree_generator/target.gz,sha256=7LPzAb8JvKWSDOzyW5vI_6NKQ0aB9cb31q4CWbchFSw,308614
|
82
82
|
proof_of_portfolio/tree_generator/src/main.nr,sha256=zHG_0OphqSROyeVc7yTSEULg4bYS8B-LsmvTzTl8aW4,2393
|
83
83
|
proof_of_portfolio/tree_generator/target/tree_generator.json,sha256=M_bI5et5ncgILJ_Czen4ZsGfWHwComEVxMLQpIWmN1k,1540889
|
84
|
-
proof_of_portfolio-0.0.
|
85
|
-
proof_of_portfolio-0.0.
|
86
|
-
proof_of_portfolio-0.0.
|
87
|
-
proof_of_portfolio-0.0.
|
88
|
-
proof_of_portfolio-0.0.
|
84
|
+
proof_of_portfolio-0.0.52.dist-info/METADATA,sha256=SbYK8mDKeyA5fNUOQzCXdDIejhgF-p-Z2IUoV0FnsQc,7076
|
85
|
+
proof_of_portfolio-0.0.52.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
86
|
+
proof_of_portfolio-0.0.52.dist-info/entry_points.txt,sha256=KeLSJT_UJtr1WiLTkhlGqWQuPKbO_ylgj6OXOC2gJV4,53
|
87
|
+
proof_of_portfolio-0.0.52.dist-info/top_level.txt,sha256=sY5xZnE6YuiISK1IuRHPfl71NV0vXO3N3YA2li_SPXU,19
|
88
|
+
proof_of_portfolio-0.0.52.dist-info/RECORD,,
|
File without changes
|
{proof_of_portfolio-0.0.50.dist-info → proof_of_portfolio-0.0.52.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|