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

Improve RelationshipModule storing and discoverability. #172

Open
Ramarti opened this issue Nov 13, 2023 · 0 comments
Open

Improve RelationshipModule storing and discoverability. #172

Ramarti opened this issue Nov 13, 2023 · 0 comments

Comments

@Ramarti
Copy link
Contributor

Ramarti commented Nov 13, 2023

Current relationship storing works like this:

mapping(uint256 => LibRelationship.Relationship) private _relationships;
mapping(bytes32 => uint256) private _relHashes;

// Store
LibRelationship.Relationship memory rel = LibRelationship.Relationship({
            relType: createParams.relType,
            srcAddress: createParams.srcAddress,
            dstAddress: createParams.dstAddress,
            srcId: createParams.srcId,
            dstId: createParams.dstId
        });
_relationships[relationshipId] = rel;
_relHashes[keccak256(abi.encode(rel))] = relationshipId;


// Discovering
function getRelationshipId(LibRelationship.Relationship calldata rel_) external virtual override view returns (uint256) {
        return _relHashes[keccak256(abi.encode(rel_))];
}

This only works if you already know of the 2 ends of the relationship, but we need a way to tell if 1 node is part of a relationship, and also traverse the actual graph, also up the relationship directions, for invalidations.

@Ramarti Ramarti mentioned this issue Nov 13, 2023
29 tasks
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

No branches or pull requests

1 participant