Skip to content

Add rough gas pricing for crypto APIs #758

@ethanfrey

Description

@ethanfrey

Part of #751
Builds on #757

All these exposed entry points need to charge gas. We start with some rough values that can be addressed later.

Cosmos SDK charges 1000 sdk gas for one secp256k1 signature verification. We currently use a factor of 100 to convert sdk gas to wasm gas.

Thus, we should start with a pricing of 100_000 gas for a secp256k1 verification (for any of the 3 formats). We can do some rough benchmarking of ed25519 vs secp256k1 on a linux i686 machine and then use the relative cost to pick gas costs for that verification (eg. if it is 30% slower, it should be 130_000 gas).

We should revisit this pricing later using more detailed benchmarking, once we close the final point of #670 (which would provide a consistent mapping from wasm gas -> cpu time on a given machine). Currently two contracts with the same gas may have a disparity in cpu time based on which instructions they use (some are more expensive to execute, but they are all charged the same gas)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions