Skip to content
This repository has been archived by the owner on Feb 5, 2025. It is now read-only.

[Cartesi Issues] - Builder transaction status API #175

Closed
jbearer opened this issue Oct 16, 2024 · 0 comments · Fixed by #236 · May be fixed by EspressoSystems/hotshot-query-service#727 or EspressoSystems/hotshot-events-service#120
Assignees

Comments

@jbearer
Copy link
Member

jbearer commented Oct 16, 2024

Users should be able to get feedback on their transactions, especially why they are not being sequenced, even if submitted through the public mempool. To this end, we should add a new transaction status API. This can be an extension of the existing tx_submit API or an entirely new module. Either way, it should have an endpoint GET /status/:hash, which returns one of the following responses:

{
  "status": "pending"
}
{
  "status": "sequenced",
  "block": number,
  "offset": number
}
{
  "status": "rejected",
  "reason": string
}
{
  "status": "unknown"
}

Notes:

  • the sequenced status is less critical, because this information can be obtained from the query service or block explorer, so it's a nice-to-have for the builder
  • the rejected status should return the same error that would have been returned from the builder's private submit endpoint, if applicable, but could also return other errors (e.g. transaction was initially accepted but was dropped from the transaction channel due to overflow)

To make this API possible, we will need to add to the state a mapping from transaction hash to status. This mapping would be updated whenever a transaction is rejected (by error return the private submit endpoint, by error when handling transactions on the public mempool event stream, or by getting dropped from the channel) or sequenced (ie appears in a DA proposal linked to a decide event) (nice-to-have).

We will also want to prune this mapping periodically. I think we should use a pruning policy similar to the query service, namely:

  • set a target amount of space to be used by this mapping (perhaps this could be expressed as a target number of transactions in the mapping)
  • set a minimum retention (configurable, default to 1 hour?): transactions can be pruned if we exceed target usage as long as they are older than the minimum
  • set a target retention (configurable, default to 24 hours?): transactions can be pruned if they are older than this even if we are not exceeding target usage

We will need to keep around extra metadata to facilitate pruning, e.g. age of entries in the map.

@shenkeyao shenkeyao changed the title Builder transaction status API [Fix Cartesi Issues] - Builder transaction status API Oct 28, 2024
@shenkeyao shenkeyao changed the title [Fix Cartesi Issues] - Builder transaction status API [Cartesi Issues] - Builder transaction status API Oct 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.