Skip to content

Conversation

@guilherme-funchal
Copy link

As part of our POC using the indy-besu VDR and credo-ts (with the credo-rest extension), we needed and therefore are trying to develop a revocation solution, as it seems it is missing in the current version of this repository.

We have only started testing it, and probably there will be modifications and improvements, but if you could take the time to give us your feedback and suggestions, it would surely be appreciated!

We tried to model our implementation having the credo-ts implementation of anoncreds in mind, and the credo-vdr interaction was based on on the indy-vdr package. We have also attempted to keep within the standards used in this repository.
Our initial design idea consists of a smart contract (RevocationRegistry.sol) that stores, for a given RevocationRegistryDefinitionId, an object following this specification. It also stores onchain a reference to the issuerId and the current accumulator for comparison when trying to update the registry.
The Revocation Status List would be built by blockchain events (RevocationRegistryEntry) emitted for a given RevocationRegistryId. The RevocationRegistryEntry contains the indexes of newly issued/revoked credentials, the new accumulator, the previous accumulator for comparison, and a timestamp.

For building the complete RevocationStatusList, one would fetch and accumulate all events up to a given timestamp, this is done offchain.

We updated the genesis generation scripts, the 'flow-with-did-ethr' demo and created some basic tests for now.

We are also working on the Rust VDR implementation, including the wasm integration with credo, with some superficial tests for now.

@Toktar
Copy link
Contributor

Toktar commented Dec 18, 2024

Hello @guilherme-funchal !
That's a huge great job, thank you! Could you please fix DCO and merge conflict issues to let us start a technical review?

@guilherme-funchal
Copy link
Author

Hello Renata, I think I solved the problem. Could you please check if everything is correct?

@Toktar
Copy link
Contributor

Toktar commented Dec 18, 2024

Thank you, we started reviewing the code.
Could you also add signature for commit ec14579 Update key ?
https://github.com/hyperledger/indy-besu/pull/108/checks?check_run_id=34597775054

@guilherme-funchal
Copy link
Author

I put a developer from my team to look at the problem.

mapping(bytes32 id => RevocationRegistryDefinitionRecord revocationRegistryDefinitionRecord) private _revRegDefs;

/**
* Checks that the schema exist
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo in the comment. Must be credential definition instead schema

_revRegDefs[_revRegDefId].metadata.currentAccumulator.length != 0 &&
keccak256(abi.encodePacked(_revRegDefs[_revRegDefId].metadata.currentAccumulator)) !=
keccak256(abi.encodePacked(initialRevRegEntry.prevAccumulator))
) revert AccumulatorMismatch(initialRevRegEntry.prevAccumulator);
Copy link
Contributor

Choose a reason for hiding this comment

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

From the gas point of view, I think it will be more efficient just to compare each element in the array rather doing hashing.

        if (a.length != b.length) {
            return false;
        }
        for (uint256 i = 0; i < a.length; i++) {
            if (a[i] != b[i]) {
                return false;
            }
        }
        return true;
        ``` 

/**
* Checks wether Credential Definition Exists
*/
modifier _credDefExists(bytes32 credDefId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this modifier looks like a duplicate of _credentialDefinitionExists

) external override {
_createRevocationRegistryEntry(identity, msg.sender, revRegDefId, issuerId, revRegEntry);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe createRevocationRegistryEntrymethod also require adding endorsing (Signed) version.

if (
keccak256(abi.encodePacked(_revRegDefs[revRegDefId].metadata.issuerId)) !=
keccak256(abi.encodePacked(issuerId))
) revert NotRevocationRegistryDefinitionIssuer(issuerId);
Copy link
Contributor

Choose a reason for hiding this comment

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

You can just use StringUtils.equals method to compare issuerId

revocationRegistryEntryStruct
)

console.log(`Revocation Registry Entry created for Revocation Registry Definition id ${revocationRegistryId}. Receipt: ${JSON.stringify(receipt)}`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add registry resolving step

storage[slots['1']] = padLeft(data.universalDidResolverAddress, 64)
// address of Role control contact stored in slot 3
storage[slots['2']] = padLeft(data.roleControlContractAddress, 64)
// address of schema registry contact stored in slot 2
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: schema -> credentialDefinition

// Set all `issuer` indexes to 0 (not revoked)
for issue in delta.issued {
revocation_list[issue as usize] = RevocationState::Active as u32
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this loop does nothing because let mut revocation_list: Vec<u32> = vec![0; rev_reg_def.value.max_cred_num.try_into().unwrap()]; already create an array where all elements are 0

return Ok(None);
}

//TODO: sets? vectors?
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with using hashset

Some(previous_delta) => {
previous_delta.validate(revocation_registry_status_list.len() as u32 - 1)?;
// Check whether the revocationStatusList entry is not included in the previous delta issued indices
for (index, entry) in (0u32..).zip(revocation_registry_status_list.iter()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems, can be replaced with: revocation_registry_status_list.iter().enumerate()

@Artemkaaas
Copy link
Contributor

Artemkaaas commented Dec 19, 2024

Thank @guilherme-funchal for the great contribution.
In general, I agree with your design and implementation of supporting revocation data on the ledger. Looks good. We are not really far from getting this merged.
I started doing the code review and posting comments, what can be changed and improved (too many file to complete at once)

@guilherme-funchal
Copy link
Author

@Artemkaaas

Will you make the corrections or do you want me to try to do them?

@Artemkaaas
Copy link
Contributor

@guilherme-funchal It would be better if you or your team process them.

@guilherme-funchal
Copy link
Author

We have already started reviewing your observations and will submit them as soon as possible.

guilherme-funchal added a commit to guilherme-funchal/indy-besu that referenced this pull request Jan 7, 2025
guilherme-funchal added a commit to guilherme-funchal/indy-besu that referenced this pull request Jan 7, 2025
Signed-off-by: Guilherme Funchal da Silva <guilherme.funchal@gmail.com>
@guilherme-funchal
Copy link
Author

guilherme-funchal commented Jan 7, 2025

@Artemkaaas

I just saw some more of your comments that we haven't addressed yet, if you can wait for the new commit.

flaviocgarcia78 pushed a commit to guilherme-funchal/indy-besu that referenced this pull request Mar 6, 2025
flaviocgarcia78 pushed a commit to guilherme-funchal/indy-besu that referenced this pull request Mar 6, 2025
flaviocgarcia78 pushed a commit to guilherme-funchal/indy-besu that referenced this pull request Mar 6, 2025
flaviocgarcia78 pushed a commit to guilherme-funchal/indy-besu that referenced this pull request Mar 6, 2025
@Toktar
Copy link
Contributor

Toktar commented Mar 7, 2025

Hello @flaviocgarcia78 ,
thank you for updating this PR! Could you please fix signature in your commits?

Commit sha: 52a6898, Author: Rafael Bays Weiler, Committer: Rafael Bays Weiler; The sign-off is missing.
Commit sha: 95acb37, Author: Rafael Bays Weiler, Committer: Rafael Bays Weiler; The sign-off is missing.
Commit sha: 771f913, Author: Rafael Bays Weiler, Committer: Rafael Bays Weiler; The sign-off is missing.
Commit sha: 800bbfa, Author: Rafael Bays Weiler, Committer: Rafael Bays Weiler; The sign-off is missing.

flaviocgarcia78 pushed a commit to guilherme-funchal/indy-besu that referenced this pull request Mar 11, 2025
Signed-off-by: Flavio Caetano Garcia <flavio.garcia@serpro.gov.br>
flaviocgarcia78 pushed a commit to guilherme-funchal/indy-besu that referenced this pull request Mar 11, 2025
Signed-off-by: Flavio Caetano Garcia <flavio.garcia@serpro.gov.br>
flaviocgarcia78 pushed a commit to guilherme-funchal/indy-besu that referenced this pull request Mar 11, 2025
Signed-off-by: Flavio Caetano Garcia <flavio.garcia@serpro.gov.br>
flaviocgarcia78 pushed a commit to guilherme-funchal/indy-besu that referenced this pull request Mar 11, 2025
Signed-off-by: Flavio Caetano Garcia <flavio.garcia@serpro.gov.br>
@flaviocgarcia78 flaviocgarcia78 force-pushed the Revocation_SERPRO branch 2 times, most recently from 70ec1f5 to 39f268d Compare March 11, 2025 17:19
@Toktar
Copy link
Contributor

Toktar commented Mar 19, 2025

Hello @flaviocgarcia78 ,
I see that it is very close to the merge and there are only a couple of unprocessed review comments. You can also answer for review comments if there are any questions.
Feel free to ping me if review or help are needed

@guilherme-funchal
Copy link
Author

I see that it is very close to the merge and there are only a couple of unprocessed review comments. You can also answer for review comments if there are any questions.
Feel free to ping me if review or help are needed

Hello Renata, we are reviewing the commits to address your comments. I will let you know when they are OK.

@thiagoromanos
Copy link
Contributor

Hello @Toktar @Artemkaaas , I commited a new refactor of the previous code, checking every test to run smoothly, as well as the python demo using uniffi. One thing that I couldn't get working was the wasm demo, but I saw that there are some other errors on wasm demo, so I would suggest that we could fix that in another PR. I believe that I could cover all the comments, but a review should make sure of it.

@guilherme-funchal
Copy link
Author

Hi @Toktar, is there any adjustment needed? We have implemented the integration with ACA-PY for this feature and would like to include it in the community package Pull Request refence.

Rafael Bays Weiler and others added 14 commits October 7, 2025 17:28
Signed-off-by: Flavio Caetano Garcia <flavio.garcia@serpro.gov.br>
Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
Signed-off-by: Flavio Caetano Garcia <flavio.garcia@serpro.gov.br>
Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
Signed-off-by: Flavio Caetano Garcia <flavio.garcia@serpro.gov.br>
Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
Signed-off-by: Thiago Romano <thiagoromano.s@gmail.com>
Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
…docs

Signed-off-by: artem.ivanov <artem.ivanov@dsr-corporation.com>
Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
Signed-off-by: Thiago Romano <thiagoromano.s@gmail.com>
Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
…ignore)

Signed-off-by: Thiago Romano <thiagoromano.s@gmail.com>
Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
Signed-off-by: Thiago Romano <thiagoromano.s@gmail.com>
Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
Signed-off-by: Thiago Romano <thiagoromano.s@gmail.com>
Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
…o 0.29.4

Implemented recommended validations on VDR library level as discussed.
Updated UniFFI to version 0.29.4 to enable disabling of 'disable_java_cleaner' (improving compatibility with Android SDK 0.26.0).
Adjusted Python wrapper to reflect UniFFI updates.
Added new integration test scenarios for validation coverage.

Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
Signed-off-by: flaviocgarcia78 <flavio.garcia@serpro.gov.br>
@flaviocgarcia78
Copy link

Hi everyone,
I’ve implemented the suggested adjustments on the VDR library level, as discussed with @Artemkaaas. In addition, I’ve updated the project to use UniFFI version 0.29.4.
One of the main reasons for this update is that this version allows disabling the disable_java_cleaner flag, which previously limited the generated Kotlin code to run only on more recent Android versions. With this change, the library is now compatible with the Android SDK 0.26.0.
I also added some new test scenarios and adjusted the Python wrapper to reflect the UniFFI updates.
Please take a look at the latest changes and let me know your thoughts — particularly if we are close to having this code integrated into an official release.
Thanks again for your valuable feedback and collaboration!

Best regards,
Flavio

Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
@Toktar
Copy link
Contributor

Toktar commented Oct 8, 2025

Hello @flaviocgarcia78,
thank you for new commits. Looks great!
Could you please use only English language for comments, don't use images in the code(sorry, saw something like this, but can't find right now, maybe it was updated) and cherry-pick this commit for fixing pipelines #138

New changes are in the technical review. Thanks for your patience and feel free to ping me if there are any questions

Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
@flaviocgarcia78
Copy link

Hello Renata,

Thank you for your review and helpful suggestions.
We’ve already performed the cherry-pick of the pipeline fix commit (2605af6) as requested, and we’ll make sure to follow your recommendations regarding English-only comments and code formatting going forward.

Additionally, we’ve been considering extending the besu-vdr module to support a multi-ledger approach. We believe this could enhance interoperability between different ledger networks within the same infrastructure.
We’d love to hear your thoughts on this idea and whether you think it would be a valuable direction for the project.

Best regards,
Flavio

@Artemkaaas
Copy link
Contributor

#108 (comment)

@flaviocgarcia78 I would say that write operations must be validated on the contract level as much, but without growing the storage too much. For example, I think we should store the identity address of revocation registry definition owner and verify sender of revocation registry against it (it looks like we still do not perform this check in the latest version). But we cannot store all entries as they quite big in size.

@flaviocgarcia78
Copy link

#108 (comment)

@flaviocgarcia78 I would say that write operations must be validated on the contract level as much, but without growing the storage too much. For example, I think we should store the identity address of revocation registry definition owner and verify sender of revocation registry against it (it looks like we still do not perform this check in the latest version). But we cannot store all entries as they quite big in size.

#108 (comment)

@flaviocgarcia78 I would say that write operations must be validated on the contract level as much, but without growing the storage too much. For example, I think we should store the identity address of revocation registry definition owner and verify sender of revocation registry against it (it looks like we still do not perform this check in the latest version). But we cannot store all entries as they quite big in size.

@Artemkaaas,
I think the _validIssuer function that is called already guarantees this.
Best Regards

@Artemkaaas
Copy link
Contributor

@flaviocgarcia78 AFAIR it checks existence and ownership of DID but do not check that actor is ownership of revocation registry. For the creating rest anoncreds entities it is sufficient check, but for posting revocation registry we also need an addition one to ensure entry sender is owner of registry definition.

@flaviocgarcia78
Copy link

@flaviocgarcia78 AFAIR it checks existence and ownership of DID but do not check that actor is ownership of revocation registry. For the creating rest anoncreds entities it is sufficient check, but for posting revocation registry we also need an addition one to ensure entry sender is owner of registry definition.

Thanks @Artemkaaas, you’re right — that’s the correct behavior. I’ll make the necessary adjustment and resubmit the update.
Please let me know if you noticed any other points in the latest changes so I can address them as soon as possible.
We’re looking forward to your approval of the PR.

Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
Signed-off-by: Flavio Garcia <flavio.garcia@serpro.gov.br>
@flaviocgarcia78
Copy link

@Artemkaaas / @Toktar, kindly review the adjustments made in this PR.
Thank you and best regards,
Flavio

@Toktar
Copy link
Contributor

Toktar commented Oct 27, 2025

Hello @flaviocgarcia78 ,
thanks for new changes! Could you please take a look at this comment? 8cccb52#r1891558171
I think it could become actual in last your commits
all other comments/changes are approved

Best regards,
Renata

@flaviocgarcia78
Copy link

Hello @flaviocgarcia78 , thanks for new changes! Could you please take a look at this comment? 8cccb52#r1891558171 I think it could become actual in last your commits all other comments/changes are approved

Best regards, Renata

Hello @Toktar,
Thanks for your message! I’ve already replied directly to the comment in 8cccb52 and addressed the point in the last commit.
Please let me know if you need any additional adjustment or clarification.

Best regards,
Flavio

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.

6 participants