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

[Chainweb Stream Client] Validate wire protocol client-server compatibility #267

Merged
merged 26 commits into from
Jun 12, 2023

Conversation

Takadenoshi
Copy link
Contributor

@Takadenoshi Takadenoshi commented May 8, 2023

Added support for the new initial event that sends server config values.

The server-side and protocol changes are described in the server PR description and the new README section of that PR

The proposed client implementation is to refuse to proceed for most of the incompatibility conditions by firing an error event, logging an error to the console and disconnecting. The conditions that error out fatally:

  • mismatched network
  • incompatible confirmation depth
  • incompatible wire protocol version (still TODO)
  • mismatched type (account/event)
  • mismatched ID (module/event name or account ID)

(the final two should never happen in production)

The exception is the heartbeat timeout config parameter. If the client heartbeat timeout is set to be smaller than the server, the client will automatically adapt its heartbeat timeout to SERVER_HEARTBEAT_TIMEOUT + 2500ms. The reasoning behind this is that changing this configuration value to match the server setting does not violate the developer expectations in any significant way, and it is preferable to (potentially) throwing a fatal error in production.

Still a draft as it is pending the version compatibility check, but the changes that are there already are good to review.

--

Regarding the wire protocol version [(event:initial).config.v, currently set to 0.0.2] what should the behavior be when the client and server have a different version?

I propose versioning the wire protocol by semver 2.0 (e.g. this version change that modifies the initial event in a way that breaks backwards compatibility would be a major version bump, but 0.x.y is exempt as unstable)

If there is a major version incompatibility, it should error our fatally as above.

Minor version incompatibility should just warn that some features may not be supported.

Patch version incompatibility should just warn (or do nothing.) Patch versions are unlikely to be used as a backwards-compatible bugfix on the protocol level does not make much sense

@Takadenoshi Takadenoshi marked this pull request as ready for review May 9, 2023 17:09
@Takadenoshi Takadenoshi changed the title Chainweb Stream Client: (intial event).config: validate compatibility [Chainweb Stream Client] Validate wire protocol client-server compatibility May 9, 2023
@Randynamic Randynamic force-pushed the chainweb-stream-client-initial-config-validate branch from ee6ffaa to 54ce94e Compare June 1, 2023 09:43
@Randynamic Randynamic requested a review from ggobugi27 as a code owner June 1, 2023 09:43
…ubkda:kadena-community/kadena.js into chainweb-stream-client-initial-config-validate
@Takadenoshi Takadenoshi requested a review from isaozler as a code owner June 5, 2023 11:53
@vercel
Copy link

vercel bot commented Jun 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
alpha-docs ⬜️ Ignored (Inspect) Visit Preview Jun 12, 2023 2:04pm

@Takadenoshi Takadenoshi merged commit 4e9d4e3 into master Jun 12, 2023
@Takadenoshi Takadenoshi deleted the chainweb-stream-client-initial-config-validate branch June 12, 2023 14:37
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.

3 participants