-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
This is a draft (will update shortly):
Summary
Consider enabling immediate execution (either by default, or, somehow make it possible to chose or overwrite the current behaviour for tendermint users).
Problem Definition
Currently, tendermint executes transactions one "block height off". Meaning that In the current execution model, blocks are executed against the app only after they are committed.
Full block verification (incl. state) always needs access to transactions of the previous block:
state(1) = InitialState
state(h+1) <- Execute(state(h), ABCIApp, block(h))
While that seem to be fine for most use-cases there are a few draw backs here:
- First of all it's confusing why transactions do not simply get executed in the same block (this is mostly a documentation concern). There is no clear documentation why this decision was made in tendermint. There are a few issues where this was discussed but these discussions are difficult to find and they don't explain the decision well enough.
- Dealing with one-offs is a classical source of bugs. That is a concern for app or rather SDK module developers. E.g., a dev who was instrumental in designing and implementing the PoS module in the SDK confirmed that "it actually being quite annoying to deal with the +1 offset". This is mostly about developer usability. It also (unnecessarily?) complicates the app centric point of view (ref: App centric interpretation of concepts #2483).
- In the context of IBC, for some zones it might be annoying to essentially "wait" an extra block for the state to actually be updated. Not sure if this is a real issue actually. But I can imagine for some projects that waiting a few extra seconds is at least non-optimal.
- For certain fee models, deferred execution is a burden, or makes them hacky/impossible to implement: Further investigate execution celestiaorg/celestia-core#3 (comment)
and Further investigate execution celestiaorg/celestia-core#3 (comment)
Proposal
First, the reasoning behind the current execution model needs to be documented (my understanding is that it is an optimization to reduce latency; s.t. validators can reach consensus on tx ordering quickly and then do the state transitions leisurely while timeout_commit didn't kick in yet). This should be done independent of the proposal to execute earlier.
TODO
Related:
- longish discussion over at LazyLedger: Further investigate execution celestiaorg/celestia-core#3
- Run CheckTx before voting on blocks #2384
- app centric interpretation of concepts: App centric interpretation of concepts #2483
- invalid/spam tx in blocks (sdk): Prevent Spam Txs cosmos/cosmos-sdk#4695
- also a bit related (block pre-processing phase would happen before the block gets proposed in the immediate exec I guess): https://github.com/tendermint/tendermint/issues/2639
- kinda related discussions on CheckTx: Run CheckTx before voting on blocks #2384 (comment)
For Admin Use
- Not duplicate issue
- Appropriate labels applied
- Appropriate contributors tagged
- Contributor assigned/self-assigned