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
#1359 introduced a pattern where several cost types have to be charged in group.
Specifically those ParseWasm* and InstantiateWasm* types (10 of them each) must always be charged together. In fact, only the first member in the each group contains the constant cost term that are shared by the group.
A new method in Budget that accepts an array of CostTypes and inputs provides the following benefits:
More efficient. Only single mutable borrow of the budget, and can perform more efficient computation (e.g. vector multiplication).
Making sure the entirety of the group is charged. We can predefine those groups as constant arrays of [ContractCostType; 10].
The text was updated successfully, but these errors were encountered:
The cost to make a charge is quite small and this happens on a very expensive codepath; I'm not concerned about the cost. I agree such an interface might make for a bit of a correctness check (making sure that all the charges happen and none get left out) but .. it seems like it might be quite a bit of plumbing to accomplish, and even then wouldn't necessarily work long term since if we ever add an extension we'd need to runtime protocol-gate it, breaking the static (type-based) grouping.
#1359 introduced a pattern where several cost types have to be charged in group.
Specifically those
ParseWasm*
andInstantiateWasm*
types (10 of them each) must always be charged together. In fact, only the first member in the each group contains the constant cost term that are shared by the group.A new method in
Budget
that accepts an array ofCostType
s and inputs provides the following benefits:[ContractCostType; 10]
.The text was updated successfully, but these errors were encountered: