From c9c20310d334d7295d87147b57e1d594b04e5fe6 Mon Sep 17 00:00:00 2001 From: Mohammad Amin Khashkhashi Moghaddam Date: Thu, 22 Jun 2023 10:26:34 +0100 Subject: [PATCH] Add slot variable in constructing fake wormhole payloads (#908) The structure of the fake payload was not as expected. Some tests were failing for the wrong reason but with the right error code. Added one testcase to make sure the default behavior of the forging function is correct. --- .../forge-test/Pyth.WormholeMerkleAccumulator.t.sol | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/target_chains/ethereum/contracts/forge-test/Pyth.WormholeMerkleAccumulator.t.sol b/target_chains/ethereum/contracts/forge-test/Pyth.WormholeMerkleAccumulator.t.sol index 90e47547..605e5880 100644 --- a/target_chains/ethereum/contracts/forge-test/Pyth.WormholeMerkleAccumulator.t.sol +++ b/target_chains/ethereum/contracts/forge-test/Pyth.WormholeMerkleAccumulator.t.sol @@ -522,6 +522,7 @@ contract PythWormholeMerkleAccumulatorTest is isNotMatch(forgeItem, "whUpdateType") ? uint8(PythAccumulator.UpdateType.WormholeMerkle) : uint8(PythAccumulator.UpdateType.WormholeMerkle) + 1, + uint64(0), // Slot, not used in target networks uint32(0), // Storage index, not used in target networks isNotMatch(forgeItem, "rootDigest") ? rootDigest @@ -597,6 +598,18 @@ contract PythWormholeMerkleAccumulatorTest is ); } + function testUpdatePriceFeedWithWormholeMerkleWorksWithoutForging() public { + // In this test we make sure the structure returned by createAndForgeWormholeMerkleUpdateData + // is valid if no particular forge flag is set + ( + bytes[] memory updateData, + uint updateFee, + bytes32[] memory priceIds + ) = createAndForgeWormholeMerkleUpdateData(""); + + pyth.updatePriceFeeds{value: updateFee}(updateData); + } + function testUpdatePriceFeedWithWormholeMerkleRevertsOnWrongVAAPayloadUpdateType() public {