Skip to content

Commit 6f34310

Browse files
committed
Add set verifier governance action test
1 parent 5fa0f1f commit 6f34310

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

target_chains/ethereum/contracts/forge-test/PythGovernance.t.sol

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,34 @@ contract PythGovernanceTest is
267267
assertEq(address(PythGetters(address(pyth)).wormhole()), newWormhole);
268268
}
269269

270+
function testSetVerifierAddress() public {
271+
// Deploy a new verifier contract
272+
address newVerifier = address(setUpWormholeReceiver(1));
273+
274+
// Create governance VAA to set new verifier address
275+
bytes memory data = abi.encodePacked(
276+
MAGIC,
277+
uint8(GovernanceModule.Target),
278+
uint8(GovernanceAction.SetVerifierAddress),
279+
TARGET_CHAIN_ID, // Target chain ID
280+
newVerifier // New verifier address
281+
);
282+
283+
bytes memory vaa = encodeAndSignMessage(
284+
data,
285+
TEST_GOVERNANCE_CHAIN_ID,
286+
TEST_GOVERNANCE_EMITTER,
287+
1
288+
);
289+
290+
address oldVerifier = address(PythGetters(address(pyth)).verifier());
291+
vm.expectEmit(true, true, true, true);
292+
emit VerifierAddressSet(oldVerifier, newVerifier);
293+
294+
PythGovernance(address(pyth)).executeGovernanceInstruction(vaa);
295+
assertEq(address(PythGetters(address(pyth)).verifier()), newVerifier);
296+
}
297+
270298
function testTransferGovernanceDataSource() public {
271299
uint16 newEmitterChain = 2;
272300
bytes32 newEmitterAddress = 0x0000000000000000000000000000000000000000000000000000000000001111;
@@ -706,4 +734,8 @@ contract PythGovernanceTest is
706734
);
707735
event TransactionFeeSet(uint oldFee, uint newFee);
708736
event FeeWithdrawn(address recipient, uint256 fee);
737+
event VerifierAddressSet(
738+
address oldVerifierAddress,
739+
address newVerifierAddress
740+
);
709741
}

0 commit comments

Comments
 (0)