Skip to content

Commit

Permalink
add test for executing governance action with invalid chain ID
Browse files Browse the repository at this point in the history
  • Loading branch information
cctdaniel committed Oct 8, 2024
1 parent 73e0ceb commit 5429c10
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions target_chains/ton/contracts/tests/PythTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,36 @@ describe("PythTest", () => {
});
});

it("should fail to execute governance action with invalid chain ID", async () => {
const invalidChainId = 999;
await deployContract(
BTC_PRICE_FEED_ID,
TIME_PERIOD,
PRICE,
EMA_PRICE,
SINGLE_UPDATE_FEE,
DATA_SOURCES,
0,
[TEST_GUARDIAN_ADDRESS1],
invalidChainId,
1,
"0000000000000000000000000000000000000000000000000000000000000004",
TEST_GOVERNANCE_DATA_SOURCES[0]
);

const result = await pythTest.sendExecuteGovernanceAction(
deployer.getSender(),
Buffer.from(PYTH_SET_FEE, "hex")
);

expect(result.transactions).toHaveTransaction({
from: deployer.address,
to: pythTest.address,
success: false,
exitCode: 1034, // ERROR_INVALID_GOVERNANCE_TARGET
});
});

it("should successfully upgrade the contract", async () => {
// Compile the upgraded contract
const upgradedCode = await compile("PythTestUpgraded");
Expand Down

0 comments on commit 5429c10

Please sign in to comment.