Skip to content

Conversation

nikgraf
Copy link
Collaborator

@nikgraf nikgraf commented Nov 13, 2024

  • add previousEventHash to the transaction and verify it in applyEvent
  • store counter and current state in the DB to order and verify events on the server (the server verifies that the event is valid before persisting it - this ensures that it's a single chain of valid events)

Note: applyEvent on the server is not yet used. Next up will implement adding an invitation and use it there.

Resolves: #35

data: {
spaceId,
counter: lastEvent.counter + 1,
event: JSON.stringify(event),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we use canonicalize here? Not sure it is necessary, or if we just need the JSON event object

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In this case we need to JSON.parse the event to forward it to other participants

}
});

it('should fail in case state is not provided for an event other thant createSpace', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick. typo: thant -> than

@nikgraf nikgraf merged commit a550cca into main Nov 13, 2024
1 check passed
@nikgraf nikgraf deleted the events-order branch November 13, 2024 21:25
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.

Verify order in space events

2 participants