Skip to content

Commit

Permalink
wip: review
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
tegefaulkes committed Feb 6, 2025
1 parent bdcc88d commit e909006
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions src/nodes/NodeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ class NodeManager {
): AsyncGenerator<T, TReturn, TNext> {
const acquire = this.acquireConnection(nodeId, ctx);
const [release, conn] = await acquire();
let caughtError;
let caughtError: Error | undefined;
try {
if (conn == null) utils.never('NodeConnection should exist');
return yield* g(conn);
Expand Down Expand Up @@ -1608,7 +1608,7 @@ class NodeManager {
} catch {
continue;
}
// No need to check if local claims are correctly signed by an Network Authority.
// No need to check if local claims are correctly signed by a Network Authority.
if (
authorityToken.verifyWithPublicKey(
keysUtils.publicKeyFromNodeId(
Expand Down Expand Up @@ -1687,7 +1687,7 @@ class NodeManager {
);
}

// Need to await node connection verification, if fail, need to reject connection.
// Need to await node connection verification, if failed, need to reject connection.

// When adding a node we need to handle 3 cases
// 1. The node already exists. We need to update it's last updated field
Expand Down Expand Up @@ -1949,7 +1949,7 @@ class NodeManager {
}

protected async setupGCTask(bucketIndex: number) {
// Check and start a 'garbageCollect` bucket task
// Check and start a `garbageCollect` bucket task
let scheduled: boolean = false;
for await (const task of this.taskManager.getTasks('asc', true, [
this.tasksPath,
Expand Down Expand Up @@ -2206,7 +2206,7 @@ class NodeManager {
*
* From the spec:
* To join the network, a node u must have a contact to an already participating node w. u inserts w into the
* appropriate k-bucket. u then performs a node lookup for its own node ID. Finally, u refreshes all kbuckets further
* appropriate k-bucket. u then performs a node lookup for its own node ID. Finally, u refreshes all k-buckets further
* away than its closest neighbor. During the refreshes, u both populates its own k-buckets and inserts itself into
* other nodes’ k-buckets as necessary.
*
Expand Down
2 changes: 1 addition & 1 deletion tests/discovery/Discovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import IdentitiesManager from '@/identities/IdentitiesManager';
import NodeConnectionManager from '@/nodes/NodeConnectionManager';
import NodeGraph from '@/nodes/NodeGraph';
import NodeManager from '@/nodes/NodeManager';
import NodesAuthenticateConnection from '@/nodes/agent/handlers/NodesAuthenticateConnection';
import KeyRing from '@/keys/KeyRing';
import ACL from '@/acl/ACL';
import Sigchain from '@/sigchain/Sigchain';
Expand All @@ -36,7 +37,6 @@ import * as testNodesUtils from '../nodes/utils';
import TestProvider from '../identities/TestProvider';
import 'ix/add/asynciterable-operators/toarray';
import { createTLSConfig } from '../utils/tls';
import NodesAuthenticateConnection from '../../src/nodes/agent/handlers/NodesAuthenticateConnection';

describe('Discovery', () => {
const password = 'password';
Expand Down
2 changes: 1 addition & 1 deletion tests/nodes/NodeConnectionManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import * as keysUtils from '@/keys/utils';
import * as nodesEvents from '@/nodes/events';
import * as nodesErrors from '@/nodes/errors';
import NodeConnectionManager from '@/nodes/NodeConnectionManager';
import NodesAuthenticateConnection from '@/nodes/agent/handlers/NodesAuthenticateConnection';
import NodesConnectionSignalFinal from '@/nodes/agent/handlers/NodesConnectionSignalFinal';
import NodesConnectionSignalInitial from '@/nodes/agent/handlers/NodesConnectionSignalInitial';
import * as utils from '@/utils';
import * as nodesUtils from '@/nodes/utils';
import * as nodesTestUtils from './utils';
import * as keysTestUtils from '../keys/utils';
import * as testsUtils from '../utils';
import NodesAuthenticateConnection from '../../src/nodes/agent/handlers/NodesAuthenticateConnection';

class DummyNodesAuthenticateConnection extends UnaryHandler<
ObjectEmpty,
Expand Down
4 changes: 2 additions & 2 deletions tests/nodes/NodeManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { DB } from '@matrixai/db';
import { Semaphore } from '@matrixai/async-locks';
import { PromiseCancellable } from '@matrixai/async-cancellable';
import { UnaryHandler } from '@matrixai/rpc';
import ACL from '@/acl/ACL';
import NodeGraph from '@/nodes/NodeGraph';
import {
NodesClaimsGet,
Expand All @@ -29,6 +30,7 @@ import * as keysUtils from '@/keys/utils';
import * as nodesErrors from '@/nodes/errors';
import * as nodesEvents from '@/nodes/events';
import NodeConnectionManager from '@/nodes/NodeConnectionManager';
import NodesCrossSignClaim from '@/nodes/agent/handlers/NodesCrossSignClaim';
import NodesConnectionSignalFinal from '@/nodes/agent/handlers/NodesConnectionSignalFinal';
import NodesConnectionSignalInitial from '@/nodes/agent/handlers/NodesConnectionSignalInitial';
import NodesAuthenticateConnection from '@/nodes/agent/handlers/NodesAuthenticateConnection';
Expand All @@ -42,9 +44,7 @@ import NodeConnectionQueue from '@/nodes/NodeConnectionQueue';
import * as utils from '@/utils';
import { generateNodeIdForBucket } from './utils';
import * as nodesTestUtils from './utils';
import ACL from '../../src/acl/ACL';
import * as testsUtils from '../utils';
import NodesCrossSignClaim from '../../src/nodes/agent/handlers/NodesCrossSignClaim';

class DummyNodesAuthenticateConnection extends UnaryHandler<
ObjectEmpty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import type { NodeConnection } from '@/nodes';
import type { ActiveConnectionDataMessage } from '@/nodes/agent/types';
import Logger, { LogLevel, StreamHandler } from '@matrixai/logger';
import * as keysUtils from '@/keys/utils';
import NodeConnectionManager from '@/nodes/NodeConnectionManager';
import NodesAuthenticateConnection from '@/nodes/agent/handlers/NodesAuthenticateConnection';
import NodesClosestActiveConnectionsGet from '@/nodes/agent/handlers/NodesClosestActiveConnectionsGet';
import * as nodesUtils from '@/nodes/utils';
import * as testsUtils from '../../../utils';
import NodeConnectionManager from '../../../../src/nodes/NodeConnectionManager';
import NodesAuthenticateConnection from '../../../../src/nodes/agent/handlers/NodesAuthenticateConnection';

describe('nodesClosestLocalNode', () => {
const logger = new Logger('nodesClosestLocalNode test', LogLevel.WARN, [
Expand Down
2 changes: 1 addition & 1 deletion tests/notifications/NotificationsManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import KeyRing from '@/keys/KeyRing';
import NodeConnectionManager from '@/nodes/NodeConnectionManager';
import NodeGraph from '@/nodes/NodeGraph';
import NodeManager from '@/nodes/NodeManager';
import NodesAuthenticateConnection from '@/nodes/agent/handlers/NodesAuthenticateConnection';
import NotificationsManager from '@/notifications/NotificationsManager';
import * as nodesErrors from '@/nodes/errors';
import * as notificationsErrors from '@/notifications/errors';
Expand All @@ -32,7 +33,6 @@ import * as utils from '@/utils';
import * as testUtils from '../utils';
import * as tlsTestsUtils from '../utils/tls';
import 'ix/add/asynciterable-operators/toarray';
import NodesAuthenticateConnection from '../../src/nodes/agent/handlers/NodesAuthenticateConnection';

describe('NotificationsManager', () => {
const password = 'password';
Expand Down
2 changes: 1 addition & 1 deletion tests/vaults/VaultManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import ACL from '@/acl/ACL';
import GestaltGraph from '@/gestalts/GestaltGraph';
import NodeManager from '@/nodes/NodeManager';
import NodeConnectionManager from '@/nodes/NodeConnectionManager';
import NodesAuthenticateConnection from '@/nodes/agent/handlers/NodesAuthenticateConnection';
import KeyRing from '@/keys/KeyRing';
import PolykeyAgent from '@/PolykeyAgent';
import VaultManager from '@/vaults/VaultManager';
Expand All @@ -35,7 +36,6 @@ import * as keysUtils from '@/keys/utils';
import * as nodeTestUtils from '../nodes/utils';
import * as testUtils from '../utils';
import * as tlsTestsUtils from '../utils/tls';
import NodesAuthenticateConnection from '../../src/nodes/agent/handlers/NodesAuthenticateConnection';

describe('VaultManager', () => {
const localhost = '127.0.0.1';
Expand Down

0 comments on commit e909006

Please sign in to comment.