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

add_recursion_counter #333

Open
wants to merge 3 commits into
base: next_breaking_update
Choose a base branch
from

Conversation

Leo-Besancon
Copy link
Contributor

No description provided.

@Leo-Besancon Leo-Besancon marked this pull request as ready for review July 16, 2024 10:08
@Leo-Besancon Leo-Besancon changed the base branch from main to next_breaking_update July 16, 2024 10:15
@Leo-Besancon Leo-Besancon requested a review from sydhds July 16, 2024 10:18
@Leo-Besancon Leo-Besancon requested a review from damip July 17, 2024 10:14
@@ -38,6 +38,8 @@ pub(crate) fn call_module(
)))
})?;

interface.increment_recursion_counter()?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't that double-count with the increment that happens also in init_call ?

@@ -49,6 +51,8 @@ pub(crate) fn call_module(
if cfg!(not(feature = "gas_calibration")) {
set_remaining_points(&env, ctx, resp.remaining_gas)?;
}

interface.decrement_recursion_counter()?;
Copy link
Member

@damip damip Aug 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this double-decrement with the decrement in finish_call ?

@@ -152,6 +152,9 @@ fn abi_call(store_env: FunctionEnvMut<ABIEnv>, arg_offset: i32) -> Result<i32, W
let remaining_gas = handler.get_remaining_gas();
let interface = handler.exec_env.get_interface();
let module = helper_get_module(interface, bytecode, remaining_gas)?;
interface.increment_recursion_counter().map_err(|e| {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double-counts with the init_call_wasmv1

@@ -161,6 +164,9 @@ fn abi_call(store_env: FunctionEnvMut<ABIEnv>, arg_offset: i32) -> Result<i32, W
handler.get_gas_costs().clone(),
)
.map_err(|err| WasmV1Error::RuntimeError(format!("Could not run function: {}", err)))?;
interface.decrement_recursion_counter().map_err(|e| {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double-decrements with the finish_call below

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

Successfully merging this pull request may close these issues.

3 participants