Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Add validation for agent entry #1497

Merged
merged 34 commits into from Jul 18, 2019
Merged

Conversation

willemolding
Copy link
Collaborator

PR summary

To enable membranes there must be a way for agents to validate who is allowed to join. This PR adds some new functionality to enable this by making the AgentId (second entry on the local chain) a validate-able entry with a user defined callback in the zome.

This is a breaking change to existing zomes. Zome developers must add a validate_agent callback either using the old HDK or the proc-macro HDK.

changelog

Please check one of the following, relating to the CHANGELOG-UNRELEASED.md

  • this is a code change that effects some consumer (e.g. zome developers) of holochain core so it is added to the CHANGELOG-UNRELEASED.md (linked above), with the format - summary of change [PR#1234](https://github.com/holochain/holochain-rust/pull/1234)
  • this is not a code change, or doesn't effect anyone outside holochain core development

@@ -0,0 +1,62 @@
use crate::{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This file is really the only new piece of core code. The rest is fixing tests and dealing with the macros

Copy link
Collaborator

@lucksus lucksus left a comment

Choose a reason for hiding this comment

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

Awesome!
I've spotted a broken merge in the changelog though.

Also, is there a way to test this?
What would happen currently - without any other changes to n3h/lib3h that are needed to fully implement membranes - if an agent would be invalid? Can we add a test for that?

CHANGELOG-UNRELEASED.md Outdated Show resolved Hide resolved
Nicolas Luck added 2 commits June 17, 2019 13:59
# Conflicts:
#	CHANGELOG-UNRELEASED.md
#	nodejs_conductor/test/test.dna.json
Copy link
Member

@maackle maackle left a comment

Choose a reason for hiding this comment

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

Awesome!

Think as a followup we can have a test that has a validate_agent fn that actually calls some zome fn and rejects the agent, to see that it errors out as expected?

@willemolding willemolding merged commit ea61613 into develop Jul 18, 2019
@zippy zippy deleted the add-validation-for-agent-entry branch October 4, 2019 18:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants