Skip to content

Commit

Permalink
Remove excessive length check (#237)
Browse files Browse the repository at this point in the history
* Remove excessive length check

* Upgrade patch in version of contracts and package


---------

Co-authored-by: Andriian Chestnykh <>
  • Loading branch information
AndriianChestnykh authored Jun 3, 2024
1 parent d9432ff commit 7f5866c
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 12 deletions.
3 changes: 0 additions & 3 deletions contracts/lib/GenesisUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,9 @@ library GenesisUtils {
);

bytes memory cutState = PrimitiveTypeUtils.slice(userStateB1, userStateB1.length - 27, 27);

bytes memory beforeChecksum = PrimitiveTypeUtils.concat(abi.encodePacked(idType), cutState);
require(beforeChecksum.length == 29, "Checksum requires 29 length array");

uint16 checksum = PrimitiveTypeUtils.reverseUint16(sum(beforeChecksum));

bytes memory checkSumBytes = abi.encodePacked(checksum);

bytes memory idBytes = PrimitiveTypeUtils.concat(beforeChecksum, checkSumBytes);
Expand Down
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.1.0",
"version": "2.1.1",
"files": [
"**/*.sol",
"/build/contracts/*.json",
Expand Down
2 changes: 1 addition & 1 deletion contracts/state/State.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract State is Ownable2StepUpgradeable, IState {
/**
* @dev Version of contract
*/
string public constant VERSION = "2.4.0";
string public constant VERSION = "2.4.1";

// This empty reserved space is put in place to allow future versions
// of the State contract to inherit from other contracts without a risk of
Expand Down
2 changes: 1 addition & 1 deletion contracts/test-helpers/ValidatorStub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {ICircuitValidator} from "../interfaces/ICircuitValidator.sol";
* @dev ValidatorStub validator
*/
contract ValidatorStub is ICircuitValidator, ERC165 {
string public constant VERSION = "2.0.0-mock";
string public constant VERSION = "2.0.1-mock";

string internal constant CIRCUIT_ID = "mock-stub";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ contract CredentialAtomicQueryMTPV2Validator is CredentialAtomicQueryV2Validator
/**
* @dev Version of contract
*/
string public constant VERSION = "2.0.2";
string public constant VERSION = "2.0.3";

string internal constant CIRCUIT_ID = "credentialAtomicQueryMTPV2OnChain";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ contract CredentialAtomicQuerySigV2Validator is CredentialAtomicQueryV2Validator
/**
* @dev Version of contract
*/
string public constant VERSION = "2.0.2";
string public constant VERSION = "2.0.3";

string internal constant CIRCUIT_ID = "credentialAtomicQuerySigV2OnChain";

Expand Down
2 changes: 1 addition & 1 deletion contracts/validators/CredentialAtomicQueryV3Validator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ contract CredentialAtomicQueryV3Validator is CredentialAtomicQueryValidatorBase
/**
* @dev Version of contract
*/
string public constant VERSION = "2.0.2-beta.1";
string public constant VERSION = "2.0.3-beta.1";

string internal constant CIRCUIT_ID = "credentialAtomicQueryV3OnChain-beta.1";

Expand Down
2 changes: 1 addition & 1 deletion contracts/verifiers/UniversalVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ contract UniversalVerifier is
/**
* @dev Version of contract
*/
string public constant VERSION = "1.0.1";
string public constant VERSION = "1.0.2";

/// @dev Event emitted upon submitting a ZKP request
event ZKPResponseSubmitted(uint64 indexed requestId, address indexed caller);
Expand Down
2 changes: 1 addition & 1 deletion test/verifier/embedded-zkp-verifier.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe("Embedded ZKP Verifier", function () {
expect(isProofVerified).to.be.equal(true);
const proofStatus = await verifier.getProofStatus(ownerAddress, requestID);
expect(proofStatus.isVerified).to.be.equal(true);
expect(proofStatus.validatorVersion).to.be.equal("2.0.0-mock");
expect(proofStatus.validatorVersion).to.be.equal("2.0.1-mock");
expect(proofStatus.blockNumber).to.be.equal(txRes.blockNumber);
expect(proofStatus.blockTimestamp).to.be.equal(txResTimestamp);
});
Expand Down
2 changes: 1 addition & 1 deletion test/verifier/universal-verifier.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe("Universal Verifier MTP & SIG validators", function () {

const status = await verifier.getProofStatus(signerAddress, requestId);
expect(status.isVerified).to.be.true;
expect(status.validatorVersion).to.be.equal("2.0.0-mock");
expect(status.validatorVersion).to.be.equal("2.0.1-mock");
expect(status.blockNumber).to.be.equal(txRes.blockNumber);
expect(status.blockTimestamp).to.be.equal(txResTimestamp);

Expand Down

0 comments on commit 7f5866c

Please sign in to comment.