Skip to content

adr-038 state listener could observe uncommitted writes #13457

@yihuang

Description

@yihuang

Summary of Bug

adr-038 state listener get feed with uncommitted writes.

adr-038 state listener is expect to only listens to the writes that get committed into chain state at the end of block, but it currently listens to kv store interface, which could includes writes that are not committed eventually, for example write calls happens in a grpc query.

We should only listen to the state writes on the consensus state machine.

Version

all the versions that support adr-038 state listening

Steps to Reproduce

  • Setup state listener
  • Simulate a cache write in grpc query like this:
      cacheCtx, write := ctx.CacheContext()
      store := cacheCtx.KVStore(k.storeKey)
      store.Set([]byte("debug set"), []byte("value"))
      write()
  • Observe that the writes happen in grpc query are observed by state listener, although the writes will be discarded eventually.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions