Skip to content

Conversation

pcarranzav
Copy link
Member

@pcarranzav pcarranzav commented Jan 28, 2025

Closes #70

WIP

@pcarranzav pcarranzav force-pushed the pcv/sign-every-update branch 3 times, most recently from f4a87f5 to e1e321c Compare January 28, 2025 21:30
@pcarranzav
Copy link
Member Author

pcarranzav commented Jan 28, 2025

Still in progress.
Next up:

@pcarranzav pcarranzav force-pushed the pcv/sign-every-update branch from ae96400 to 25b94a3 Compare January 29, 2025 22:20
@pcarranzav pcarranzav marked this pull request as ready for review January 29, 2025 22:23
@pcarranzav
Copy link
Member Author

Still need to see if it works, but I think it's ready for review at this point

@@ -1,5 +1,6 @@
import { parse } from 'node:url';
import { Identity, Messages, SpaceEvents, Utils } from '@graphprotocol/hypergraph';
import { recoverUpdateMessageSigner } from '@graphprotocol/hypergraph/messages/signed-update-message';
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you fix the import? afaik we should export it properly and not do deep imports

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops, missed this, will fix

});

space?.automergeDocHandle?.update((existingDoc) => {
const [newDoc] = automerge.applyChanges(existingDoc, automergeUpdates);
Copy link
Collaborator

Choose a reason for hiding this comment

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

here we gather all the automergeUpdates and then apply them. I actually didn't do it properly in the other case, but this should be the way to go. Can you update the function to do it this way?

The reason is that afaik this is much more performant than applying ever update in a for loop

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense, will fix

@pcarranzav
Copy link
Member Author

Tested running the events app locally and can confirm updates are propagated correctly afaict

@pcarranzav pcarranzav requested a review from nikgraf January 30, 2025 20:30
Copy link
Collaborator

@nikgraf nikgraf left a comment

Choose a reason for hiding this comment

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

nice work 👏

@nikgraf nikgraf merged commit 0cc0ae2 into main Jan 31, 2025
4 checks passed
@nikgraf nikgraf deleted the pcv/sign-every-update branch January 31, 2025 10:05
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.

Sign every change

2 participants