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

Double-check our gas prices #1008

Closed
4 tasks
cwgoes opened this issue May 16, 2018 · 22 comments
Closed
4 tasks

Double-check our gas prices #1008

cwgoes opened this issue May 16, 2018 · 22 comments
Labels
spec T:Docs Changes and features related to documentation.

Comments

@cwgoes
Copy link
Contributor

cwgoes commented May 16, 2018

Figure out a moderately coherent strategy for pricing compute & storage operations, answering the following questions:

  • Relative price of compute / storage? Do we need an underlying hardware model?
  • Should modules building on the SDK calculate their own gas prices or just use the GasKVStore / crypto wrapper functions (is that enough)?
  • How much gas does a one-sender, one-recipient, one-coin transfer transaction need (as a relative benchmark)?
  • Gas limit should be increased before transfers are enabled (current block gas limit allows for ~10 txs/block). What should be the new gas limit?

Put all gas prices in governance-controlled parameters.

Write this up in a spec doc (=> "Core SDK" spec doc).

@cwgoes
Copy link
Contributor Author

cwgoes commented May 22, 2018

I think we should construct a basic benchmark (store reads/writes/iteration, expensive cryptographic operations), run it on a node-representative VM (midrange dedicated server?), and use the result of the benchmark to choose gas prices, adding in an extra cost for storage writes due to the persistent disk space requirement.

This should provide a reasonable-enough initial configuration, which governance can vote to change later as necessary with ParameterChangeProposals.

@cwgoes
Copy link
Contributor Author

cwgoes commented May 24, 2018

Typical node: MacBook 13 inch latest gen. Run on multiple hardware setups, average somehow.

Make sure benchmark is easily extensible.

Benchmark should include overlapping execution, best-fit the results.

@cwgoes
Copy link
Contributor Author

cwgoes commented May 30, 2018

Also see #1013 (comment), I wonder if we need a scratch space / storage space separation a la memory / storage in the EVM.

@cwgoes cwgoes added the T:Docs Changes and features related to documentation. label Jun 15, 2018
@mossid mossid self-assigned this Jul 18, 2018
@mossid mossid mentioned this issue Jul 26, 2018
8 tasks
@ValarDragon
Copy link
Contributor

ValarDragon commented Sep 8, 2018

We need to do a bit more rigorous of an analysis, but from plain benchmarks it seems that the only things that show up as significant amounts of time in block production are Golevel DB compaction, the way we do Reverse Iterators, and governance slashing for proposals. (Signature verification would also show up)

My current thought is that for launch we can just have a constant gas then based on signatures, and then just make the deposit for governance proposals very large. We should still set all the relevant gas parameters so that they can be changed via governance though. We still need to improve the simulation time metrics a bit, and do a bit more benchmarking (i.e. several orders of magnitude larger block heights, less frequent gov proposals), but I do feel relatively safe with the above for launch.

@ValarDragon
Copy link
Contributor

Per #2286 we probably should charge alot of gas for iterators. (Unless we get around to speeding that up prelaunch) My view atm is: proper gas for signatures, proper gas for iterator creation (e.g. nlogn on dirtyItems size), [significant] gas for submitProposal.

@ValarDragon
Copy link
Contributor

ValarDragon commented Oct 2, 2018

I propose that we benchmark computation with 1 gas = .1 ns, on some expected hardware specs. I think we should run this on cloud instances (e.g. AWS, Digital Ocean), as we expect most sentries to be a cloud instance. Therefore any strange performance things that could occur due to that should be accounted for.

With 1 gas = .1 ns, only using 52 bits of the 63 bits allocated for gas, we can already account for over computation thats greater than 24 hours. I don't think setting gas below .1ns make sense, since we cant benchmark that precisely in golang.

@jackzampolin
Copy link
Member

@ValarDragon What needs to be done here?

@ValarDragon
Copy link
Contributor

My current thought is that for launch we can just have a constant gas then based on signatures, and then just make the deposit for governance proposals very large. We should still set all the relevant gas parameters so that they can be changed via governance though. We still need to improve the simulation time metrics a bit, and do a bit more benchmarking (i.e. several orders of magnitude larger block heights, less frequent gov proposals), but I do feel relatively safe with the above for launch.

Per #2286 we probably should charge alot of gas for iterators as well

I propose that we benchmark computation with 1 gas = .1 ns, on some expected hardware specs.

@cwgoes
Copy link
Contributor Author

cwgoes commented Dec 14, 2018

These still need to be in the params store.

@jackzampolin
Copy link
Member

Related to #3248

@jackzampolin jackzampolin mentioned this issue Jan 9, 2019
4 tasks
@cwgoes
Copy link
Contributor Author

cwgoes commented Feb 7, 2019

Ref #3541

@cwgoes
Copy link
Contributor Author

cwgoes commented Mar 15, 2019

Note that we want to include this in 0.34, as we should increase the gas limit.

Maybe along with that we should add a few more benchmarks.

@alexanderbez alexanderbez removed this from the v0.34.0 milestone Apr 8, 2019
@cwgoes
Copy link
Contributor Author

cwgoes commented Jul 4, 2019

Hopefully the gas prices are reasonable, given that the network is live. :)

@cwgoes cwgoes closed this as completed Jul 4, 2019
@ValarDragon
Copy link
Contributor

Wait, unless I missed something we definitely didn't benchmark all the things we charge gas for and equalize them with time taken on some standard hardware.

@ValarDragon ValarDragon reopened this Jul 5, 2019
@cwgoes
Copy link
Contributor Author

cwgoes commented Jul 5, 2019

Wait, unless I missed something we definitely didn't benchmark all the things we charge gas for and equalize them with time taken on some standard hardware.

I think the transaction-associated compute costs pale in comparison to the cost of writing & storing data (it would still be useful to benchmark though, sure).

@alexanderbez alexanderbez removed their assignment Aug 30, 2019
@cwgoes
Copy link
Contributor Author

cwgoes commented Sep 6, 2019

Have we done this? I'm not convinced our gas prices have really been stress-tested.

@ValarDragon
Copy link
Contributor

I also don't think that they are normalized. (1 unit of CPU time = x gas)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec T:Docs Changes and features related to documentation.
Projects
None yet
Development

No branches or pull requests

7 participants