Skip to content

Commit

Permalink
Add output_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementWalter committed Sep 13, 2024
1 parent afca712 commit 51732da
Show file tree
Hide file tree
Showing 2 changed files with 355 additions and 6 deletions.
16 changes: 15 additions & 1 deletion cairo_programs/get_env.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
%builtins output

// Represents an integer in the range [0, 2^256).
struct Uint256 {
// The low 128 bits of the value.
Expand Down Expand Up @@ -38,7 +40,7 @@ func get_env() -> Environment* {
return env;
}

func main() {
func main{output_ptr: felt*}() {
let env = get_env();
%{
print(f"{ids.origin=}")
Expand All @@ -52,5 +54,17 @@ func main() {
print(f"{ids.base_fee=}")
%}

tempvar output_ptr = cast(nondet %{ segments.add() %}, felt*);
assert [output_ptr] = env.origin;
assert [output_ptr + 1] = env.gas_price;
assert [output_ptr + 2] = env.chain_id;
assert [output_ptr + 3] = env.prev_randao.low;
assert [output_ptr + 4] = env.prev_randao.high;
assert [output_ptr + 5] = env.block_number;
assert [output_ptr + 6] = env.block_gas_limit;
assert [output_ptr + 7] = env.block_timestamp;
assert [output_ptr + 8] = env.coinbase;
assert [output_ptr + 9] = env.base_fee;

return ();
}
Loading

0 comments on commit 51732da

Please sign in to comment.