-
Couldn't load subscription status.
- Fork 5
Description
Specification
There are several occurrences of node claims that are being incorrectly set up throughout the testing suites.
Consider the situation where we have two nodes, B and C, with a cryptolink between them (i.e. part of the same gestalt). The cryptolink should be represented by a single claim on each node's sigchain (that's been signed by both B and C). That is, B will have a single claim signed by both itself and C, and C will have a single claim signed by both itself and B.
However, there are some tests that aren't setting this up correctly. For example, in tests/bin/identities.test.ts:
// Adding sigchain details.
const claimBtoC: ClaimLinkNode = {
type: 'node',
node1: nodeB.nodeManager.getNodeId(),
node2: nodeC.nodeManager.getNodeId(),
};
const claimCtoB: ClaimLinkNode = {
type: 'node',
node1: nodeC.nodeManager.getNodeId(),
node2: nodeB.nodeManager.getNodeId(),
};
await nodeB.sigchain.addClaim(claimBtoC);
await nodeB.sigchain.addClaim(claimCtoB);
await nodeC.sigchain.addClaim(claimCtoB);
await nodeC.sigchain.addClaim(claimBtoC);Here we're incorrectly adding 2 claims, that are singly signed by the owner of the respective sigchain the claim is added to. From the git blame, it seems like this was added prior to the refactoring of node claims though, so just something that's been missed.
Additional context
- originally discovered in Fixing the
pk identities claimcommand to augment DIs #278 (comment) - original nodes claims MR https://gitlab.com/MatrixAI/Engineering/Polykey/js-polykey/-/merge_requests/209
Tasks
- Create a
testsutility function to create a node claim (a doubly signed claim, signed by both nodes' private keys). - Find and fix all instances where the nodes claims are being incorrectly set up.