-
Notifications
You must be signed in to change notification settings - Fork 28
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
chore(blockifier): add syscalls_gas_costs struct #2359
chore(blockifier): add syscalls_gas_costs struct #2359
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
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.
Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on @avi-starkware, @meship-starkware, and @Yonatan-Starkware)
crates/blockifier/src/versioned_constants.rs
line 566 at r1 (raw file):
#[derive(Debug, Default, Deserialize)] pub struct SyscallsGasCosts {
Suggestion:
SyscallGasCosts
crates/blockifier/src/versioned_constants.rs
line 662 at r1 (raw file):
// OS gas costs. pub transaction_gas_cost: u64, pub syscalls_gas_costs: SyscallsGasCosts,
Suggestion:
syscall_gas_costs
crates/blockifier/resources/versioned_constants_0_13_4.json
line 120 at r1 (raw file):
}, "validated": "VALID", "syscalls_gas_costs": {
We are going to remove these fields from the VC eventually, right?
so better to wait with this PR
Code quote:
"syscalls_gas_costs": {
8537aae
to
e574b59
Compare
7ab50eb
to
2f6b4f1
Compare
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.
Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on @avi-starkware, @meship-starkware, and @Yonatan-Starkware)
crates/blockifier/resources/versioned_constants_0_13_4.json
line 121 at r2 (raw file):
"validated": "VALID", "syscalls_gas_costs": { "call_contract_gas_cost": {
Now you can remove the _gas_cost
suffix
Suggestion:
"call_contract"
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.
Reviewable status: 0 of 3 files reviewed, 4 unresolved discussions (waiting on @avi-starkware, @meship-starkware, and @Yonatan-Starkware)
crates/blockifier/src/versioned_constants.rs
line 567 at r2 (raw file):
#[derive(Debug, Default, Deserialize)] pub struct SyscallsGasCosts { pub call_contract_gas_cost: u64,
Now you can remove this suffix
Suggestion:
pub call_contract: u64,
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.
Reviewable status: 0 of 3 files reviewed, 5 unresolved discussions (waiting on @avi-starkware, @meship-starkware, and @Yonatan-Starkware)
crates/blockifier/src/versioned_constants.rs
line 705 at r2 (raw file):
BuiltinName::mul_mod => self.base_gas_costs.mul_mod_gas_cost, BuiltinName::segment_arena => return Err(GasCostsError::VirtualBuiltin), BuiltinName::output | BuiltinName::ecdsa => {
You should have a price for this builtin as well now
Code quote:
BuiltinName::ecdsa
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.
Reviewable status: 0 of 3 files reviewed, 6 unresolved discussions (waiting on @avi-starkware, @meship-starkware, and @Yonatan-Starkware)
crates/blockifier/src/versioned_constants.rs
line 682 at r2 (raw file):
} } }
Please remove this impl. This is only used in the parsing phase, so just do it there
Code quote:
impl BaseGasCosts {
fn get(&self, key: &str) -> u64 {
match key {
"step_gas_cost" => self.step_gas_cost,
"memory_hole_gas_cost" => self.memory_hole_gas_cost,
"range_check_gas_cost" => self.range_check_gas_cost,
"keccak_builtin_gas_cost" => self.keccak_builtin_gas_cost,
"pedersen_gas_cost" => self.pedersen_gas_cost,
"bitwise_builtin_gas_cost" => self.bitwise_builtin_gas_cost,
"ecop_gas_cost" => self.ecop_gas_cost,
"poseidon_gas_cost" => self.poseidon_gas_cost,
"add_mod_gas_cost" => self.add_mod_gas_cost,
"mul_mod_gas_cost" => self.mul_mod_gas_cost,
"default_initial_gas_cost" => self.default_initial_gas_cost,
"entry_point_initial_budget" => self.entry_point_initial_budget,
"syscall_base_gas_cost" => self.syscall_base_gas_cost,
"transaction_gas_cost" => self.transaction_gas_cost,
_ => panic! ("unvalid key"),
}
}
}
2f6b4f1
to
20c662c
Compare
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.
Reviewed 1 of 3 files at r1, 10 of 13 files at r3.
Reviewable status: 10 of 13 files reviewed, 9 unresolved discussions (waiting on @avi-starkware, @Yonatan-Starkware, and @Yoni-Starkware)
crates/blockifier/src/versioned_constants.rs
line 705 at r2 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
You should have a price for this builtin as well now
The price should be 10561; it is not part of the VC for now. Should we add a PR like the keccak one to it?
crates/blockifier/resources/versioned_constants_0_13_4.json
line 98 at r2 (raw file):
"poseidon_gas_cost": 491, "add_mod_gas_cost": 230, "mul_mod_gas_cost": 604,
It does not have to be on this PR, but please extract the builtins to a sub-category as well
Suggestion:
Builtins_l2_gas_cost: {
"range_check": 70,
"keccak_builtin": 136189,
"pedersen": 4050,
"bitwise_builtin": 583,
"ecop": 4085,
"poseidon": 491,
"add_mod": 230,
"mul_mod": 604,
}
crates/blockifier/resources/versioned_constants_0_13_4.json
line 120 at r2 (raw file):
}, "validated": "VALID", "syscalls_gas_costs": {
That would make Tzahi happy
Suggestion:
"syscalls_l2_gas_costs
crates/blockifier/src/versioned_constants_test.rs
line 201 at r2 (raw file):
"step_gas_cost": 3 }, "transaction_gas_cost": {
Can you add one nestes syscall to this test?
e574b59
to
33c6748
Compare
617ea6d
to
ddb025c
Compare
Previously, meship-starkware (Meshi Peled) wrote…
next PR, this one is already big enough |
ddb025c
to
bb04196
Compare
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.
Reviewed 4 of 7 files at r5.
Reviewable status: 11 of 19 files reviewed, 10 unresolved discussions (waiting on @avi-starkware, @meship-starkware, and @Yonatan-Starkware)
crates/blockifier/resources/versioned_constants_0_13_1_1.json
line 651 at r6 (raw file):
] } }
Revert this on all files
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.
Reviewable status: 11 of 19 files reviewed, 9 unresolved discussions (waiting on @avi-starkware, @meship-starkware, and @Yonatan-Starkware)
crates/blockifier/src/versioned_constants.rs
line 705 at r2 (raw file):
Previously, meship-starkware (Meshi Peled) wrote…
The price should be 10561; it is not part of the VC for now. Should we add a PR like the keccak one to it?
Yes
crates/blockifier/src/versioned_constants.rs
line 667 at r6 (raw file):
pub struct GasCosts { pub base_gas_costs: BaseGasCosts, pub syscall_gas_costs: SyscallGasCosts,
Suggestion:
pub base: BaseGasCosts,
pub syscalls: SyscallGasCosts,
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.
Reviewed 1 of 13 files at r3, 7 of 11 files at r4, 6 of 7 files at r5, 1 of 1 files at r6.
Reviewable status: all files reviewed (commit messages unreviewed), 9 unresolved discussions (waiting on @avi-starkware and @Yonatan-Starkware)
bb04196
to
760b8b7
Compare
ad4e1f9
to
a3d5e5a
Compare
18c0d49
to
cafa73f
Compare
a3d5e5a
to
d4e2e1f
Compare
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.
Reviewed 5 of 5 files at r11, 2 of 2 files at r12, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @avi-starkware and @Yonatan-Starkware)
cafa73f
to
8d7c3a5
Compare
d4e2e1f
to
9d8115f
Compare
Previously, Yoni-Starkware (Yoni) wrote…
should the price be 0 in the old jsons? or the above? |
8d7c3a5
to
882df1b
Compare
9d8115f
to
44a4a6f
Compare
44a4a6f
to
82b0083
Compare
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.
Reviewed 1 of 1 files at r13, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @avi-starkware, @Yonatan-Starkware, and @Yoni-Starkware)
82b0083
to
cc35539
Compare
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.
Reviewed 4 of 4 files at r14, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @avi-starkware and @Yonatan-Starkware)
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @avi-starkware)
a4e9622
to
b6948ba
Compare
b6948ba
to
347b59e
Compare
Previously, Yoni-Starkware (Yoni) wrote…
Done. |
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.
Reviewable status: 11 of 21 files reviewed, 1 unresolved discussion (waiting on @avi-starkware, @meship-starkware, and @Yoni-Starkware)
crates/blockifier/src/versioned_constants_test.rs
line 141 at r9 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
Is this necessary?
Done.
crates/blockifier/src/versioned_constants.rs
line 755 at r9 (raw file):
syscalls : syscalls, }; Ok(gas_costs)
Done.
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.
Reviewed 6 of 10 files at r15, 4 of 4 files at r16, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @avi-starkware)
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.
Reviewed 3 of 4 files at r14, 6 of 10 files at r15, 4 of 4 files at r16, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @avi-starkware)
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @avi-starkware)
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.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @avi-starkware)
No description provided.