Open cicr99 opened 1 month ago
To start off, I found some new builtins in Cairo one.
We will also have to add support for sierra in the VM. The cairo one runner's struct have these extra variables :
/// The sierra program.
sierra_program: cairo_lang_sierra::program::Program,
/// Metadata for the Sierra program.
metadata: Metadata,
/// Program registry for the Sierra program.
sierra_program_registry: ProgramRegistry<CoreType, CoreLibfunc>,
/// Program registry for the Sierra program.
type_sizes: TypeSizeMap,
/// The casm program matching the Sierra code.
casm_program: CairoProgram,
/// Mapping from class_hash to contract info.
starknet_contracts_info: OrderedHashMap<Felt252, ContractInfo>,
In the runner, we will have to introduce some new functions :
header
and followed by footer
.build_hints_dict
function which register hint with string for the hint processor. Its struct is : pub struct CairoHintProcessor<'a> {
/// The Cairo runner.
pub runner: Option<&'a SierraCasmRunner>,
/// A mapping from a string that represents a hint to the hint object.
pub string_to_hint: HashMap<String, Hint>,
/// The starknet state.
pub starknet_state: StarknetState,
/// Maintains the resources of the run.
pub run_resources: RunResources,
/// Resources used during syscalls - does not include resources used during the current VM run.
/// At the end of the run - adding both would result in the actual expected resource usage.
pub syscalls_used_resources: StarknetExecutionResources,
}
available_gas
before the execution begins.Most of the code for the VM can be reused. There are a few changes required :
Will return an error if any of the following conditions are not met:
- Source address's segment must be negative (temporary).
- Source address's offset must be zero.
- There shouldn't already be relocation at the source segment.
There should be a few differences between cairo zero runner and the one for cairo 1. These will dictate whether we can reuse some of our current code. There are two important things we need to check:
run_function_with_starknet_context
here which is called from here.Write a comment in this issue outlining all the info you gather about each of this, so we can then create specific tasks to work on.