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

Add support for metering #32

Open
axic opened this issue Dec 3, 2019 · 0 comments
Open

Add support for metering #32

axic opened this issue Dec 3, 2019 · 0 comments

Comments

@axic
Copy link
Member

axic commented Dec 3, 2019

The goal is to be able to meter EEs and store those in the yaml file. It should be possible to try different metering approaches.

Regarding the API I suggest a slightly different one to Ewasm 1.x, to follow the naming planned for Primea: ticks as opposed to gas, where ticks represent "cpu ticks" aka "cpu cycles".

  1. The only API would be useTicks(i64). This has been added in 0b9882e.
  2. As part of that ticks are hardcoded currently to 10_000_000 in Runtime. We could consider exposing this to the YAML.
  3. The YAML should be extended with a ticksCount or ticksUsed field next to the expected post state.

Lastly, the question is how to inject metering. We could consider:

  1. Using the sentinel contract as is, but that would require the subset of Ewasm 1.0 API.
  2. Changing the sentinel contract to have a different wasm API.
  3. Using sentinel-rs as a Rust crate.

Originally chisel was supposed to have the metering algorithm and sentinel-rs would be the contract version (but this hasn't happened yet) and as such sentinel-rs should not be a library. However probably the easiest we can do is include wasm-utils (with our changes) as a crate from the sentinel-rs git repo. We do need to add useTicks to it though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant