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

Move PendingData into storage module #1691

Closed
Mirko-von-Leipzig opened this issue Jan 23, 2024 · 1 comment
Closed

Move PendingData into storage module #1691

Mirko-von-Leipzig opened this issue Jan 23, 2024 · 1 comment

Comments

@Mirko-von-Leipzig
Copy link
Contributor

In contrast to other state data, pending data is ephemeral - it is not persisted to disk. It is only used by RPC methods.

The current flow for pending is roughly:

  1. Sync emits new pending data as it is received
  2. RPC methods read pending data - but are only allowed access to it once it has been validated against the latest actual state in storage. This prevents race conditions from pending being in memory, and an actual db transaction being opened.

Since we already use a db transaction to access pending data, we should move it to storage.

Rationale

  • having all state encapsulated in storage makes sense
  • allows us to unify pathfinder_storage::BlockId and pathfinder_common::BlockId
  • already requires a db transaction
  • opens the door for testing other database abstractions
    • e.g. having a postgres network db feeding a cluster of rpc nodes - this would require either:
      • pending queries can only be done on the master node, or
      • pending data must be persisted (which would be easy to try out once storage abstracts it)

Warning ⚠️

This may be quite convoluted to do correctly. Each RPC method currently handles pending itself - all of this would now need to be done in storage somehow. Could end up being simple or difficult.

@Mirko-von-Leipzig
Copy link
Contributor Author

Superceded by #2038

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

1 participant