You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VM instantiation spends a third of its time defining host functions in the linker -- these are fairly atomics-heavy operations due to threadsafety in wasmi -- and this can be minimized if we filter for the host functions that a contract actually uses.
The caveat here is that in the worst case a contract could still use all host functions, so from a metering perspective we would probably have to make the instantiation costs more granular (eg. introduce a new cost type LinkVMFunction with a linear model based on the number used, or something).
The text was updated successfully, but these errors were encountered:
This is a sketch of the first step in the plan for addressing #1292 and
eventually #827 and #1313, namely:
- add a bunch of cost types that decompose the current "worst case" VM
instantiation cost type
- continue to charge the worst case on initial contract upload
- _store_ the decomposed cost-type inputs in the ledger, since we can
observe them after the initial upload parse
- _use_ those decomposed cost-type inputs when doing runtime
instantiation
- add a module cache
- populate the module cache with all modules on host startup
- use cached modules during instantiation
This PR has accompanying changes in XDR and wasmi:
- stellar/stellar-xdr#177
- stellar/rs-stellar-xdr#346
Remaining to do:
- [x] determine what the correct set of decomposed cost types even is
- [ ] ~add more code to wasmi to enable observing more inputs~
- [x] add cost-type runners / calibrations for all the decomposed
cost-types
- [x] protocol-gate this new behaviour
- [x] make the linker-loop do less work to match the tighter cost model
(i.e. complete #1292)
- [x] possibly _duplicate_ the set of cost types added here, so we have
a cached and uncached version of each, and implement a solution to #827
- [ ] possibly decompose the set sufficiently to model what will happen
when we take wasmi 0.32 and enable lazy translation (i.e. complete
#1313)
VM instantiation spends a third of its time defining host functions in the linker -- these are fairly atomics-heavy operations due to threadsafety in wasmi -- and this can be minimized if we filter for the host functions that a contract actually uses.
The caveat here is that in the worst case a contract could still use all host functions, so from a metering perspective we would probably have to make the instantiation costs more granular (eg. introduce a new cost type
LinkVMFunction
with a linear model based on the number used, or something).The text was updated successfully, but these errors were encountered: