Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add zero address checking #327

Merged
merged 4 commits into from
Feb 6, 2025

Conversation

yushihang
Copy link
Contributor

No description provided.

Copy link
Member

@OBrezhniev OBrezhniev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@OBrezhniev
Copy link
Member

@AndriianChestnykh @daveroga please review and merge if it's ok.

daveroga
daveroga previously approved these changes Jan 30, 2025
Copy link
Collaborator

@AndriianChestnykh AndriianChestnykh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contracts/cross-chain/CrossChainProofValidator.sol Outdated Show resolved Hide resolved
create internal method instead _checkOracleSigningAddress and use custom error error OracleSigningAddressShouldNotBeZero() in it?
Copy link
Collaborator

@AndriianChestnykh AndriianChestnykh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yushihang Please do the following:

  1. Cover the unit tests in cross-chain-proof-validator.tests.ts . You need to cover both constructor and setOracleSigning method. For the method it's simple but for constructor you may need to deploy a validator directly but not via deployHelper.deployCrossChainProofValidator or change the deployHelper.deployCrossChainProofValidator itself.
  2. Bump the package version in contracts/package.json from 2.5.6 to 2.5.7 (don't confuse with higher level package.json)

daveroga
daveroga previously approved these changes Feb 2, 2025
- 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
@yushihang
Copy link
Contributor Author

yushihang commented Feb 3, 2025

@yushihang Please do the following:

  1. Cover the unit tests in cross-chain-proof-validator.tests.ts . You need to cover both constructor and setOracleSigning method. For the method it's simple but for constructor you may need to deploy a validator directly but not via deployHelper.deployCrossChainProofValidator or change the deployHelper.deployCrossChainProofValidator itself.
  2. Bump the package version in contracts/package.json from 2.5.6 to 2.5.7 (don't confuse with higher level package.json)

@AndriianChestnykh Thank you for your review and detailed advices.

I have made the following changes:

  1. Added unit tests in cross-chain-proof-validator.test.ts to cover:

    • Constructor validation for zero oracle signing address
    • setOracleSigningAddress method validation
  2. Bumped the package version from 2.5.6 to 2.5.7 in contracts/package.json

Please let me know if anything needs to be tweaked, Thanks!

The test results:

npx hardhat test test/cross-chain/cross-chain-proof-validator.test.ts


  State Cross Chain
[✓] CrossChainProofValidator deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3
    ✔ Should process the messages without replacedAtTimestamp
    ✔ Should process the messages with replacedAtTimestamp
    ✔ Oracle timestamp should not be in the past
    ✔ Oracle replacedAtTimestamp or oracle timestamp cannot be in the future
    ✔ Should fail to verify a message which was tampered with
    ✔ Should fail to verify a message which signature is invalid

  Oracle Signing Address Validation
    ✔ should revert when deploying with zero oracle signing address
[✓] CrossChainProofValidator deployed to: 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
    ✔ should deploy with correct parameters
    ✔ should set a new oracle signing address
    ✔ should revert when setting oracle signing address to zero


  10 passing (2s)

@AndriianChestnykh AndriianChestnykh merged commit c125a6b into iden3:master Feb 6, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants