Rpc error: code = Internal desc = collections: conflict: index uniqueness constraint violation: 0
Describe the Bug
When calling the debug_traceBlockByNumber method on a specific block, I receive the following error: JSON RPC Error -32000 — rpc error: code = Internal desc = collections: conflict: index uniqueness constraint violation: 0. However, the same call works fine on neighboring blocks.
To Reproduce
Make a POST request to https://emv-node-address with the following payload:
{ "jsonrpc": "2.0", "id": 1, "method": "debug_traceBlockByNumber", "params": ["0x69b406", {"tracer": "callTracer"}] }
Observe the error response:
{ "error": { "message": "-32000 rpc error: code = Internal desc = collections: conflict: index uniqueness constraint violation: 0" } }
Expected Behavior The trace of the block should be returned without error, similar to neighboring blocks.
Hi @gartnera ,
Thank you for triaging the bug!
Could you please share when you plan to start the investigation of the issue? I would appreciate even an approximate ETA.
Info for @zeta-chain/protocol-engineering : I attempted to run the trace on each individual transaction in the block identified using debug_traceTransaction. The zEVM transactions all traced successfully on a v28 archive endpoint, except for these three:
0x46a0b8e5b72091e1c12fed1ef6ff989601f0eb7263cd4a9650de540567c3bc2b0xbba2ecbf75e90b26ac5056c697a6bb796b8a8470271325786616f62ea6fb16960xcbe16384b8cf0615cc336740ce53fd6d4f914e4c8042ae61e523669546ba048a
Each of the above returned this:
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32000,
"message": "rpc error: code = Internal desc = collections: conflict: index uniqueness constrain violation: 0"
}
}
https://github.com/cosmos/cosmos-sdk/blob/release/v0.50.x/collections/indexes/unique.go#L60 is where this error originates from. I'm not exactly sure how we get it on a trace RPC which should be read only?
https://github.com/cosmos/cosmos-sdk/blob/release/v0.50.x/collections/indexes/unique.go#L60
trace endpoint is actually applying txs, i will take closer look
even though i couldnt reproduce it locally to me it seems that this is the place where this happens https://github.com/zeta-chain/ethermint/blob/main/x/evm/statedb/statedb.go#L601
and it is panicing from cosmos v50 in case of an error https://github.com/cosmos/cosmos-sdk/blob/v0.50.11/x/auth/keeper/account.go#L61
the issue is described here https://github.com/cosmos/cosmos-sdk/issues/23741
seems like this should be fixed in next cosmos release cc: @lumtis
Fixed in v34