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

Update transaction submission HTTP return #762

Open
2 tasks
James-Mart opened this issue Jun 19, 2024 · 0 comments
Open
2 tasks

Update transaction submission HTTP return #762

James-Mart opened this issue Jun 19, 2024 · 0 comments
Assignees
Labels
Node infra Related to the necessary infrastructure provided by all psibase infrastructure providers
Milestone

Comments

@James-Mart
Copy link
Member

James-Mart commented Jun 19, 2024

Background

There are multiple modes that an app may prefer to use to govern transaction submission behavior between the client and server.

Option 1: Optimistic submission

This tells the server to send a 200 OK response as soon as the transaction can be speculatively executed successfully. This is the method used by front-ends who prefer the fastest possible response to provide the best possible user-interaction, at the cost of needing to handle rollbacks in the unlikely event of a fork.

Option 2: Wait for finality

This tells the server to send a 200 OK response only after a block that has become irreversible contains the specified transaction. This should likely be the default behavior for apps, as it requires to special rollback handling for front-ends.

Option 3: Wait for applied

This is the current behavior.

This tells the server to send a 200 OK response only after the transaction has been applied in a block. If the transaction is submitted to the node that is the current consensus leader (block producer), then this is effectively equivalent to optimistic submission, since applying the transaction in the block implies executing the transaction. However, if the transaction is not submitted to the leader (which will likely be common), then this has a worst-case-scenario lag-time of approximately: 500ms (for node->leader->node roundtrip) + 1s (block time) for getting user-feedback, and average-case lag-time: 250ms + 500ms, and still has a small chance of suffering from forks. So I think this option is the worst of all worlds, but it's what we currently have.

Scope

In scope of this issue are the following two tasks:

  • Server-side support for specifying the response-mode that the client wants
  • Support two modes: "Wait for applied" and Wait for finality"

Exclusions

As part of some future task where we add the ability for nodes to do speculative execution, we can also then add that as a transaction submission mode. At this time we may also choose to delete Option 3, "Wait for applied" and completely replace it with Option 1, "Optimistic submission".

@James-Mart James-Mart added the Node infra Related to the necessary infrastructure provided by all psibase infrastructure providers label Jun 19, 2024
@James-Mart James-Mart added this to the R2 milestone Jun 19, 2024
@James-Mart James-Mart modified the milestones: R2, R3 Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Node infra Related to the necessary infrastructure provided by all psibase infrastructure providers
Projects
Status: No status
Development

No branches or pull requests

2 participants