diff --git a/Scarb.toml b/Scarb.toml index afb00256..3902ba61 100644 --- a/Scarb.toml +++ b/Scarb.toml @@ -11,5 +11,8 @@ license-file = "LICENSE" [workspace.dependencies] cairo_test = "2.8.0" - shinigami_engine = { git = "https://github.com/keep-starknet-strange/shinigami.git", rev = "9e7692d" } + +[cairo] +# https://github.com/lambdaclass/cairo-vm/issues/1745 +enable-gas = false \ No newline at end of file diff --git a/packages/client/src/lib.cairo b/packages/client/src/lib.cairo index c1bd37d3..58572291 100644 --- a/packages/client/src/lib.cairo +++ b/packages/client/src/lib.cairo @@ -1,4 +1 @@ -mod main; -// TODO: scarb cairo-run should support "features" argument -// so that we can conditionally compile this module mod test; diff --git a/packages/client/src/main.cairo b/packages/client/src/main.cairo deleted file mode 100644 index d694be71..00000000 --- a/packages/client/src/main.cairo +++ /dev/null @@ -1,33 +0,0 @@ -use consensus::types::block::Block; -use consensus::types::chain_state::{ChainState, BlockValidator}; -use consensus::types::utxo_set::UtxoSet; - -/// Raito program arguments. -#[derive(Serde)] -struct Args { - /// Current (initial) chain state - chain_state: ChainState, - /// Batch of blocks that have to be applied to the current chain state - blocks: Array, -} - -/// Raito program entrypoint. -/// -/// Receives current state (chain state + utreexo state) and pending blocks, -/// then validates and applies them one by one. -/// Returns new state in case of success, otherwise raises an error. -fn main(mut arguments: Span) -> ChainState { - let Args { mut chain_state, blocks, } = Serde::deserialize(ref arguments) - .expect('Failed to deserialize'); - - let mut utxo_set: UtxoSet = Default::default(); - - // Validate and apply block, accumulating UTXO updates in utxo_set - for block in blocks { - chain_state = chain_state - .validate_and_apply(block, ref utxo_set, false) - .expect('Block validation failed'); - }; - - chain_state -} diff --git a/packages/client/src/test.cairo b/packages/client/src/test.cairo index 7fef9f2a..d7b547bc 100644 --- a/packages/client/src/test.cairo +++ b/packages/client/src/test.cairo @@ -35,7 +35,7 @@ struct UtreexoArgs { /// Receives arguments in a serialized format (Cairo serde). /// Panics in case of a validation error or chain state mismatch. /// Prints result to the stdout. -fn test(mut arguments: Span, execute_script: bool) { +fn main(mut arguments: Span, execute_script: bool) { let Args { mut chain_state, blocks, expected_chain_state, utreexo_args } = Serde::deserialize( ref arguments )