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

Bump blockifier to v0.13.5 #3130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Bump blockifier to v0.13.5 #3130

wants to merge 1 commit into from

Conversation

ddoktorski
Copy link
Contributor

@ddoktorski ddoktorski commented Mar 21, 2025

Stack:

⚠️ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.

@ddoktorski ddoktorski requested a review from a team as a code owner March 21, 2025 13:25
@ddoktorski ddoktorski marked this pull request as draft March 21, 2025 13:25
@ddoktorski ddoktorski requested a review from cptartur March 21, 2025 13:26
@ddoktorski
Copy link
Contributor Author

Towards #3037

Note: It is not possible to use blockifier from the Starkware repository at the moment due to a conflict with the cairo-lang-sierra dependency. It is strictly set to =2.10.0 there, whereas we have already bumped cairo dependencies to 2.11.2. A necessary modification has been made in my forked repository, which is being used for now.

@ddoktorski ddoktorski force-pushed the spr/master/1bd782e3 branch from dce17db to bbb2a19 Compare March 26, 2025 12:59
@ddoktorski ddoktorski marked this pull request as ready for review March 26, 2025 13:58
@ddoktorski ddoktorski requested a review from THenry14 March 26, 2025 14:54
Copy link
Collaborator

@THenry14 THenry14 left a comment

Choose a reason for hiding this comment

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

all the stuff is rather nitpicky so it's a +1 from me, but please address all the comments first (one way or the other). Great job 💪

versioned_constants.get_syscall_gas_cost(name) * (*count as u64)
.map(|(selector, usage)| {
let syscall_gas_cost = versioned_constants.get_syscall_gas_cost(selector);
let base_cost = syscall_gas_cost.get_syscall_cost(0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

as per comment above. idea: maybe we could make this logic common, put it in a function or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added get_syscalls_gas_consumed function

Comment on lines +67 to +73
// Increment the Deploy syscall's linear cost counter by the number of elements in the
// constructor calldata
syscall_handler.increment_linear_factor_by(
&SyscallSelector::Deploy,
request.constructor_calldata.0.len(),
);

Copy link
Member

Choose a reason for hiding this comment

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

Does this affect the gas tests? Or is the linear factor too small to contribute to them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does affect gas costs, which is reflected in the sierra gas tests below. When tracking Cairo steps it is negligible in our tests due to different fee formulat. We could potentially add a test that has it reflected for Cairo steps, but it would require calling deploy with calldata with at least 4 or 5 elements to see any change.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe it'd be worth adding a test like this. If we already are trying to be quite throughout with our gas tests.

Comment on lines +132 to +141
let entry_point = ExecutableCallEntryPoint {
class_hash,
code_address: entry_point.code_address,
entry_point_type: entry_point.entry_point_type,
entry_point_selector: entry_point.entry_point_selector,
calldata: entry_point.calldata.clone(),
storage_address: entry_point.storage_address,
caller_address: entry_point.caller_address,
call_type: entry_point.call_type,
initial_gas: entry_point.initial_gas,
};
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to reconstruct the entire entrypoint now? Not a big problem but I just wonder.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I was wondering as well, but it seems these are actually different structs now (ExecutableCallEntryPoint vs CallEntryPoint), and I don't think there is any way in blockifier to cast one to another

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to pass ExecutableCallEntryPoint not CallEntryPoint to execute_entry_point_call_cairo1 below. There is a function into_executable but it is private.

Copy link
Member

Choose a reason for hiding this comment

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

Let's create a PR that makes it public and an issue so we can update this eventually.

@ddoktorski ddoktorski force-pushed the spr/master/1bd782e3 branch from bbb2a19 to 9ddd29f Compare March 28, 2025 12:36
commit-id:1bd782e3
@ddoktorski ddoktorski force-pushed the spr/master/1bd782e3 branch from 9ddd29f to 74d2f3a Compare March 28, 2025 13:05
Copy link
Member

@cptartur cptartur left a comment

Choose a reason for hiding this comment

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

See my outstanding comments, otherwise looks good

Comment on lines +44 to +46
// We want to calculate `base_cost * call_count + linear_cost * linear_factor`
// There is a field name `linear_factor` used in both `SyscallUsage` and `SyscallGasCost`
// In `get_syscall_cost` function `linear_length` parameter is calldata length, hence `SyscallUsage.linear_factor`
Copy link
Member

Choose a reason for hiding this comment

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

What I meant is that the math to get these values is not 100% obvious (i.e. reason for call_count - 1).

But the extra context is also useful.

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.

4 participants