Skip to content
This repository was archived by the owner on Dec 3, 2025. It is now read-only.

Feat/use sbs#91

Merged
devceline merged 23 commits intomainfrom
feat/use-sbs
Jan 12, 2024
Merged

Feat/use sbs#91
devceline merged 23 commits intomainfrom
feat/use-sbs

Conversation

@devceline
Copy link
Copy Markdown
Contributor

@devceline devceline commented Jan 9, 2024

Note

Only merging after a new version of core is released with changes from canary
Changes fix the reason the CI was flaky sometimes pending_sub_watch_label was not unique per subscription

Changes

Warning

We are not setting the mjv flag as we still want notify_subscriptions_changed for now, to maintain complete compatibility with web3inbox. Will refactor when we have more time

Spec TL;DR

Add sbs flag to subscribe, delete and update functions. This includes latest state of subscription, causing us to not need to depend on notify_subscriptions_changed for latest state. Furthermore, functions only resolve after latest state is synced to local state.

Reminder of architecture:

image

@devceline devceline marked this pull request as ready for review January 11, 2024 16:47
@devceline devceline requested a review from bkrem January 12, 2024 09:09
Copy link
Copy Markdown
Contributor

@bkrem bkrem left a comment

Choose a reason for hiding this comment

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

Submitting first pass notes. Will do final run through also on the added code in engine shortly

senderPublicKey: selfPublicKey,
receiverPublicKey: dappPublicKey,
}
).then((id) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What happens if this throws? Assuming it will still throw the whole subscribe fn as it did before with async/await?

Nit: would prefer to keep the async/await style consistent that's already used throughout the fn instead of switching to chain syntax right at the end.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Honestly I just know it's not good practice to use async () => to create a promise and I needed a promise to arbitrarily resolve. I'll add a catch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fair point, hence only a nit :) Assuming this throws as it did before no need for a catch I guess since the behaviour should just stay the same if possible

);

const claims =
this.decodeAndValidateJwtAuth<NotifyClientTypes.UpdateResponseJWTClaims>(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not key for this PR, but this section and the one for notify_subscription_response are basically identical apart from the RPC method from what I can tell.

Would be good to refactor this to be abstracted later, to remove the possibility of bugs when updating one flow and not the other by mistake.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Absolutely - i had the same thought after Los Alamos but I never found the time

@bkrem
Copy link
Copy Markdown
Contributor

bkrem commented Jan 12, 2024

Looking solid and excellent PR context 🙏

@devceline devceline merged commit 3e303de into main Jan 12, 2024
@devceline devceline deleted the feat/use-sbs branch January 12, 2024 11:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants