Skip to content

Commit

Permalink
tx fmt, remove os output to new branch
Browse files Browse the repository at this point in the history
  • Loading branch information
drspacemn committed Oct 23, 2023
1 parent 3f6d2e4 commit 6470c5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 87 deletions.
87 changes: 5 additions & 82 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use cairo_vm::vm::runners::cairo_runner::CairoRunner;
use cairo_vm::vm::vm_core::VirtualMachine;
use config::StarknetGeneralConfig;
use error::SnOsError;
use num_traits::Num;
use state::SharedState;

use crate::io::StarknetOsOutput;
Expand Down Expand Up @@ -80,10 +79,12 @@ impl SnOsRunner {
cairo_runner
.run_until_pc(end, &mut vm, &mut sn_hint_processor)
.map_err(|err| VmException::from_vm_error(&cairo_runner, &vm, err))
.map_err(|e| SnOsError::Runner(e.into()));
.map_err(|e| SnOsError::Runner(e.into()))?;

// End the Cairo VM run
cairo_runner
.end_run(cairo_run_config.disable_trace_padding, false, &mut vm, &mut sn_hint_processor)
.map_err(|e| SnOsError::Runner(e.into()));
.map_err(|e| SnOsError::Runner(e.into()))?;

if cairo_run_config.proof_mode {
cairo_runner.finalize_segments(&mut vm).map_err(|e| SnOsError::Runner(e.into()))?;
Expand Down Expand Up @@ -119,85 +120,7 @@ impl SnOsRunner {
}
})
.collect();
let os_output = vec![
Felt252::from_str_radix("5", 10).unwrap(),
Felt252::from_str_radix("200681068043714771978294967736222413892373265451181245269365696587346998380", 10)
.unwrap(),
Felt252::from_str_radix("5", 10).unwrap(),
Felt252::from_str_radix("2", 10).unwrap(),
Felt252::from_str_radix("2", 10).unwrap(),
Felt252::from_str_radix("4", 10).unwrap(),
Felt252::from_str_radix("6", 10).unwrap(),
Felt252::from_str_radix("5", 10).unwrap(),
Felt252::from_str_radix("100516143779279430775707828199600578312537898796928552917232883557759234322", 10)
.unwrap(),
Felt252::from_str_radix("0", 10).unwrap(),
Felt252::from_str_radix("35204018158445673560851558076088854146605956506855338357946372855484348775", 10)
.unwrap(),
Felt252::from_str_radix("1", 10).unwrap(),
Felt252::from_str_radix("2", 10).unwrap(),
Felt252::from_str_radix("5", 10).unwrap(),
Felt252::from_str_radix("100516143779279430775707828199600578312537898796928552917232883557759234322", 10)
.unwrap(),
Felt252::from_str_radix("34028236692093846346337460743176821142", 10).unwrap(),
Felt252::from_str_radix("69269496341425719426402089224874584819743134075306502400687571826086987209", 10)
.unwrap(),
Felt252::from_str_radix("13", 10).unwrap(),
Felt252::from_str_radix("46", 10).unwrap(),
Felt252::from_str_radix("30", 10).unwrap(),
Felt252::from_str_radix("221543030371090279154099648482303080997145207855149800960303587058346405278", 10)
.unwrap(),
Felt252::from_str_radix("31", 10).unwrap(),
Felt252::from_str_radix("153672706898142968531", 10).unwrap(),
Felt252::from_str_radix("32", 10).unwrap(),
Felt252::from_str_radix("9", 10).unwrap(),
Felt252::from_str_radix("81567992657121201822719584870756232234855806740606093104123927385410749460", 10)
.unwrap(),
Felt252::from_str_radix("2", 10).unwrap(),
Felt252::from_str_radix("131641924399560670288987069486918367964567650624282359632691221293624835245", 10)
.unwrap(),
Felt252::from_str_radix("326212205117017662403990886779887590398051155242173007037667265340317986446", 10)
.unwrap(),
Felt252::from_str_radix("200681068043714771978294967736222413892373265451181245269365696587346998380", 10)
.unwrap(),
Felt252::from_str_radix("34028236692093846346337460743176821141", 10).unwrap(),
Felt252::from_str_radix("208452472809998532760646017254057231099592366165685967544992326891398085023", 10)
.unwrap(),
Felt252::from_str_radix("5", 10).unwrap(),
Felt252::from_str_radix("7", 10).unwrap(),
Felt252::from_str_radix("31", 10).unwrap(),
Felt252::from_str_radix("53", 10).unwrap(),
Felt252::from_str_radix("44", 10).unwrap(),
Felt252::from_str_radix("66", 10).unwrap(),
Felt252::from_str_radix("171542524625682182385553640995899254084645198956708755167645702779965225616", 10)
.unwrap(),
Felt252::from_str_radix("10", 10).unwrap(),
Felt252::from_str_radix("171542524625682182385553640995899254084645198956708755167645702779965225617", 10)
.unwrap(),
Felt252::from_str_radix("20", 10).unwrap(),
Felt252::from_str_radix("222163306951389421296717391987130197751942633868181938423174889893366401376", 10)
.unwrap(),
Felt252::from_str_radix("34028236692093846346337460743176821140", 10).unwrap(),
Felt252::from_str_radix("326212205117017662403990886779887590398051155242173007037667265340317986446", 10)
.unwrap(),
Felt252::from_str_radix("5", 10).unwrap(),
Felt252::from_str_radix("1", 10).unwrap(),
Felt252::from_str_radix("11", 10).unwrap(),
Felt252::from_str_radix("97", 10).unwrap(),
Felt252::from_str_radix("55", 10).unwrap(),
Felt252::from_str_radix("88", 10).unwrap(),
Felt252::from_str_radix("66", 10).unwrap(),
Felt252::from_str_radix("99", 10).unwrap(),
Felt252::from_str_radix("261876760381503837851236634655062773110976680464358301683405235391247340282", 10)
.unwrap(),
Felt252::from_str_radix("44272185776902923874", 10).unwrap(),
Felt252::from_str_radix("330209860549393888721793468867835607193970854666866966631900875791400281196", 10)
.unwrap(),
Felt252::from_str_radix("34028236692093846346337460743176821146", 10).unwrap(),
Felt252::from_str_radix("326212205117017662403990886779887590398051155242173007037667265340317986446", 10)
.unwrap(),
Felt252::from(0),
];

let prev_state_root = os_output[0].clone();
let new_state_root = os_output[1].clone();
let block_number = os_output[2].clone();
Expand Down
6 changes: 1 addition & 5 deletions tests/common/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ pub fn deprecated_cairo_python_run(program: &str, with_input: bool) -> String {
let mut raw = String::from_utf8(cmd_out.stdout).unwrap();
raw.push_str(&String::from_utf8(cmd_out.stderr).unwrap());

raw.trim_start_matches("Program output:")
.trim_start_matches("\n ")
.trim_end_matches("\n\n")
.replace(' ', "")
.to_string()
raw.trim_start_matches("Program output:").trim_start_matches("\n ").trim_end_matches("\n\n").replace(' ', "")
}

pub fn raw_deploy(
Expand Down

0 comments on commit 6470c5c

Please sign in to comment.