-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add gas limit #57
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
Conversation
poc/runtime/src/pvq.rs
Outdated
@@ -44,7 +44,8 @@ pub mod extensions { | |||
|
|||
pub fn execute_query(query: &[u8], input: &[u8]) -> PvqResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should take an optional gas limit as input to and max to like 2s of execution to prevent for people calling infinite loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the max execution time related to gas_limit or they are separately specified like execute_query(query: &[u8], input: &[u8], gas_limit: Option<i64>, ref_time_limit: u64)
? I supposed they should be related.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the input is gas limit. by 2s I mean estimate how much gas can be consumed to execute a code that takes 2s to complete
impl pvq_runtime_api::PvqApi<Block> for Runtime { | ||
fn execute_query(program: Vec<u8>, args: Vec<u8>, gas_limit: Option<i64>) -> pvq_primitives::PvqResult { | ||
// Set a default gas limit of 2 seconds | ||
pvq::execute_query(&program, &args, gas_limit.unwrap_or(ONE_SECOND_IN_GAS * 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if user did pass a gas limit, it should still not be greater than 2s
No description provided.