Skip to content

Commit

Permalink
chore: bump version to 2.5.7 and fix test assertions
Browse files Browse the repository at this point in the history
- Bump package version from 2.5.6 to 2.5.7
- Update test assertions in cross-chain-proof-validator.test.ts to properly
  handle custom Solidity errors using revertedWithCustomError

Technical changes:
- Update package.json version
- Replace revertedWith with revertedWithCustomError in test cases
  • Loading branch information
yushihang committed Feb 3, 2025
1 parent 8f62994 commit dd3bc97
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@iden3/contracts",
"description": "Smart Contract library for Solidity",
"version": "2.5.6",
"version": "2.5.7",
"files": [
"**/*.sol",
"/build/contracts/*.json",
Expand Down
47 changes: 46 additions & 1 deletion test/cross-chain/cross-chain-proof-validator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from "../utils/packData";
import { expect } from "chai";
import { DeployHelper } from "../../helpers/DeployHelper";
import { Contract } from "ethers";
import { Contract, ZeroAddress } from "ethers";
import { ethers } from "hardhat";
import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers";

Expand Down Expand Up @@ -180,3 +180,48 @@ describe("State Cross Chain", function () {
);
});
});

describe("Oracle Signing Address Validation", function () {
let CrossChainProofValidatorFactory;
let crossChainProofValidator;
let otherAccount;
const oracleSigningAddress = "0x1234567890123456789012345678901234567890";

before(async function () {
[, otherAccount] = await ethers.getSigners();
CrossChainProofValidatorFactory = await ethers.getContractFactory("CrossChainProofValidator");
});

it("should deploy with correct parameters", async function () {
crossChainProofValidator = await CrossChainProofValidatorFactory.deploy(
"StateInfo",
"1",
oracleSigningAddress,
);
await crossChainProofValidator.waitForDeployment();
expect(await crossChainProofValidator.getOracleSigningAddress()).to.equal(oracleSigningAddress);
});

it("should revert when deploying with zero oracle signing address", async function () {
await expect(
CrossChainProofValidatorFactory.deploy("TestDomain", "1", ZeroAddress),
).to.be.revertedWithCustomError(
CrossChainProofValidatorFactory,
"OracleSigningAddressShouldNotBeZero",
);
});

it("should set a new oracle signing address", async function () {
await crossChainProofValidator.setOracleSigningAddress(otherAccount.address);
expect(await crossChainProofValidator.getOracleSigningAddress()).to.equal(otherAccount.address);
});

it("should revert when setting oracle signing address to zero", async function () {
await expect(
crossChainProofValidator.setOracleSigningAddress(ZeroAddress),
).to.be.revertedWithCustomError(
crossChainProofValidator,
"OracleSigningAddressShouldNotBeZero",
);
});
});

0 comments on commit dd3bc97

Please sign in to comment.