Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a83eda8
Basic perf test scaffolding
islathehut Aug 12, 2024
ee4c369
Start of more realistic workload
islathehut Aug 13, 2024
e73a125
crdx: Improve performance of calculateConcurrency
leblowl Aug 16, 2024
6bef419
crdx: Improve performance of decryptGraph
leblowl Aug 16, 2024
fd36b37
Error handling and connection issues
islathehut Aug 20, 2024
4041d11
Merge branch 'concurrency-performance' into isla-perf-test
islathehut Aug 20, 2024
03a8b73
Merge remote-tracking branch 'origin/decrypt-performance' into isla-p…
islathehut Aug 20, 2024
e2f4abf
Add graphs
islathehut Aug 20, 2024
f9889d7
Fix graph dataset building/running on test completion
islathehut Aug 21, 2024
2af5a57
More metrics/graphs and allow running on multiple machines
islathehut Aug 22, 2024
bcbfbe3
Fix indexing issue
islathehut Aug 22, 2024
da4d502
Try to catch dial issue
islathehut Aug 22, 2024
e471835
Better handling of connections/dialing
Aug 22, 2024
eb4d67b
Cap our dial time
islathehut Aug 22, 2024
9511785
Throw error when failing to dial within time limit
Aug 22, 2024
6c80c23
Fix
islathehut Aug 22, 2024
10eb5f2
Better snapshot handling
islathehut Aug 23, 2024
c42453b
Tons of changes and new logging
islathehut Aug 30, 2024
5150e9e
pushing changes
islathehut Sep 6, 2024
914d29b
Separate out networking logic
islathehut Sep 9, 2024
4819000
Mild cleanup
islathehut Sep 9, 2024
9313e65
More cleanup
islathehut Oct 25, 2024
bc8ef32
More cleanup and commenting on what can be removed in production
islathehut Oct 25, 2024
5641590
More cleanup and commenting on what we will use to integrate with libp2p
islathehut Oct 25, 2024
438adb2
More cleanup
islathehut Oct 25, 2024
f7d1b37
Merge branch 'main' into isla-perf-test
islathehut Nov 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ pnpm-works
runner-results
vite.config.ts.timestamp*
yalc.lock
yarn.lock
yarn.lock
.parcel-cache/**/*
data.json.*
*.log.*
5 changes: 4 additions & 1 deletion demos/quiet-sandbox/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.peerid.*
.orbitdb/**/*
.orbitdb/**/*
flamegraphs/**/*
isolate**.log.*
data.json.js
26 changes: 22 additions & 4 deletions demos/quiet-sandbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"build": "npx tsc",
"test": "echo \"Error: no test specified\" && exit 1",
"ig": "tsc && npm i -g .",
"start": "node dist/index.js interactive"
"start": "node dist/index.js interactive",
"test:perf:isla": "DEBUG=localfirst*,qsb* node --max-old-space-size=8192 --experimental-global-customevent --max_old_space_size=8192 dist/scripts/isla-perf/index.js interactive",
"test:perf:isla:graphs": "parcel src/scripts/isla-perf/index.html --open"
},
"keywords": [],
"author": "",
Expand All @@ -24,47 +26,63 @@
"@inquirer/prompts": "^5.3.0",
"@inquirer/type": "^1.5.1",
"@libp2p/bootstrap": "^10.0.24",
"@libp2p/crypto": "4.1.6",
"@libp2p/echo": "^1.1.1",
"@libp2p/identify": "^2.0.2",
"@libp2p/interface": "^1.6.1",
"@libp2p/interface-internal": "^1.3.1",
"@libp2p/kad-dht": "^12.0.17",
"@libp2p/mdns": "10.1.5",
"@libp2p/peer-id": "^4.2.1",
"@libp2p/peer-id-factory": "^4.2.1",
"@libp2p/tcp": "^9.0.26",
"@libp2p/crypto": "4.1.6",
"@localfirst/auth": "workspace:*",
"@localfirst/shared": "workspace:*",
"@multiformats/multiaddr": "^12.3.0",
"@orbitdb/core": "^2.2.0",
"ansi-colors": "4.1.3",
"ansi-escapes": "^7.0.0",
"bs58": "^6.0.0",
"chalk": "^4.1.2",
"chart.js": "^4.4.3",
"clipboardy": "4.0.0",
"colors": "^1.4.0",
"datastore-core": "9.2.9",
"debug": "4.3.6",
"fastq": "^1.17.1",
"figlet": "^1.7.0",
"figures": "^6.1.0",
"getmac": "^6.6.0",
"helia": "^4.2.4",
"inquirer": "^10.0.1",
"inquirer-select-pro": "^1.0.0-alpha.6",
"interface-datastore": "8.3.0",
"it-length-prefixed": "^9.0.4",
"it-map": "^3.1.1",
"it-pipe": "^3.0.1",
"it-protobuf-stream": "^1.1.3",
"it-pushable": "^3.2.3",
"libp2p": "^1.8.1",
"luxon": "3.5.0",
"multiformats": "^13.2.0",
"@multiformats/multiaddr": "^12.3.0",
"pad": "^3.2.0",
"quiet-sandbox": "link:",
"rng": "0.2.2",
"type-fest": "^4.21.0",
"uint8arraylist": "^2.4.8"
"uint8arraylist": "^2.4.8",
"weald": "1.0.2"
},
"devDependencies": {
"@types/bs58": "4.0.4",
"@types/debug": "4.1.12",
"@types/figlet": "^1.5.8",
"@types/inquirer": "^9.0.7",
"@types/luxon": "3.4.2",
"@types/node": "^18.18.13",
"0x": "^5.7.0",
"eslint": "^9.7.0",
"nodemark": "0.3.0",
"parcel": "^2.6.2",
"prettier": "^3.1.0",
"ts-node": "^10.9.2",
"typescript": "^5.5.3"
Expand Down
65 changes: 26 additions & 39 deletions demos/quiet-sandbox/src/auth/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,37 @@
* Handles generating the chain and aggregating all chain operations
*/

import * as auth from '@localfirst/auth'
import * as lfa from '@localfirst/auth'
import { LoadedSigChain } from './types.js'
import { UserService } from './services/members/userService.js'
import { RoleService } from './services/roles/roleService.js'
import { ChannelService } from './services/roles/channelService.js'
import { DeviceService } from './services/members/deviceService.js'
import { InviteService } from './services/invites/inviteService.js'
import { DMService } from './services/dm/dmService.js'
import { CryptoService } from './services/crypto/cryptoService.js'
import { RoleName } from './services/roles/roles.js'
import { findAllByKeyAndReplace } from '../utils/utils.js'

class SigChain {
private _team: auth.Team
private _team: lfa.Team
private _users: UserService | null = null
private _devices: DeviceService | null = null
private _roles: RoleService | null = null
private _channels: ChannelService | null = null
private _dms: DMService | null = null
private _invites: InviteService | null = null
private _crypto: CryptoService | null = null

private constructor(team: auth.Team) {
private constructor(team: lfa.Team) {
this._team = team
}

private static init(team: lfa.Team): SigChain {
const sigChain = new SigChain(team)
sigChain.initServices()

return sigChain
}

/**
* Create a brand new SigChain with a given name and also generate the initial user with a given name
*
Expand All @@ -35,7 +41,7 @@ class SigChain {
*/
public static create(teamName: string, username: string): LoadedSigChain {
const context = UserService.create(username)
const team: auth.Team = this.lfa.createTeam(teamName, context)
const team: lfa.Team = lfa.createTeam(teamName, context)
const sigChain = this.init(team)

sigChain.roles.createWithMembers(RoleName.MEMBER, [context.user.userId])
Expand All @@ -47,41 +53,19 @@ class SigChain {
}
}

public static createFromTeam(team: auth.Team, context: auth.LocalUserContext): LoadedSigChain {
public static createFromTeam(team: lfa.Team, context: lfa.LocalUserContext): LoadedSigChain {
const sigChain = this.init(team)
return {
context,
sigChain
}
}

// TODO: Is this the right signature for this method?
public static join(context: auth.LocalUserContext, serializedTeam: Uint8Array, teamKeyRing: auth.Keyring): LoadedSigChain {
const team: auth.Team = this.lfa.loadTeam(serializedTeam, context, teamKeyRing)
team.join(teamKeyRing)

const sigChain = this.init(team)
// sigChain.persist()

return {
sigChain,
context
}
}

private static init(team: auth.Team): SigChain {
const sigChain = new SigChain(team)
sigChain.initServices()

return sigChain
}

private initServices() {
this._users = UserService.init(this)
this._devices = DeviceService.init(this)
this._roles = RoleService.init(this)
this._channels = ChannelService.init(this)
this._dms = DMService.init(this)
this._invites = InviteService.init(this)
this._crypto = CryptoService.init(this)
}
Expand All @@ -91,14 +75,25 @@ class SigChain {
return this.team.save() // this doesn't actually do anything but create the new state to save
}

get team(): auth.Team {
get team(): lfa.Team {
return this._team
}

get teamGraph(): auth.TeamGraph {
get teamGraph(): lfa.TeamGraph {
return this._team.graph
}

get minifiedTeamGraph(): lfa.TeamGraph {
return findAllByKeyAndReplace(JSON.parse(JSON.stringify(this.teamGraph)), [
{
key: 'data',
replace: {
replacerFunc: (dataArray: any[]) => Buffer.from(dataArray).toString('base64')
}
}
])
}

get users(): UserService {
return this._users!
}
Expand All @@ -119,17 +114,9 @@ class SigChain {
return this._invites!
}

get dms(): DMService {
return this._dms!
}

get crypto(): CryptoService {
return this._crypto!
}

static get lfa(): typeof auth {
return auth
}
}

export {
Expand Down
Loading