diff --git a/target_chains/ethereum/contracts/contracts/pyth/Pyth.sol b/target_chains/ethereum/contracts/contracts/pyth/Pyth.sol index 53b3dcd3..3c17bb0a 100644 --- a/target_chains/ethereum/contracts/contracts/pyth/Pyth.sol +++ b/target_chains/ethereum/contracts/contracts/pyth/Pyth.sol @@ -175,76 +175,6 @@ abstract contract Pyth is if (price.publishTime == 0) revert PythErrors.PriceFeedNotFound(); } - function parseBatchAttestationHeader( - bytes memory encoded - ) - internal - pure - returns (uint index, uint nAttestations, uint attestationSize) - { - unchecked { - index = 0; - - // Check header - { - uint32 magic = UnsafeBytesLib.toUint32(encoded, index); - index += 4; - if (magic != 0x50325748) revert PythErrors.InvalidUpdateData(); - - uint16 versionMajor = UnsafeBytesLib.toUint16(encoded, index); - index += 2; - if (versionMajor != 3) revert PythErrors.InvalidUpdateData(); - - // This value is only used as the check below which currently - // never reverts - // uint16 versionMinor = UnsafeBytesLib.toUint16(encoded, index); - index += 2; - - // This check is always false as versionMinor is 0, so it is commented. - // in the future that the minor version increases this will have effect. - // if(versionMinor < 0) revert InvalidUpdateData(); - - uint16 hdrSize = UnsafeBytesLib.toUint16(encoded, index); - index += 2; - - // NOTE(2022-04-19): Currently, only payloadId comes after - // hdrSize. Future extra header fields must be read using a - // separate offset to respect hdrSize, i.e.: - // - // uint hdrIndex = 0; - // bpa.header.payloadId = UnsafeBytesLib.toUint8(encoded, index + hdrIndex); - // hdrIndex += 1; - // - // bpa.header.someNewField = UnsafeBytesLib.toUint32(encoded, index + hdrIndex); - // hdrIndex += 4; - // - // // Skip remaining unknown header bytes - // index += bpa.header.hdrSize; - - uint8 payloadId = UnsafeBytesLib.toUint8(encoded, index); - - // Skip remaining unknown header bytes - index += hdrSize; - - // Payload ID of 2 required for batch headerBa - if (payloadId != 2) revert PythErrors.InvalidUpdateData(); - } - - // Parse the number of attestations - nAttestations = UnsafeBytesLib.toUint16(encoded, index); - index += 2; - - // Parse the attestation size - attestationSize = UnsafeBytesLib.toUint16(encoded, index); - index += 2; - - // Given the message is valid the arithmetic below should not overflow, and - // even if it overflows then the require would fail. - if (encoded.length != (index + (attestationSize * nAttestations))) - revert PythErrors.InvalidUpdateData(); - } - } - function parsePriceFeedUpdatesInternal( bytes[] calldata updateData, bytes32[] calldata priceIds, diff --git a/target_chains/ethereum/contracts/forge-test/utils/PythTestUtils.t.sol b/target_chains/ethereum/contracts/forge-test/utils/PythTestUtils.t.sol index 7d8a340a..752156e4 100644 --- a/target_chains/ethereum/contracts/forge-test/utils/PythTestUtils.t.sol +++ b/target_chains/ethereum/contracts/forge-test/utils/PythTestUtils.t.sol @@ -324,26 +324,6 @@ abstract contract PythTestUtils is Test, WormholeTestUtils, RandTestUtils { ); } - // Generates a VAA for the given attestations. - // This method calls generatePriceFeedUpdatePayload and then creates a VAA with it. - // The VAAs generated from this method use block timestamp as their timestamp. - function generateWhBatchUpdate( - PriceAttestation[] memory attestations, - uint64 sequence, - uint8 numSigners - ) public returns (bytes memory vaa) { - bytes memory payload = generatePriceFeedUpdatePayload(attestations); - - vaa = generateVaa( - uint32(block.timestamp), - SOURCE_EMITTER_CHAIN_ID, - SOURCE_EMITTER_ADDRESS, - sequence, - payload, - numSigners - ); - } - function pricesToPriceAttestations( bytes32[] memory priceIds, PythStructs.Price[] memory prices diff --git a/target_chains/ethereum/sdk/solidity/IPythEvents.sol b/target_chains/ethereum/sdk/solidity/IPythEvents.sol index ac4c05ce..a2937761 100644 --- a/target_chains/ethereum/sdk/solidity/IPythEvents.sol +++ b/target_chains/ethereum/sdk/solidity/IPythEvents.sol @@ -15,9 +15,4 @@ interface IPythEvents { int64 price, uint64 conf ); - - /// @dev Emitted when a batch price update is processed successfully. - /// @param chainId ID of the source chain that the batch price update comes from. - /// @param sequenceNumber Sequence number of the batch price update. - event BatchPriceFeedUpdate(uint16 chainId, uint64 sequenceNumber); } diff --git a/target_chains/ethereum/sdk/solidity/MockPyth.sol b/target_chains/ethereum/sdk/solidity/MockPyth.sol index c0b11747..7c021702 100644 --- a/target_chains/ethereum/sdk/solidity/MockPyth.sol +++ b/target_chains/ethereum/sdk/solidity/MockPyth.sol @@ -7,7 +7,6 @@ import "./PythErrors.sol"; contract MockPyth is AbstractPyth { mapping(bytes32 => PythStructs.PriceFeed) priceFeeds; - uint64 sequenceNumber; uint singleUpdateFeeInWei; uint validTimePeriod; @@ -41,10 +40,6 @@ contract MockPyth is AbstractPyth { uint requiredFee = getUpdateFee(updateData); if (msg.value < requiredFee) revert PythErrors.InsufficientFee(); - // Chain ID is id of the source chain that the price update comes from. Since it is just a mock contract - // We set it to 1. - uint16 chainId = 1; - for (uint i = 0; i < updateData.length; i++) { PythStructs.PriceFeed memory priceFeed = abi.decode( updateData[i], @@ -64,12 +59,6 @@ contract MockPyth is AbstractPyth { ); } } - - // In the real contract, the input of this function contains multiple batches that each contain multiple prices. - // This event is emitted when a batch is processed. In this mock contract we consider there is only one batch of prices. - // Each batch has (chainId, sequenceNumber) as it's unique identifier. Here chainId is set to 1 and an increasing sequence number is used. - emit BatchPriceFeedUpdate(chainId, sequenceNumber); - sequenceNumber += 1; } function getUpdateFee( diff --git a/target_chains/ethereum/sdk/solidity/abis/AbstractPyth.json b/target_chains/ethereum/sdk/solidity/abis/AbstractPyth.json index be0f0f40..7b672406 100644 --- a/target_chains/ethereum/sdk/solidity/abis/AbstractPyth.json +++ b/target_chains/ethereum/sdk/solidity/abis/AbstractPyth.json @@ -14,25 +14,6 @@ "name": "StalePrice", "type": "error" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint16", - "name": "chainId", - "type": "uint16" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "sequenceNumber", - "type": "uint64" - } - ], - "name": "BatchPriceFeedUpdate", - "type": "event" - }, { "anonymous": false, "inputs": [ diff --git a/target_chains/ethereum/sdk/solidity/abis/IPyth.json b/target_chains/ethereum/sdk/solidity/abis/IPyth.json index 8932f3a6..28841e1d 100644 --- a/target_chains/ethereum/sdk/solidity/abis/IPyth.json +++ b/target_chains/ethereum/sdk/solidity/abis/IPyth.json @@ -1,23 +1,4 @@ [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint16", - "name": "chainId", - "type": "uint16" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "sequenceNumber", - "type": "uint64" - } - ], - "name": "BatchPriceFeedUpdate", - "type": "event" - }, { "anonymous": false, "inputs": [ diff --git a/target_chains/ethereum/sdk/solidity/abis/IPythEvents.json b/target_chains/ethereum/sdk/solidity/abis/IPythEvents.json index b9451f8a..1a897320 100644 --- a/target_chains/ethereum/sdk/solidity/abis/IPythEvents.json +++ b/target_chains/ethereum/sdk/solidity/abis/IPythEvents.json @@ -1,23 +1,4 @@ [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint16", - "name": "chainId", - "type": "uint16" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "sequenceNumber", - "type": "uint64" - } - ], - "name": "BatchPriceFeedUpdate", - "type": "event" - }, { "anonymous": false, "inputs": [ diff --git a/target_chains/ethereum/sdk/solidity/abis/MockPyth.json b/target_chains/ethereum/sdk/solidity/abis/MockPyth.json index 71f90d22..a917b56a 100644 --- a/target_chains/ethereum/sdk/solidity/abis/MockPyth.json +++ b/target_chains/ethereum/sdk/solidity/abis/MockPyth.json @@ -45,25 +45,6 @@ "name": "StalePrice", "type": "error" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint16", - "name": "chainId", - "type": "uint16" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "sequenceNumber", - "type": "uint64" - } - ], - "name": "BatchPriceFeedUpdate", - "type": "event" - }, { "anonymous": false, "inputs": [