ccf 6.0.15__py3-none-any.whl → 6.0.17__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.
ccf/ledger.py CHANGED
@@ -956,7 +956,13 @@ class LedgerChunk:
956
956
 
957
957
  # If the ledger chunk is not yet committed, the ledger header will be empty.
958
958
  # Default to reading the file size instead.
959
+ full_file_size = os.path.getsize(name)
959
960
  if self._pos_offset > 0:
961
+ if self._pos_offset > full_file_size:
962
+ raise ValueError(
963
+ f"Invalid ledger chunk {name}: File header claims offset table is at {self._pos_offset}, yet file is only {full_file_size} bytes"
964
+ )
965
+
960
966
  self._file_size = self._pos_offset
961
967
 
962
968
  positions_buffer = _peek_all(self._file, self._pos_offset)
@@ -978,6 +984,14 @@ class LedgerChunk:
978
984
 
979
985
  self.start_seqno, self.end_seqno = range_from_filename(name)
980
986
 
987
+ if self.end_seqno is not None:
988
+ tx_count_from_filename = self.end_seqno - self.start_seqno + 1
989
+ tx_count_from_positions = len(self._positions)
990
+ if tx_count_from_filename != tx_count_from_positions:
991
+ raise ValueError(
992
+ f"Invalid ledger chunk {name}: Expected to contain {tx_count_from_filename} transactions due to filename, but found {tx_count_from_positions} by reading file"
993
+ )
994
+
981
995
  def __getitem__(self, key):
982
996
  if isinstance(key, int):
983
997
  position = self._positions[key]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ccf
3
- Version: 6.0.15
3
+ Version: 6.0.17
4
4
  Summary: Set of tools and utilities for the Confidential Consortium Framework (CCF)
5
5
  Author-email: CCF Team <CCF-Sec@microsoft.com>
6
6
  Project-URL: Homepage, https://github.com/microsoft/ccf
@@ -1,7 +1,7 @@
1
1
  ccf/__init__.py,sha256=7h-KCpYSfH_Z8x5CFAoDlHfY0wqRNqOn8vTsaGW8dGA,101
2
2
  ccf/_versionifier.py,sha256=17vUCXFp_VixNCuhBmMS9SCM74JnHR1OIZnMQSspSs4,2951
3
3
  ccf/cose.py,sha256=NyeBz7Rs8hriT0xNJ2CUwjRAhfqqxAOhS5ZmMzQjL3I,15157
4
- ccf/ledger.py,sha256=3y52PazBj5aIsR7uc8qvwXGYCiV36Md_KUXhIIsRcLI,42293
4
+ ccf/ledger.py,sha256=vCsE7qLrzHpu_7ceqdwaJzkHPpT0qkYWIgALMjEifKw,43064
5
5
  ccf/ledger_code.py,sha256=_malocCXly7TdBwBt8ldY6_yNfFwvyCb5Zkp8T4t9fg,3859
6
6
  ccf/ledger_viz.py,sha256=l1p2wKgLDayxquVa9-yzsMcLx9vvygCV8EZ_PrVpvMg,6430
7
7
  ccf/merkletree.py,sha256=JHUnGYYHJfi18YUNGiHmNCa1AwmCAwLAN3ias5j61ws,2931
@@ -11,11 +11,11 @@ ccf/receipt.py,sha256=dySVvy-IqvsB8pj5uooIokbQR853vpT7uC0TQ-IWIQk,2765
11
11
  ccf/split_ledger.py,sha256=wspNZUFPMSvMgGxmwP3QuSbx7QDzTjrC6ecFFJSp14o,5900
12
12
  ccf/tx_id.py,sha256=E7XJyUoJ-a8h7Fp36zNQdhSYdyuNdFV-r_aXhoWl1ks,736
13
13
  ccf/verify_ledger_secrets_chain.py,sha256=_UDc4wNro2mNUVbErDkhl24jLeJC0Vr-kECeZEdeHME,3590
14
- ccf-6.0.15.data/scripts/keygenerator.sh,sha256=r9i8rURcDUPU8c9NKkxrjweU1qU09Hv3SWc3IFQ648A,2391
15
- ccf-6.0.15.data/scripts/submit_recovery_share.sh,sha256=VxMfnbi82W1xrs5BwOqlJs-mFXjXeLnuF9ev37Ph034,3489
16
- ccf-6.0.15.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
17
- ccf-6.0.15.dist-info/METADATA,sha256=ZxB2qhmCiUiV5RF-rEJt54yTw4nAirF0z-eh2hGOv1s,990
18
- ccf-6.0.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- ccf-6.0.15.dist-info/entry_points.txt,sha256=3hbXI2LSOY06QitxM8GQqT9NwY7rCp1RtSU9gGG20A4,365
20
- ccf-6.0.15.dist-info/top_level.txt,sha256=I0tWtkKe6KRqXt0nIp8W-ln8j431-vDBb39bQGKkL9Q,4
21
- ccf-6.0.15.dist-info/RECORD,,
14
+ ccf-6.0.17.data/scripts/keygenerator.sh,sha256=r9i8rURcDUPU8c9NKkxrjweU1qU09Hv3SWc3IFQ648A,2391
15
+ ccf-6.0.17.data/scripts/submit_recovery_share.sh,sha256=VxMfnbi82W1xrs5BwOqlJs-mFXjXeLnuF9ev37Ph034,3489
16
+ ccf-6.0.17.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
17
+ ccf-6.0.17.dist-info/METADATA,sha256=HLRs0ptBFuFjXfv672KPk6Uo29-e9KGfSlQ0aUhosKA,990
18
+ ccf-6.0.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ ccf-6.0.17.dist-info/entry_points.txt,sha256=3hbXI2LSOY06QitxM8GQqT9NwY7rCp1RtSU9gGG20A4,365
20
+ ccf-6.0.17.dist-info/top_level.txt,sha256=I0tWtkKe6KRqXt0nIp8W-ln8j431-vDBb39bQGKkL9Q,4
21
+ ccf-6.0.17.dist-info/RECORD,,
File without changes