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

Let the max_gas() function in BuiltinActor's take argument(s) #4395

Open
ekovalev opened this issue Dec 12, 2024 · 0 comments
Open

Let the max_gas() function in BuiltinActor's take argument(s) #4395

ekovalev opened this issue Dec 12, 2024 · 0 comments

Comments

@ekovalev
Copy link
Member

ekovalev commented Dec 12, 2024

In the modification made to the BuiltinActor trait (#4345), the new max_gas() function - a counterpart of the "weight()" function for pallets extrinsics, does not accept any arguments, so it can only report a single maximum gas needed for any message processing, regardless of the concrete payload.
This can backfire in cases when a builtin actor has very different execution paths depending on the payload, when we would have to prohibit actual light and fast handle based on a mere possibility it could have been a heavy and slow one.

To account for this we might want to let max_gas take some complexity arguments; it could be a "complexity" argument (similarly to what we have for extrinsics' weight functions) or some small fraction of the payload (the first byte or something) that would provide a clue about the actual execution path inside the handle etc.

That we can have more accurate estimation of the expected gas budged based on the actual message payload.

@ekovalev ekovalev changed the title Let the max_gas() function in BuiltinActor's take complexity argument(s) Let the max_gas() function in BuiltinActor's take argument(s) Dec 25, 2024
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

When branches are created from issues, their pull requests are automatically linked.

1 participant