Skip to content

Commit

Permalink
chore(blockifier): add gas cost to bultin price array
Browse files Browse the repository at this point in the history
  • Loading branch information
meship-starkware committed Aug 19, 2024
1 parent b6955bb commit 7e3d2d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions crates/blockifier/src/execution/entry_point_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,19 @@ fn prepare_program_extra_data(
read_only_segments: &mut ReadOnlySegments,
) -> Result<usize, PreExecutionError> {
// Create the builtin cost segment, with dummy values.
let mut data = vec![];

// TODO(spapini): Put real costs here.
for _i in 0..20 {
data.push(MaybeRelocatable::from(0));
}
let data = vec![
MaybeRelocatable::from(4130), // Pesetsen
MaybeRelocatable::from(594), // Bitwise
MaybeRelocatable::from(4166), // EcOp
MaybeRelocatable::from(500), // Posidon
MaybeRelocatable::from(234), // AddMod
MaybeRelocatable::from(616), // MulMod
];

// // TODO(spapini): Put real costs here.
// for _i in 0..20 {
// data.push(MaybeRelocatable::from(0));
// }
let builtin_cost_segment_start = read_only_segments.allocate(&mut runner.vm, &data)?;

// Put a pointer to the builtin cost segment at the end of the program (after the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::test_utils::contracts::FeatureContract;
use crate::test_utils::initial_test_state::test_state;
use crate::test_utils::{trivial_external_entry_point_new, CairoVersion, BALANCE};

#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 17032670; "VM")]
#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 17051678; "VM")]
fn test_secp256k1(test_contract: FeatureContract, expected_gas: u64) {
let chain_info = &ChainInfo::create_for_testing();
let mut state = test_state(chain_info, BALANCE, &[(test_contract, 1)]);
Expand Down

0 comments on commit 7e3d2d5

Please sign in to comment.