Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
odesenfans committed Apr 12, 2024
1 parent 49c5c0b commit 94af2ba
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/hints/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,21 +479,27 @@ mod tests {
let mut vm = VirtualMachine::new(false);
vm.add_memory_segment();
vm.add_memory_segment();
vm.set_fp(3);
vm.set_fp(4);

let ap_tracking = ApTracking::new();
let constants = HashMap::new();

let ids_data = HashMap::from([
(vars::ids::INITIAL_ROOT.to_string(), HintReference::new_simple(-3)),
(vars::ids::FINAL_ROOT.to_string(), HintReference::new_simple(-2)),
(vars::ids::MERKLE_HEIGHT.to_string(), HintReference::new_simple(-1)),
(vars::ids::INITIAL_ROOT.to_string(), HintReference::new_simple(-4)),
(vars::ids::FINAL_ROOT.to_string(), HintReference::new_simple(-3)),
(vars::ids::MERKLE_HEIGHT.to_string(), HintReference::new_simple(-2)),
(vars::ids::CONTRACT_ADDRESS.to_string(), HintReference::new_simple(-1)),
]);
insert_value_from_var_name(vars::ids::MERKLE_HEIGHT, 251_usize, &mut vm, &ids_data, &ap_tracking)
.expect("Couldn't insert 252 into ids.MERKLE_HEIGHT");
let contract_address = Felt252::ONE;
insert_value_from_var_name(vars::ids::CONTRACT_ADDRESS, contract_address, &mut vm, &ids_data, &ap_tracking)
.unwrap();

let commitment_info_by_address = HashMap::from([(contract_address, os_input.contract_state_commitment_info)]);

let mut exec_scopes: ExecutionScopes = Default::default();
exec_scopes.insert_value(vars::scopes::COMMITMENT_INFO, os_input.contract_state_commitment_info);
exec_scopes.insert_value(vars::scopes::COMMITMENT_INFO_BY_ADDRESS, commitment_info_by_address);

set_preimage_for_current_commitment_info(&mut vm, &mut exec_scopes, &ids_data, &ap_tracking, &constants)
.unwrap();
Expand Down

0 comments on commit 94af2ba

Please sign in to comment.