@@ -175,76 +175,6 @@ abstract contract Pyth is
175175 if (price.publishTime == 0 ) revert PythErrors.PriceFeedNotFound ();
176176 }
177177
178- function parseBatchAttestationHeader (
179- bytes memory encoded
180- )
181- internal
182- pure
183- returns (uint index , uint nAttestations , uint attestationSize )
184- {
185- unchecked {
186- index = 0 ;
187-
188- // Check header
189- {
190- uint32 magic = UnsafeBytesLib.toUint32 (encoded, index);
191- index += 4 ;
192- if (magic != 0x50325748 ) revert PythErrors.InvalidUpdateData ();
193-
194- uint16 versionMajor = UnsafeBytesLib.toUint16 (encoded, index);
195- index += 2 ;
196- if (versionMajor != 3 ) revert PythErrors.InvalidUpdateData ();
197-
198- // This value is only used as the check below which currently
199- // never reverts
200- // uint16 versionMinor = UnsafeBytesLib.toUint16(encoded, index);
201- index += 2 ;
202-
203- // This check is always false as versionMinor is 0, so it is commented.
204- // in the future that the minor version increases this will have effect.
205- // if(versionMinor < 0) revert InvalidUpdateData();
206-
207- uint16 hdrSize = UnsafeBytesLib.toUint16 (encoded, index);
208- index += 2 ;
209-
210- // NOTE(2022-04-19): Currently, only payloadId comes after
211- // hdrSize. Future extra header fields must be read using a
212- // separate offset to respect hdrSize, i.e.:
213- //
214- // uint hdrIndex = 0;
215- // bpa.header.payloadId = UnsafeBytesLib.toUint8(encoded, index + hdrIndex);
216- // hdrIndex += 1;
217- //
218- // bpa.header.someNewField = UnsafeBytesLib.toUint32(encoded, index + hdrIndex);
219- // hdrIndex += 4;
220- //
221- // // Skip remaining unknown header bytes
222- // index += bpa.header.hdrSize;
223-
224- uint8 payloadId = UnsafeBytesLib.toUint8 (encoded, index);
225-
226- // Skip remaining unknown header bytes
227- index += hdrSize;
228-
229- // Payload ID of 2 required for batch headerBa
230- if (payloadId != 2 ) revert PythErrors.InvalidUpdateData ();
231- }
232-
233- // Parse the number of attestations
234- nAttestations = UnsafeBytesLib.toUint16 (encoded, index);
235- index += 2 ;
236-
237- // Parse the attestation size
238- attestationSize = UnsafeBytesLib.toUint16 (encoded, index);
239- index += 2 ;
240-
241- // Given the message is valid the arithmetic below should not overflow, and
242- // even if it overflows then the require would fail.
243- if (encoded.length != (index + (attestationSize * nAttestations)))
244- revert PythErrors.InvalidUpdateData ();
245- }
246- }
247-
248178 function parsePriceFeedUpdatesInternal (
249179 bytes [] calldata updateData ,
250180 bytes32 [] calldata priceIds ,
0 commit comments