Skip to content

Commit

Permalink
hacking
Browse files Browse the repository at this point in the history
  • Loading branch information
g-r-a-n-t committed Jun 28, 2022
1 parent 79ebb1f commit 5e7ca62
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 15 deletions.
8 changes: 4 additions & 4 deletions crates/analyzer/tests/snapshots/analysis__return_array.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ note:
┌─ return_array.fe:2:5
2 │ ╭ pub fn bar(x: u256) -> Array<u256, 5> {
3 │ │ let my_array: Array<u256, 5> = [8; 5]
3 │ │ let my_array: Array<u256, 5> = [0; 5]
4 │ │ my_array[3] = x
5 │ │ return my_array
6 │ │ }
Expand Down Expand Up @@ -46,21 +46,21 @@ note:
note:
┌─ return_array.fe:3:13
3let my_array: Array<u256, 5> = [8; 5]
3let my_array: Array<u256, 5> = [0; 5]
^^^^^^^^ Array<u256, 5>

note:
┌─ return_array.fe:3:41
3let my_array: Array<u256, 5> = [8; 5]
3let my_array: Array<u256, 5> = [0; 5]
^ ^ u256: Value
│ │
u256: Value

note:
┌─ return_array.fe:3:40
3let my_array: Array<u256, 5> = [8; 5]
3let my_array: Array<u256, 5> = [0; 5]
^^^^^^ Array<u256, 5>: Memory
4my_array[3] = x
^^^^^^^^ ^ u256: Value
Expand Down
2 changes: 1 addition & 1 deletion crates/test-files/fixtures/features/return_array.fe
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
contract Foo {
pub fn bar(x: u256) -> Array<u256, 5> {
let my_array: Array<u256, 5> = [8; 5]
let my_array: Array<u256, 5> = [0; 5]
my_array[3] = x
return my_array
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: crates/tests/src/features.rs
expression: "format!(\"{}\", harness.gas_reporter)"

---
bar([]) used 143 gas
bar([]) used 2323 gas

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: crates/tests/src/features.rs
expression: "format!(\"{}\", harness.gas_reporter)"

---
bar([]) used 1020 gas
bar([]) used 1074 gas

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: crates/tests/src/features.rs
expression: "format!(\"{}\", harness.gas_reporter)"

---
bar([]) used 759 gas
bar([]) used 813 gas

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: crates/tests/src/features.rs
expression: "format!(\"{}\", harness.gas_reporter)"

---
bar([]) used 1658 gas
bar([]) used 1745 gas

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: crates/tests/src/features.rs
expression: "format!(\"{}\", harness.gas_reporter)"

---
add_from_mem([Uint(2), Uint(5)]) used 643 gas
add_from_mem([Uint(2), Uint(5)]) used 819 gas

Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
source: crates/tests/src/features.rs
expression: "format!(\"{}\", harness.gas_reporter)"

---
emit_nums([]) used 1600 gas
emit_bases([Address(0x1234000000000000000000000000000000005678)]) used 1676 gas
emit_mix([Address(0x1234000000000000000000000000000000005678), Bytes([116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46])]) used 4833 gas
emit_addresses([Address(0x1234000000000000000000000000000000005678), Address(0x9123000000000000000000000000000000004567)]) used 2344 gas
emit_addresses([Address(0x1234000000000000000000000000000000005678), Address(0x9123000000000000000000000000000000004567)]) used 2339 gas

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
source: crates/tests/src/features.rs
expression: "format!(\"{}\", proxy_harness.gas_reporter)"

---
call_emit_event([Address(0x5dddfce53ee040d9eb21afbc0ae1bb4dbb0ba643), Uint(26), FixedArray([Address(0x0000000000000000000000000000000000000000), Address(0x0000000000000000000000000000000000000001), Address(0x0000000000000000000000000000000000000042), Address(0x0000000000000000000000000000000000000003), Address(0x0000000000000000000000000000000000000004)]), String("hello world")]) used 8195 gas
call_build_array([Address(0x5dddfce53ee040d9eb21afbc0ae1bb4dbb0ba643), Uint(26), Uint(42)]) used 1945 gas
call_build_array([Address(0x5dddfce53ee040d9eb21afbc0ae1bb4dbb0ba643), Uint(26), Uint(42)]) used 1978 gas

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: crates/tests/src/features.rs
expression: "format!(\"{}\", harness.gas_reporter)"

---
bar([Uint(4), Uint(42), Uint(420)]) used 579 gas
bar([Uint(4), Uint(42), Uint(420)]) used 596 gas

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: crates/tests/src/features.rs
expression: "format!(\"{}\", harness.gas_reporter)"

---
bar([Uint(42)]) used 727 gas
bar([Uint(42)]) used 796 gas

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: crates/tests/src/stress.rs
expression: "format!(\"{}\", harness.gas_reporter)"

---
set_my_vals([String("my string"), String("my other string"), Uint(26), Uint(42)]) used 138325 gas
emit_my_event([]) used 3694 gas
Expand All @@ -10,7 +11,7 @@ mutate_and_return([FixedArray([Uint(1), Uint(2), Uint(3), Uint(4), Uint(5), Uint
multiple_references_shared_memory([FixedArray([Uint(1), Uint(2), Uint(3), Uint(4), Uint(5), Uint(6), Uint(7), Uint(8), Uint(9), Uint(10)])]) used 680 gas
clone_and_return([FixedArray([Uint(1), Uint(2), Uint(3), Uint(4), Uint(5), Uint(6), Uint(7), Uint(8), Uint(9), Uint(10)])]) used 2494 gas
clone_mutate_and_return([FixedArray([Uint(1), Uint(2), Uint(3), Uint(4), Uint(5), Uint(6), Uint(7), Uint(8), Uint(9), Uint(10)])]) used 2528 gas
assign_my_nums_and_return([]) used 92449 gas
assign_my_nums_and_return([]) used 92544 gas
set_my_addrs([FixedArray([Address(0x0000000000000000000000000000000000000000), Address(0x0000000000000000000000000000000000000001), Address(0x0000000000000000000000000000000000000002)])]) used 47327 gas
get_my_second_addr([]) used 468 gas

0 comments on commit 5e7ca62

Please sign in to comment.