Update transaction submission HTTP return #762
Labels
Node infra
Related to the necessary infrastructure provided by all psibase infrastructure providers
Milestone
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:
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".
The text was updated successfully, but these errors were encountered: