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

Update orbitdb #2600

Open
wants to merge 99 commits into
base: develop
Choose a base branch
from
Open

Update orbitdb #2600

wants to merge 99 commits into from

Conversation

leblowl
Copy link
Collaborator

@leblowl leblowl commented Sep 5, 2024

Pull Request Checklist

  • I have linked this PR to a related GitHub issue.
  • I have added a description of the change (and Github issue number, if any) to the root CHANGELOG.md.

(Optional) Mobile checklist

Please ensure you completed the following checks if you did any changes to the mobile package:

  • I have run e2e tests for mobile
  • I have updated base screenshots for visual regression tests

}

return this.ipfsInstance
}

private async initializeStores(init?: StoreInit): Promise<void> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is more complicated than it should be because we need to ensure that valueEncoding is set to buffer no matter what. I hit so many issues due to level not properly encoding to buffer...

@@ -0,0 +1,76 @@
/**
Copy link
Collaborator

Choose a reason for hiding this comment

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

This wrapper allows us to use the correct valueEncoding on all of our OrbitDB DBs.

@@ -0,0 +1,60 @@
import { AccessControllerType, IdentitiesType, LogEntry, Events, LogType } from '@orbitdb/core'
Copy link
Collaborator

Choose a reason for hiding this comment

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

This wrapper allows us to ensure the correct level value encoding.

@@ -0,0 +1,60 @@
import { AccessControllerType, KeyValue, IdentitiesType, LogType, LogEntry } from '@orbitdb/core'
Copy link
Collaborator

Choose a reason for hiding this comment

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

This wrapper allows us to ensure the correct level value encoding.

throw new Error('IPFS instance does not exist')
}

await this.blockstore?.db.close()
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a little weird but there are issues that can arise from not closing the underlying level DB, apparently.

@@ -102,7 +102,8 @@ export class CertificatesRequestsStore extends EventStoreBase<string> {
const pubKey = keyFromCertificate(parsedCsr)

if (filteredCsrsMap.has(pubKey)) {
filteredCsrsMap.delete(pubKey)
this.logger.warn(`Skipping csr due to existing pubkey`, pubKey)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The event store now returns records in descending order rather than ascending order.


const storage = await ComposedStorage(
await LRUStorage({ size: 1000 }),
await LevelStorage({ path, valueEncoding: 'buffer' })
Copy link
Collaborator

Choose a reason for hiding this comment

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

Level value encoding strikes again.

@@ -16,9 +16,11 @@ export const processInvitationCode = (mainWindow: BrowserWindow, code: string |

Copy link
Collaborator

Choose a reason for hiding this comment

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

This had nothing to do with the upgrade but I got tired of the errors so I cleaned this up.

backendProcess = fork(backendBundlePath, forkArgvs, {
env: {
NODE_OPTIONS: '--experimental-global-customevent',
DEBUG: 'backend*,quiet*,state-manager*,desktop*,utils*,identity*,common*,libp2p:connection-manager:auto-dial',
Copy link
Collaborator

Choose a reason for hiding this comment

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

The debug flag doesn't seem to be inherited from desktop anymore for some reason.

@@ -1,3 +1,5 @@
import { jest } from '@jest/globals'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Cleaned up the test organization and introduced some improvements.

import { createLogger } from './logger'

const logger = createLogger('utils')

export const BACKWARD_COMPATIBILITY_BASE_VERSION = '2.0.1' // Pre-latest production version
export const BACKWARD_COMPATIBILITY_BASE_VERSION = '2.3.1' // Pre-latest production version
Copy link
Collaborator

Choose a reason for hiding this comment

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

Didn't actually end up needing this but we'll wanna update this when we know if this will be part of 3.0.0 or 4.0.0.

@@ -0,0 +1,9 @@
root = true
Copy link
Collaborator

Choose a reason for hiding this comment

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

I added helia as a package which is NOT ideal but it was the fastest way to get it integrated, from my perspective. We should ultimately update it to be a submodule like lfa but I don't have it in me to do it right now.

@@ -176,7 +176,7 @@ - (void)applicationDidEnterBackground:(UIApplication *)application
{
[self stopTor];

NSString * message = [NSString stringWithFormat:@""];
NSString * message = [NSString stringWithFormat:@"app:close"];
Copy link
Collaborator

Choose a reason for hiding this comment

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

This was just to get rid of an error that didn't break anything, it was just annoying.

Copy link
Collaborator

@adrastaea adrastaea Nov 19, 2024

Choose a reason for hiding this comment

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

When an older client that has updated to this commit is loaded, the invitationLink will be invalid due to the PeerID being invalid.

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

Successfully merging this pull request may close these issues.

4 participants