oasis-sdk icon indicating copy to clipboard operation
oasis-sdk copied to clipboard

runtime-sdk: improve ergonomics of prefetch handlers API

Open mitjat opened this issue 3 years ago • 0 comments

When specifying handlers for Call and Query methods in the SDK, they receive their arguments deserialized from cbor, and they return results without mucking with runtime-global variables. That is not the case for Prefetch (which happens optionally before each Call): Args are received as a cbor blob, and the handler has to return () and instead mark items to prefetch by extending a mutable input argument BTreeSet.

This design was chosen for performance reasons, but without real-world benchmarks. Consider if performance is still an issue, or if a cleaner API for prefetch handler is possible.

Context: https://github.com/oasisprotocol/oasis-sdk/pull/774#discussion_r801490651

mitjat avatar Feb 10 '22 15:02 mitjat