microsoft / CCF

Confidential Consortium Framework
https://microsoft.github.io/CCF/
Apache License 2.0
761 stars 205 forks source link

Cleanup `js::core::Context`, move functionality to `ExtensionInterface`s #6163

Closed eddyashton closed 15 hours ago

eddyashton commented 2 weeks ago

Goal is for js::core::Context to be a pure interpreter (ie - we don't insert anything that QuickJS doesn't), and a vaguely readable interface. This PR works towards the latter by shuffling methods around, removing a few unused/unnecessary overloads, and the former by introducing an Extension pattern rather than populate_global_XXX methods on the Context.

A goal of this extension pattern is the removal of the messy globals object on Context - previously lots of inserted calls relied on the globals.tx object inserted to support the ccf.kv functions. Now they explicitly use the state in their own extension, including a Tx* where necessary. This should also simplify cleanup, as its a case of deleting extensions rather than invalidating global values.

eddyashton commented 1 day ago

TODO before merging: