node icon indicating copy to clipboard operation
node copied to clipboard

Rpc error: code = Internal desc = collections: conflict: index uniqueness constraint violation: 0

Open tonatoz opened this issue 10 months ago • 5 comments

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.

tonatoz avatar Feb 20 '25 14:02 tonatoz

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.

vova-drpc avatar Mar 06 '25 13:03 vova-drpc

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:

  • 0x46a0b8e5b72091e1c12fed1ef6ff989601f0eb7263cd4a9650de540567c3bc2b
  • 0xbba2ecbf75e90b26ac5056c697a6bb796b8a8470271325786616f62ea6fb1696
  • 0xcbe16384b8cf0615cc336740ce53fd6d4f914e4c8042ae61e523669546ba048a

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"
  }
}

CryptoFewka avatar Mar 06 '25 15:03 CryptoFewka

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?

gartnera avatar Mar 27 '25 16:03 gartnera

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

skosito avatar Apr 15 '25 22:04 skosito

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

skosito avatar Apr 16 '25 04:04 skosito

Fixed in v34

CharlieMc0 avatar Aug 20 '25 18:08 CharlieMc0