Commit e4c43d6
fix(tests) fix ported quadratic complexity tests (#2784)
* fix(tests): correct stQuadraticComplexityTest post-state expectations
Three of these tests embed the runtime caller address directly in
their target contract's bytecode. The expected post hashed in a
literal hex string of the bytecode that hardcoded the pre-dynamic
EOA address (e.g. \`0xd9b97c712eb…\`), so once \`pre.fund_eoa()\`
started picking addresses dynamically the deployed code no longer
matched the expected hex. Hoist the bytecode into a \`target_code\`
variable used both at deploy time and as the expected \`code\`, so
the address baked in via \`Op.CALL(address=addr, …)\` is whatever
\`addr\` resolves to at fill time:
- \`test_call50000\`
- \`test_callcode50000\`
- \`test_call20_kbytes_contract50_2\`
\`test_quadratic_complexity_solidity_call_data_copy\` had a
different drift: its post asserted empty storage on \`contract_0\`,
but the success path (\`g=1\`, 250M gas) commits \`SSTORE(0, 50000)\`
before entering the loop. Make the expected storage \`g\`-conditional
so \`g=0\` (OOG) keeps an empty \`storage\` and \`g=1\` records slot 0.
* chore(tests): remove unrequired `# noqa: F841`
* chore(ported_static): mark stQuadraticComplexityTest fixes as @manually-enhanced
The four post-state corrections cherry-picked from PR #2784 should not be
overwritten the next time `tests/ported_static/` is regenerated by
`scripts/filler_to_python`. Add the `@manually-enhanced` marker to each
docstring so the regenerator skips them.
---------
Co-authored-by: Leo Lara <leo@leolara.me>1 parent 8a052aa commit e4c43d6
4 files changed
Lines changed: 44 additions & 28 deletions
File tree
- tests/ported_static/stQuadraticComplexityTest
Lines changed: 11 additions & 7 deletions
Large diffs are not rendered by default.
Lines changed: 12 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
73 | | - | |
| 76 | + | |
74 | 77 | | |
75 | 78 | | |
76 | | - | |
77 | | - | |
| 79 | + | |
| 80 | + | |
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
| |||
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
97 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
98 | 104 | | |
99 | 105 | | |
100 | 106 | | |
| |||
108 | 114 | | |
109 | 115 | | |
110 | 116 | | |
111 | | - | |
112 | | - | |
113 | | - | |
| 117 | + | |
114 | 118 | | |
115 | 119 | | |
116 | 120 | | |
| |||
123 | 127 | | |
124 | 128 | | |
125 | 129 | | |
126 | | - | |
127 | | - | |
128 | | - | |
| 130 | + | |
129 | 131 | | |
130 | 132 | | |
131 | 133 | | |
| |||
Lines changed: 12 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
73 | | - | |
| 76 | + | |
74 | 77 | | |
75 | 78 | | |
76 | | - | |
77 | | - | |
| 79 | + | |
| 80 | + | |
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
| |||
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
97 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
98 | 104 | | |
99 | 105 | | |
100 | 106 | | |
| |||
108 | 114 | | |
109 | 115 | | |
110 | 116 | | |
111 | | - | |
112 | | - | |
113 | | - | |
| 117 | + | |
114 | 118 | | |
115 | 119 | | |
116 | 120 | | |
| |||
123 | 127 | | |
124 | 128 | | |
125 | 129 | | |
126 | | - | |
127 | | - | |
128 | | - | |
| 130 | + | |
129 | 131 | | |
130 | 132 | | |
131 | 133 | | |
| |||
tests/ported_static/stQuadraticComplexityTest/test_quadratic_complexity_solidity_call_data_copy.py
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
152 | 155 | | |
153 | 156 | | |
154 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
155 | 163 | | |
156 | 164 | | |
157 | | - | |
| 165 | + | |
158 | 166 | | |
159 | 167 | | |
160 | 168 | | |
| |||
0 commit comments