Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Computron Estimator #3301

Open
katelynsills opened this issue Jun 11, 2021 · 2 comments
Open

Computron Estimator #3301

katelynsills opened this issue Jun 11, 2021 · 2 comments
Labels
enhancement New feature or request metering charging for execution (was: package: tame-metering and transform-metering)

Comments

@katelynsills
Copy link
Contributor

If we follow a model where the contract creator is charged for all execution in the ZCFVat for that contract instance, as in #3294, then the contract creator will need to be able to pass on the costs to users. The contract creator will need to know three things in order to pass on costs:

  1. The contract creator needs to know the extent to which the incoming message from the user can cause execution. In other words, there needs to be a clear understanding of how much execution the user can trigger (in the worst case? average case?) through that particular message. This will be easy or difficult depending on the complexity of the code. For example, in our simplest toy contract automaticRefund, the offerHandler is:
  const refund = seat => {
    offersCount += 1n;
    seat.exit();
    return `The offer was accepted`;
  };

This is simple to isolate and estimate. However, we also have complex examples. For instance, opening a vault loan requires scheduling a potential future liquidation, and whether that liquidation occurs depends dynamically on the price. So perhaps there needs to be a way to search through the potential branches given a particular code entry point to find the most costly path, the median/average cost of the execution path, and the cheapest path. This seems somewhat similar to code coverage tools.

  1. For any particular path, the contract developer needs to know how much the meter will be deducted. This should not change often, as whether or not a meter is exhausted on-chain needs to be part of the determinism. In other words, the contract developer needs to know how many computrons an execution path will take.

  2. The contract developer needs to know the price in RUN for an amount of computrons. The current price is helpful, but what the contract developer really needs to know is the future price, at the time that the user's message is being executed.

Number 3 is out of scope for a computron estimator and needs to be represented in a different issue, but I think Number 1 and 2 are in scope.

@katelynsills katelynsills added the enhancement New feature or request label Jun 11, 2021
@dckc
Copy link
Member

dckc commented Jun 13, 2021

I wonder to what extent we owe a computron estimate on each of our APIs... And to what extent changes in computron cost constitute breaking changes.

@zarutian
Copy link
Contributor

sorry, not sorry: Computrontimator

@dckc dckc added the metering charging for execution (was: package: tame-metering and transform-metering) label Oct 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request metering charging for execution (was: package: tame-metering and transform-metering)
Projects
None yet
Development

No branches or pull requests

4 participants