starkware-libs / cairo

Cairo is the first Turing-complete language for creating provable programs for general computation.
Apache License 2.0
1.53k stars 474 forks source link

feat: implement `get_block_hash` in the CASM runner #5351

Closed enitrat closed 5 months ago

enitrat commented 5 months ago

Feature Request

Describe the Feature Request

Implement get_block_hash in the CASM runner instead of panicking.

Describe Preferred Solution As per the TODO comment:

perform a storage read. Have an arbitrary, hardcoded (For example, addr=1) contain the mapping from block number to block hash.

Related Code

https://github.com/starkware-libs/cairo/blob/fb1ba328b23623f8ae6cecf7b7a09104c0c4eb2a/crates/cairo-lang-runner/src/casm_run/mod.rs#L839-L850

Additional Context

If the feature request is approved, would you be willing to submit a PR? (Help can be provided if you need assistance submitting a PR)

orizi commented 5 months ago

Is something like the attached PR what you are looking for?

enitrat commented 5 months ago

yes that would be perfect :) thank you!