Sharing Transaction between record layer and others


Is it a good idea to share the same Transaction between multiple layers? Namely, record layer and subspace layer?


Yes, it makes perfect sense to share a transaction between layers. For example, you could envision, say, a layer that implements a queue and you want to transactionally enqueue work based upon queries or results from record layer (this is a bit contrived an example, as it is relatively trivial to implement a queue in a Record Layer record store).

The main “gotcha” I could think of, offhand, might be use of a layer that changes the state of a transaction in a manner that may not be compatible with another layer (e.g. setCausalReadRisky())

Thanks. That’s great to know