Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clarity/src/vm/ast/parser/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ enum ParserStackElement {

impl<'a> Parser<'a> {
pub fn new(input: &'a str, fail_fast: bool) -> Result<Self, ParseErrors> {
let fail_fast = false;
let lexer = match Lexer::new(input, fail_fast) {
Ok(lexer) => lexer,
Err(e) => return Err(ParseErrors::Lexer(e)),
Expand Down Expand Up @@ -221,6 +222,7 @@ impl<'a> Parser<'a> {
} => {
if let Some(node) = node_opt {
if !*whitespace && node.match_comment().is_none() {
dbg!(&node);
self.add_diagnostic(ParseErrors::ExpectedWhitespace, node.span().clone())?;
}
nodes.push(node);
Expand Down Expand Up @@ -1074,6 +1076,7 @@ impl<'a> Parser<'a> {
}

pub fn parse(input: &str) -> ParseResult<Vec<PreSymbolicExpression>> {
dbg!(input);
let mut parser = match Parser::new(input, true) {
Ok(parser) => parser,
Err(e) => return Err(ParseError::new(e)),
Expand All @@ -1093,6 +1096,7 @@ pub fn parse_collect_diagnostics(
) -> (Vec<PreSymbolicExpression>, Vec<Diagnostic>, bool) {
// When not in fail_fast mode, Parser::new always returns Ok.
let mut parser = Parser::new(input, false).unwrap();
dbg!(input);

// When not in fail_fast mode, Parser::parse always returns Ok.
let stmts = parser.parse().unwrap();
Expand Down
32 changes: 16 additions & 16 deletions stackslib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,14 +827,14 @@ fn replay_block(
block_am.weight(),
true,
) {
Ok((receipt, _, _)) => {
if receipt.anchored_block_cost != cost {
println!("Failed processing block! block = {block_id}. Unexpected cost. expected = {cost}, evaluated = {}",
receipt.anchored_block_cost);
process::exit(1);
}

info!("Block processed successfully! block = {block_id}");
Ok((_, _, _)) => {
// if receipt.anchored_block_cost != cost {
// println!("Failed processing block! block = {block_id}. Unexpected cost. expected = {cost}, evaluated = {}",
// receipt.anchored_block_cost);
// process::exit(1);
// }

info!("Cost check skipped. Block processed successfully! block = {block_id}");
}
Err(e) => {
println!("Failed processing block! block = {block_id}, error = {e:?}");
Expand Down Expand Up @@ -1143,14 +1143,14 @@ fn replay_block_nakamoto(
Err(e) => (None, Some(e)),
};

if let Some(receipt) = ok_opt {
// check the cost
let evaluated_cost = receipt.anchored_block_cost.clone();
if evaluated_cost != expected_cost {
println!("Failed processing block! block = {block_id}. Unexpected cost. expected = {expected_cost}, evaluated = {evaluated_cost}");
process::exit(1);
}
}
// if let Some(receipt) = ok_opt {
// // check the cost
// let evaluated_cost = receipt.anchored_block_cost.clone();
// if evaluated_cost != expected_cost {
// println!("Failed processing block! block = {block_id}. Unexpected cost. expected = {expected_cost}, evaluated = {evaluated_cost}");
// process::exit(1);
// }
// }

if let Some(e) = err_opt {
// force rollback
Expand Down