proof-of-portfolio 0.0.49__py3-none-any.whl → 0.0.51__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.
@@ -1,2 +1,2 @@
1
1
  # This file is auto-generated during build
2
- __version__ = "0.0.49"
2
+ __version__ = "0.0.51"
@@ -228,16 +228,18 @@ def run_bb_prove(circuit_dir):
228
228
  if prove_result.returncode != 0:
229
229
  print("bb prove failed:")
230
230
  print(
231
- [
232
- "bb",
233
- "prove",
234
- "-b",
235
- circuit_file,
236
- "-w",
237
- witness_file,
238
- "-o",
239
- proof_file,
240
- ].join(" ")
231
+ " ".join(
232
+ [
233
+ "bb",
234
+ "prove",
235
+ "-b",
236
+ circuit_file,
237
+ "-w",
238
+ witness_file,
239
+ "-o",
240
+ proof_file,
241
+ ]
242
+ )
241
243
  )
242
244
  print(prove_result.stdout)
243
245
  print(prove_result.stderr)
@@ -251,6 +253,45 @@ def run_bb_prove(circuit_dir):
251
253
  return None, False
252
254
 
253
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
+
254
295
  def generate_proof(
255
296
  data=None,
256
297
  miner_hotkey=None,
@@ -258,6 +299,7 @@ def generate_proof(
258
299
  annual_risk_free_percentage=4.19,
259
300
  use_weighting=False,
260
301
  bypass_confidence=False,
302
+ daily_checkpoints=2,
261
303
  ):
262
304
  """
263
305
  Core proof generation logic.
@@ -272,6 +314,7 @@ def generate_proof(
272
314
  annual_risk_free_percentage: Annual risk-free rate percentage (default 4.19)
273
315
  use_weighting: Whether to use weighted calculations (default False)
274
316
  bypass_confidence: Whether to bypass confidence thresholds (default False)
317
+ daily_checkpoints: Number of checkpoints expected per day (default 2)
275
318
 
276
319
  Returns:
277
320
  Dictionary with proof results including status, portfolio_metrics, etc.
@@ -609,10 +652,9 @@ def generate_proof(
609
652
 
610
653
  # Calculate MinMetrics (Python) for comparison with ZK circuit
611
654
  try:
612
- # Extract raw sum values from checkpoint data (matching subnet's daily_return_log)
613
- daily_log_returns = []
614
- for cp in cps:
615
- daily_log_returns.append(cp["gain"] + cp["loss"])
655
+ daily_log_returns = aggregate_daily_returns(
656
+ cps, target_duration, daily_checkpoints
657
+ )
616
658
 
617
659
  if len(daily_log_returns) > 0:
618
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.49
3
+ Version: 0.0.51
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
1
  proof_of_portfolio/__init__.py,sha256=qzElaoPf0f8YMS4Cr0RKglVy07O9bl-WCWil46zVIfg,4401
2
- proof_of_portfolio/_version.py,sha256=f0UiYuOBHI_FCcG4yx2wIfsSrAuLlb2eIWNVyO79AnE,66
2
+ proof_of_portfolio/_version.py,sha256=pyiIqbViFJgeWeQoO1n4OGoKtepEq7DyrAiGTv0n5XY,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=MUcaPqiWU_Dk5Dn1pF4PKi3G-AUSK-ZdXO9B_oUaEqQ,28555
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.49.dist-info/METADATA,sha256=2K99xOex6EprZmc875y0iLqK8Jisz7BAe8jrKlVOlRU,7076
85
- proof_of_portfolio-0.0.49.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
86
- proof_of_portfolio-0.0.49.dist-info/entry_points.txt,sha256=KeLSJT_UJtr1WiLTkhlGqWQuPKbO_ylgj6OXOC2gJV4,53
87
- proof_of_portfolio-0.0.49.dist-info/top_level.txt,sha256=sY5xZnE6YuiISK1IuRHPfl71NV0vXO3N3YA2li_SPXU,19
88
- proof_of_portfolio-0.0.49.dist-info/RECORD,,
84
+ proof_of_portfolio-0.0.51.dist-info/METADATA,sha256=ioUYeNrI05C1lDkTOzn4COYfaf6Mh1qnJ5S0NZ5e43Y,7076
85
+ proof_of_portfolio-0.0.51.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
86
+ proof_of_portfolio-0.0.51.dist-info/entry_points.txt,sha256=KeLSJT_UJtr1WiLTkhlGqWQuPKbO_ylgj6OXOC2gJV4,53
87
+ proof_of_portfolio-0.0.51.dist-info/top_level.txt,sha256=sY5xZnE6YuiISK1IuRHPfl71NV0vXO3N3YA2li_SPXU,19
88
+ proof_of_portfolio-0.0.51.dist-info/RECORD,,