tendermint: the same transaction appears in two different blocks
Tendermint version (use tendermint version or git rev-parse --verify HEAD if installed from source): v0.33.9
ABCI app (name for built-in, URL for self-written if it’s publicly available): cosmos v0.39.2,okexchain v0.16.6
Environment:
- OS (e.g. from /etc/os-release): mac os 11.2.1
- Install tools: make
- Others:
What happened:
- the same transaction appears in two different blocks
What you expected to happen:
- the same transaction should not appears in two different blocks, that is to say that one txhash should only appear once on the whole block chain.
Have you tried the latest version: yes/no no
How to reproduce it (as minimally and precisely as possible):
- change the code in https://github.com/tendermint/tendermint/blob/1baf670c60c1c97c42523f2c14c6c0768812856c/abci/client/client.go#L102 as follow to simulate a scenario in concurrency to accelerate scene reproduction:
var b bool = true
// Sets the callback for this ReqRes atomically.
// If reqRes is already done, calls cb immediately.
// NOTE: reqRes.cb should not change if reqRes.done.
// NOTE: only one callback is supported.
func (reqRes *ReqRes) SetCallback(cb func(res *types.Response)) {
reqRes.mtx.Lock()
if reqRes.done {
reqRes.mtx.Unlock()
if b {
b = false
time.Sleep(time.Second*10)
}
cb(reqRes.Response)
return
}
reqRes.cb = cb
reqRes.mtx.Unlock()
}
-
send two txs by a account with sync mode, tx1 with sequence 1, tx2 with sequence 2. The sequence of the account on chain is 1.
-
all txs are added into mempool, the tx2 will be added into mempool befor tx1. Then tx2 is proposed into block ahead of tx1, so the tx2’s sequence is not equal to the sequence on chain when executing antehandler in deliverTx.
-
the tx1’s sequence is satisfied. And the tx2 will not be removed when call recheckTx, because the tx2’s sequence is satisfied after the tx1 handled, so tx2 is proposed into the next block.
Logs (paste a small part showing an error (< 10 lines) or link a pastebin, gist, etc. containing more of the log file):
Config (you can paste only the changes you’ve made):
node command runtime flags:
Please provide the output from the http://<ip>:<port>/dump_consensus_state RPC endpoint for consensus bugs
Anything else we need to know:
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (19 by maintainers)
No, but you can add sleep code like above I have issued to reproduct this case through cosmos simulate app.
the same hash is the hash of tx2. That is to say tx2 will be packaged into two different blocks.