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.
This commit is contained in:
Mohammad Amin Khashkhashi Moghaddam 2023-06-22 10:26:34 +01:00 committed by GitHub
parent ef963cdfc6
commit c9c20310d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -522,6 +522,7 @@ contract PythWormholeMerkleAccumulatorTest is
isNotMatch(forgeItem, "whUpdateType") isNotMatch(forgeItem, "whUpdateType")
? uint8(PythAccumulator.UpdateType.WormholeMerkle) ? uint8(PythAccumulator.UpdateType.WormholeMerkle)
: uint8(PythAccumulator.UpdateType.WormholeMerkle) + 1, : uint8(PythAccumulator.UpdateType.WormholeMerkle) + 1,
uint64(0), // Slot, not used in target networks
uint32(0), // Storage index, not used in target networks uint32(0), // Storage index, not used in target networks
isNotMatch(forgeItem, "rootDigest") isNotMatch(forgeItem, "rootDigest")
? 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() function testUpdatePriceFeedWithWormholeMerkleRevertsOnWrongVAAPayloadUpdateType()
public public
{ {