289
289
EvidenceEntryDict = TypedDict ('EvidenceEntryDict' , {
290
290
'party_id' : int ,
291
291
'action' : str ,
292
- 'data' : Dict [str , Union [int , str , bool ]],
292
+ 'data' : dict [str , Union [int , str , bool ]],
293
293
'timestamp' : int
294
294
})
295
295
296
296
ByzantineEvidenceDict = TypedDict ('ByzantineEvidenceDict' , {
297
297
'type' : str ,
298
- 'evidence' : List [EvidenceEntryDict ],
298
+ 'evidence' : list [EvidenceEntryDict ],
299
299
'timestamp' : int ,
300
300
'signature' : str
301
301
})
302
302
303
303
FieldElement = Union [int , "gmpy2.mpz" ] # Integer field elements
304
- SharePoint = Tuple [FieldElement , FieldElement ] # (x, y) coordinate
305
- ShareDict = Dict [int , SharePoint ] # Maps participant ID to share
304
+ SharePoint = tuple [FieldElement , FieldElement ] # (x, y) coordinate
305
+ ShareDict = dict [int , SharePoint ] # Maps participant ID to share
306
306
Randomizer = FieldElement # Randomizer values for commitments
307
307
308
308
InvalidityProofDict = TypedDict ('InvalidityProofDict' , {
320
320
VerificationSummaryDict = TypedDict ('VerificationSummaryDict' , {
321
321
'total_zero_shares_created' : int ,
322
322
'total_zero_shares_verified' : int ,
323
- 'invalid_shares_detected' : Dict [int , List [int ]],
323
+ 'invalid_shares_detected' : dict [int , list [int ]],
324
324
'participants_with_full_verification' : int ,
325
325
'potential_collusion_detected' : bool ,
326
326
'byzantine_parties_excluded' : int ,
327
- 'byzantine_party_ids' : List [int ]
327
+ 'byzantine_party_ids' : list [int ]
328
328
})
329
329
330
330
VerificationDataDict = TypedDict ('VerificationDataDict' , {
337
337
'hash_based' : bool ,
338
338
'verification_summary' : VerificationSummaryDict ,
339
339
'seed_fingerprint' : str ,
340
- 'verification_proofs' : Dict [int , Dict [int , Any ]]
340
+ 'verification_proofs' : dict [int , dict [int , Any ]]
341
341
})
342
342
343
343
# New TypedDict definitions for more complex return types
357
357
'timestamp' : int ,
358
358
'error_type' : str ,
359
359
'detailed_info' : Optional [str ],
360
- 'share_info' : Optional [Dict [str , Any ]],
361
- 'commitment_info' : Optional [Dict [str , Any ]]
360
+ 'share_info' : Optional [dict [str , Any ]],
361
+ 'commitment_info' : Optional [dict [str , Any ]]
362
362
})
363
363
364
364
ByzantineDetectionResultDict = TypedDict ('ByzantineDetectionResultDict' , {
365
365
'is_byzantine' : bool ,
366
366
'failure_count' : int ,
367
367
'total_shares' : int ,
368
368
'failure_rate' : float ,
369
- 'evidence' : List [ Dict [str , Any ]],
370
- 'affected_participants' : List [int ],
369
+ 'evidence' : list [ dict [str , Any ]],
370
+ 'affected_participants' : list [int ],
371
371
'timestamp' : int
372
372
})
373
373
374
374
DualCommitmentProofDict = TypedDict ('DualCommitmentProofDict' , {
375
- 'feldman_blinding_commitments' : List [Union [Tuple [FieldElement , FieldElement ], FieldElement ]],
376
- 'pedersen_blinding_commitments' : List [FieldElement ],
375
+ 'feldman_blinding_commitments' : list [Union [tuple [FieldElement , FieldElement ], FieldElement ]],
376
+ 'pedersen_blinding_commitments' : list [FieldElement ],
377
377
'challenge' : int ,
378
- 'responses' : List [int ],
379
- 'response_randomizers' : Optional [List [int ]]
378
+ 'responses' : list [int ],
379
+ 'response_randomizers' : Optional [list [int ]]
380
380
})
381
381
382
382
IntegrationResultDict = TypedDict ('IntegrationResultDict' , {
390
390
HashFunc = Callable [[bytes ], Any ]
391
391
RedundantExecutorFunc = Callable [..., Any ]
392
392
393
- HashCommitment = Tuple [FieldElement , Randomizer , Optional [bytes ]] # (hash, randomizer, entropy)
394
- CommitmentList = List [HashCommitment ] # List of commitments
393
+ HashCommitment = tuple [FieldElement , Randomizer , Optional [bytes ]] # (hash, randomizer, entropy)
394
+ CommitmentList = list [HashCommitment ] # List of commitments
395
395
396
396
ProofDict = TypedDict ('ProofDict' , {
397
- 'blinding_commitments' : List [ Tuple [FieldElement , FieldElement ]],
397
+ 'blinding_commitments' : list [ tuple [FieldElement , FieldElement ]],
398
398
'challenge' : FieldElement ,
399
- 'responses' : List [FieldElement ],
400
- 'commitment_randomizers' : List [FieldElement ],
401
- 'blinding_randomizers' : List [FieldElement ],
399
+ 'responses' : list [FieldElement ],
400
+ 'commitment_randomizers' : list [FieldElement ],
401
+ 'blinding_randomizers' : list [FieldElement ],
402
402
'timestamp' : int
403
403
})
404
404
405
- VerificationResult = Tuple [bool , Dict [int , bool ]]
406
- RefreshingResult = Tuple [ShareDict , CommitmentList , Dict [str , Any ]]
405
+ VerificationResult = tuple [bool , dict [int , bool ]]
406
+ RefreshingResult = tuple [ShareDict , CommitmentList , dict [str , Any ]]
407
407
408
- HashCommitment = Tuple [FieldElement , Randomizer , Optional [bytes ]] # (hash, randomizer, entropy)
409
- CommitmentList = List [HashCommitment ] # List of commitments
408
+ HashCommitment = tuple [FieldElement , Randomizer , Optional [bytes ]] # (hash, randomizer, entropy)
409
+ CommitmentList = list [HashCommitment ] # List of commitments
410
410
411
411
ProofDict = TypedDict ('ProofDict' , {
412
- 'blinding_commitments' : List [ Tuple [FieldElement , FieldElement ]],
412
+ 'blinding_commitments' : list [ tuple [FieldElement , FieldElement ]],
413
413
'challenge' : FieldElement ,
414
- 'responses' : List [FieldElement ],
415
- 'commitment_randomizers' : List [FieldElement ],
416
- 'blinding_randomizers' : List [FieldElement ],
414
+ 'responses' : list [FieldElement ],
415
+ 'commitment_randomizers' : list [FieldElement ],
416
+ 'blinding_randomizers' : list [FieldElement ],
417
417
'timestamp' : int
418
418
})
419
419
420
- VerificationResult = Tuple [bool , Dict [int , bool ]]
421
- RefreshingResult = Tuple [ShareDict , CommitmentList , Dict [str , Any ]]
420
+ VerificationResult = tuple [bool , dict [int , bool ]]
421
+ RefreshingResult = tuple [ShareDict , CommitmentList , dict [str , Any ]]
422
422
423
423
# Type Aliases for Complex Types
424
424
HashFunc = Callable [[bytes ], Any ]
@@ -455,7 +455,7 @@ class SerializationError(Exception):
455
455
"""
456
456
def __init__ (self , message : str , detailed_info : Optional [str ] = None ,
457
457
severity : str = "critical" , timestamp : Optional [int ] = None ,
458
- data_format : Optional [str ] = None , checksum_info : Optional [Dict [str , Any ]] = None ):
458
+ data_format : Optional [str ] = None , checksum_info : Optional [dict [str , Any ]] = None ):
459
459
self .message = message
460
460
self .detailed_info = detailed_info
461
461
self .severity = severity
@@ -467,7 +467,7 @@ def __init__(self, message: str, detailed_info: Optional[str] = None,
467
467
self .checksum_info = checksum_info # Stores checksum validation details if applicable
468
468
super ().__init__ (message )
469
469
470
- def get_forensic_data (self , detail_level : Literal ['low' , 'medium' , 'high' ] = 'medium' ) -> Dict [str , Any ]:
470
+ def get_forensic_data (self , detail_level : Literal ['low' , 'medium' , 'high' ] = 'medium' ) -> dict [str , Any ]:
471
471
"""
472
472
Return all forensic information as a dictionary for logging or analysis
473
473
0 commit comments