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

Charge extra gas when doing serialization and deserialization #10681

Open
3 of 4 tasks
Tracked by #8917
robert-zaremba opened this issue Dec 6, 2021 · 4 comments
Open
3 of 4 tasks
Tracked by #8917

Charge extra gas when doing serialization and deserialization #10681

robert-zaremba opened this issue Dec 6, 2021 · 4 comments

Comments

@robert-zaremba
Copy link
Collaborator

Summary

We should charge extra gas when doing serialization.

Epic: #8917

Problem Definition

Today we only charge gas for doing storage operations and loops. For simple operations we only charge gas for a known expensive operations, like signature validation. Serialization is also known to be expensive (especially the "text mode" like JSON). And if there is lot of back and forth then we underprice the transactions.

Proposal

Add a codec wrapper (GasCodec) which will charge gas for every marshaling and unmarshaling.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@alexanderbez
Copy link
Contributor

Interesting idea. I think it makes sense 👍

@aaronc
Copy link
Member

aaronc commented Dec 16, 2021

I think this generally makes sense but we should wait to do it until 1) the codec supports the new code generator which is mostly done and 2) we have the app wiring work done so that it's easier to integrate new things like this with baseapp without making app.go even more complicated.

@tac0turtle
Copy link
Member

im not sure this is possible since we and users use a combination or raw proto.marshal and cdc.Marshal. We would create a odd world where some messages/state are serialised and others not

@alexanderbez
Copy link
Contributor

Given that modules will have access to a meter, let them decide where/what to charge extra for.

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

No branches or pull requests

5 participants