Skip to content

[VM] Compress contracts before storing them and decompress on load, and bill the user only for the number of bytes in the compressed representation #2926

Open
@LNow

Description

@LNow

Is your feature request related to a problem? Please describe.
Contracts with comments (especially with very verbose and descriptive ones) are more expensive in use than contracts that do not have any comments at all. The difference in execution can be easily explain with size difference.

Over time we will see more and more complex contracts, and to make them readable and somewhat understandable to normal user they will need more and more comments.
If developers will have to choose between contracts readability and lower execution costs, they will start choosing the second one. And as a result we will loose the most important feature of Clarity.

But what if we would store contracts in 2 versions?

  1. Original one, just like they have been written and deployed by developers.
  2. "Minified" one, stripped of all comments and extra whitespaces

First one would be stored on-chain just like it is done right now - to keep readability. While the second one could be stored on a side, and used as "executable" version - to reduce execution costs.
There is no point in loading into memory contracts with comments every single time they are called if comments plays no role in execution.

Developers could pay more for contract deployment (2x storage + additional processing), but execution should be cheaper and faster.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Status

Status: 🆕 New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions