Replies: 4 comments 2 replies
-
One could wrap an entire application embedding an Application and overriding as needed type MyApp struct {
Application
otherField OtherType
} 👍 Making Application an interface makes sense here, so the consumers don't care if it has been wrapped or not. 🤷 However, the pattern as "ApplicationMiddleware" seems not so interesting to me. More like I would wrap it one time for one specific purpose for my custom blockchain if I want to do some super-special customisation. I think the more interesting part is allowing I would focus the middleware and customisation to fit inside BaseApp and at a lower level than the abci interface, so we can pass |
Beta Was this translation helpful? Give feedback.
-
Do you mean that |
Beta Was this translation helpful? Give feedback.
-
This is a very big interface. Why not composing on the smaller levels (eg snapshot, commit, ...)? AlternativeI propose to only have a smaller / dedicated interfaces: type TxHandler interface { // This one we have
CheckTx(context.Context, RequestCheckTx) ResponseCheckTx // Validate a tx for the mempool
DeliverTx(context.Context, RequestDeliverTx) ResponseDeliverTx // Deliver a tx for full processing
}
type SnapshotMiddleware interface {
ListSnapshots(context.Context, RequestListSnapshots) ResponseListSnapshots // List available snapshots
OfferSnapshot(context.Context, RequestOfferSnapshot) ResponseOfferSnapshot // Offer a snapshot to the application
LoadSnapshotChunk(context.Context, RequestLoadSnapshotChunk) ResponseLoadSnapshotChunk // Load a snapshot chunk
ApplySnapshotChunk(context.Context, RequestApplySnapshotChunk) ResponseApplySnapshotChunk // Apply a shapshot chunk
}
type QueryHandler interface {
Query(context.Context, RequestQuery) ResponseQuery // Query for state
} |
Beta Was this translation helpful? Give feedback.
-
I fully support replacing 90% of BaseApp with decorators (which take over AnteHandler and much of the orchestration logic). This is what I did in weave and it worked great as we added lots of application logic and iterated on it. The proposed decomposition seems to be more theoretically motivated and I have not seen some clear use cases, where it will provide functionality easier than could be achieved some other way. I would like to see some concrete examples of what you want to achieve.
It is good to restrict APIs in some ways if you can make them work better for 99% of the use cases. So purely "more flexible" only makes sense if there is a clear need for that flexibility |
Beta Was this translation helpful? Give feedback.
-
This seems like the next logical step after #9585 and would make the SDK much more modular and configurable at the ABCI protocol level. I don't see a super high priority for this, but just documenting the overall gist.
The basic idea would to have a type
Application
which is basically theabci.Application
interface withcontext.Context
params plus pure functionalApplicationMiddleware
.For ADR-040/SMT migration, the provision of a root store could then become something that store middleware deals with and this could be swapped out for the old IAVL store or some other implementation.
@fdymylja @jgimeno I know deprecating BaseApp is something you two have been looking into. Wonder if you have any thoughts. @ethanfrey wonder if you have any experiences to share from your experiences with Weave.
Beta Was this translation helpful? Give feedback.
All reactions