Commit Graph

7296 Commits

Author SHA1 Message Date
Kamil Śliwak
4e113820c9
Merge pull request #14321 from ethereum/fix-bash-syntax-error-on-expectation-update-in-cli-tests
Fix Bash syntax error that shows up in CLI test output when updating expectations
2023-06-14 16:03:40 +02:00
Kamil Śliwak
e87333f20f More CLI tests for --stop-after parsing 2023-06-14 14:22:38 +02:00
Kamil Śliwak
f8a1af8bd5 CommandLineParser: Fix some outputs not being properly disallowed with --stop-after parsing 2023-06-14 14:22:38 +02:00
Kamil Śliwak
f4217bdc2c Fix Bash syntax error that shows up in CLI tests when updating expectations 2023-06-14 14:22:10 +02:00
Daniel Kirchner
aa01223398 Account for unassigned return variables in stack layout generation. 2023-06-14 11:43:46 +02:00
r0qs
28573dc71b
Workaround open-zeppelin expectRevertCustomError bug 2023-06-14 09:49:38 +02:00
Daniel
53c305ea80
Merge pull request #14310 from ethereum/moreRobustSemanticsTests
Do not let low-level semantic test calls depend on a well-defined contract ABI.
2023-06-12 17:32:21 +02:00
Daniel Kirchner
b7abd9bba4
Deterministically choose memory slots for variables independently of names that may depend on AST IDs. 2023-06-12 17:28:01 +02:00
Kamil Śliwak
b1a773be2f IRGenerator: Leave IR optimization up to the caller to avoid unnecessarily doing it twice 2023-06-07 19:44:40 +02:00
Kamil Śliwak
3aaa207162 Enable unoptimized presets in those external tests where they now pass 2023-06-07 16:45:45 +02:00
Daniel Kirchner
0ea06e1c71 Do not let low-level semantic test calls depend on a well-defined contract ABI. 2023-06-07 13:40:14 +02:00
Kamil Śliwak
5e32a728fe Update test expectations 2023-06-07 12:13:39 +02:00
Kamil Śliwak
25be38905f YulStack: When Yul optimization is not requested, run Yul optimizer with a minimal sequence instead of disabling it 2023-06-07 12:13:38 +02:00
Kamil Śliwak
8e35e8dd8e Command-line tests checking behavior of msize without optimizer 2023-06-07 12:12:00 +02:00
Kamil Śliwak
7ab730d410 Update tests that would become ineffective with minimal optimizations applied 2023-06-07 12:12:00 +02:00
Kamil Śliwak
64ef9d581b Command-line test for equivalence of optimizer options on the CLI and in Standard JSON 2023-06-07 10:29:45 +02:00
Kamil Śliwak
e6716e3208 Helpers for removing decorations form solc output 2023-06-07 10:29:45 +02:00
Kamil Śliwak
c7372f3f22
Merge pull request #14268 from ethereum/resurrect-yul-optimizer-cli-options
Resurrect Yul optimizer CLI options
2023-06-07 10:28:16 +02:00
Nikola Matic
47969adf91 Experimental standard library
Change import syntax and cover with tests
2023-06-06 17:16:23 +02:00
Kamil Śliwak
2769bb52f6 Make --optimize-yul work again 2023-06-06 09:54:07 +02:00
Kamil Śliwak
42a068b449 CommandLineParser: Store the state of EVM assembly and Yul optimizer explicitly
- Does not change the meaning of CLI options, just the way we map them to internal variables.
2023-06-06 09:54:07 +02:00
Pawel Gebal
f15b826431 Add optional bounds to unroll loops in BMC model checker 2023-06-02 18:32:38 +02:00
Kamil Śliwak
f397b9a083 cmdlineTests: Add prefixes for temporary files/dirs 2023-06-02 16:10:40 +02:00
Kamil Śliwak
5c5f8e8dad cmdlineTests: Remove superfluous set and temporary dirs 2023-06-02 16:10:40 +02:00
Kamil Śliwak
00c2f511d3 cmdlineTests: Remove superfluous output from script-based tests and adjust the rest 2023-06-02 16:10:40 +02:00
Kamil Śliwak
c1df8ed563 cmdlineTests: Remove unnecessary subshells
- Whitespace-only change, separated out to make it easy to diff.
2023-06-02 16:10:40 +02:00
Kamil Śliwak
6b061ba696 cmdlineTests: Extract script-based test out of cmdlineTests.sh
- Just extraction, with as few changes to the code as possible.
2023-06-02 16:10:40 +02:00
Kamil Śliwak
dd10334754 cmdlineTests: Support tests that contain a script to run as an alternative to input.* files 2023-06-02 16:09:11 +02:00
Kamil Śliwak
72a384f4fe cmdlineTests: Ensure that leading symbols in names affect the sort order 2023-06-02 16:09:11 +02:00
r0qs
824e59dec2
Remove unnecessary line from OZ external test script 2023-06-02 12:09:53 +02:00
Matheus Aguiar
d657e77f1e Remove problematic sed commands in openzeppelin external test 2023-05-31 02:11:33 -03:00
Leo
a0933fa80a
Merge pull request #14276 from ethereum/smtchecker-fix-ice
SMTChecker: External function call with struct member is not getter
2023-05-30 13:46:35 +02:00
Leo
ceab4dfee5
Merge pull request #14269 from blishko/smtchecker-fix-analysis-external-calls
[SMTChecker] Remember verification targets from trusted external calls
2023-05-30 13:45:37 +02:00
Martin Blicha
8ca453f82e SMTChecker: External function call with struct member is not getter
if a struct has a member that is a function pointer with `external`
attribute, and such a member is called, it is currently incorrectly
treated as a public getter in SMTEncoder.

The proposed fix is to make SMTEncoder::publicGetter more strict in
deciding whether an expression is a public getter.
The added condition, that the access happens on a state variable, is
exactly what is checked later with an assertion that is currently
failing.
2023-05-26 14:23:45 +02:00
Nikola Matić
477b621f2e
Merge pull request #14274 from ethereum/enable-access-to-foreign-events 2023-05-26 13:49:13 +02:00
Martin Blicha
b0419da654 [SMTChecker] Remember verification targets from trusted external calls
Previously, we did not remember trusted external calls for later phase
when we compute possible verification targets for each function.
This led to false negative in cases where verification target can be
violated, but not by calling a public function directly, but only when
it is called as an external function from other function.

The added test cases witnesses this behaviour. The underflow in
`dec` cannot happen in any other way except what the `dec` is called
from `f`.

The same problem did not occur when the functions are called internally,
because for such cases, we have already been remembering these calls in
the callgraph in the CHC engine.
2023-05-26 13:03:44 +02:00
Nikola Matic
5893e099fe Allow qualified access to events from other contracts 2023-05-26 12:52:52 +02:00
GiokaMarkella
28a1abf89a Yul AST output on the CLI and in Standard JSON 2023-05-26 12:35:31 +02:00
Kamil Śliwak
a11b1c83f0 Disallow using both --optimize-yul and --no-optimize-yul at the same time 2023-05-24 15:54:40 +02:00
Kamil Śliwak
b24e4fcbfa Command-line tests for --optimize-yul and --no-optimize-yul used together 2023-05-24 15:53:29 +02:00
Kamil Śliwak
8c5304368d test_via_ir_equivalence(): Simplify by merging the asm loops
- And fix indentation
2023-05-23 15:30:07 +02:00
Kamil Śliwak
bcdb41f743 test_via_ir_equivalence(): Remove unnecessary filter for asm_output_two_stage
- This bit will never actually appear in the output file.
2023-05-23 15:28:18 +02:00
Kamil Śliwak
17aacfdb6a test_via_ir_equivalence(): Fix quoting and locals 2023-05-23 15:25:48 +02:00
Kamil Śliwak
0ce5e4c94d test_via_ir_equivalence(): Use assertions for precondition checks 2023-05-23 15:23:44 +02:00
Nikola Matic
e7f5303a39 Make ASTJSONTest an EVMVersionRestrictedTestCase 2023-05-17 18:10:16 +02:00
Nikola Matic
7a34d34045 Restrict experimental solidity to constantinople and above 2023-05-17 17:03:43 +02:00
r0qs
af74ab69c9
Workaround gp2 and prb-math external tests 2023-05-16 16:13:51 +02:00
Nikola Matic
8a41f4ac7e Introduce solidity-next pragma
Exclude pragma experimental error from ANTLR tests

Test for first pragma after non-pragma declaration

Resolve import pragmas

Change pragma name from next to solidity

Add Changelog entries

Address review comments
2023-05-15 19:25:13 +02:00
Daniel
9804085934
Merge pull request #14216 from ethereum/fix_bmc_side_effects_in_statement
Fix encoding of side-effects inside if and ternary in BMC
2023-05-15 13:34:22 +02:00
Alexander Arlt
c5673278a7 Remove EWASM backend. 2023-05-11 10:56:55 -05:00
Leo Alt
678461e828 Fix encoding of side-effects inside if and conditional statements in the BMC engine 2023-05-11 16:44:09 +02:00
Alexander Arlt
4837d42361 Add experimental support to import AST via Standard JSON. 2023-05-09 14:07:38 -05:00
Daniel Kirchner
75a0c486a8 Adjust gas expectations due to new creation costs. 2023-05-09 18:22:44 +02:00
Daniel Kirchner
53626fc092 Bump docker images and evmone version. 2023-05-09 17:59:00 +02:00
Nikola Matic
9a87b587d5 Disallow immutable initialization in try catch statements
Trigger github
2023-05-09 14:48:14 +02:00
Daniel Kirchner
44da8507b1 Change default EVM version to Shanghai.
Co-authored-by: Rodrigo Q. Saramago <rodrigoqsaramago@gmail.com>
2023-05-08 16:34:23 +02:00
Rodrigo Q. Saramago
a29f77369a
Move AST annotation of internal function dispatch IDs to ContractDefinition
Co-authored-by: Daniel <daniel@ekpyron.org>
Co-authored-by: Nikola Matić <nikola.matic@ethereum.org>
2023-05-06 20:31:27 +02:00
Nikola Matić
41742c5410
Merge pull request #14188 from ethereum/fuzz-ir-pipeline
Make use of IR codegen pipeline and selectively report stack too deep…
2023-05-06 13:04:13 +02:00
Rodrigo Q. Saramago
766db7daa4
Update gp2 external test script 2023-05-05 17:09:58 +02:00
Bhargava Shastry
889f0721a2 Make use of IR codegen pipeline and selectively report stack too deep errors for the new pipeline. 2023-05-05 11:39:56 +02:00
chriseth
1e63615206 Export all events.
Update tests.

Additional tests

Revert changes to the Natspec
2023-05-03 14:08:27 -03:00
Rodrigo Q. Saramago
75960e6db8
Fix throw of ExternalTestNotFound in external_tests.py 2023-04-28 18:28:07 +02:00
Rodrigo Q. Saramago
28a959295b
Move common.sh from test/externalTests to scripts/externalTests 2023-04-28 16:32:01 +02:00
Rodrigo Q. Saramago
778d6f4b26
Migrate externalTests.sh to python
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
2023-04-28 16:31:49 +02:00
Rodrigo Q. Saramago
28c7fdae09
Migrate yulStackShuffling tests to isoltest 2023-04-25 15:53:01 +02:00
Leo
4a8d6618f5
Merge pull request #13974 from blishko/chc-path-condition
[SMTChecker] Use path condition in CHC engine
2023-04-24 16:24:53 +02:00
Daniel
cd5ae26e34
Merge pull request #14143 from ethereum/remove-type-categoryname
Remove the inaccurate `Type::categoryName()`
2023-04-23 22:05:35 +02:00
Alex Beregszaszi
ee92491aae Upgrade to evmc 10.1.0 2023-04-23 15:51:06 +02:00
Martin Blicha
12bca24774 [SMTChecker] Use path condition when creating CHC targets
Without path condition, verification targets created inside ternary
operator ignore the condition of the operator inside the branches.
This led to false positives.

Further updates:

- Function calls should consider the conditions under which they are
called, otherwise the analysis may report false positives.
The fix proposed here is to add the current path condition to the edge
that propagates error from a function call.

- Increment error index after function call

This is necessary for the analysis of the ternary operator to work
correctly. No information should leak from a function call inside a
ternary operator in the first branch to the second branch, including
whether or not an error would have occured in the first branch.

However, for the execution that continues after the function call,
we still need to ensure that under the current path condition
the error has not occurred in that function call.

It would be better to isolate the analysis of the branches to separate
clauses, but I do not see an easy way for that now. In this way, even
though the function call in first branch is included in the clause of
the second branch, no information leaks.

- Additonal test for ternary operator

This tests the behaviour of SMTChecker on ternary operator with function
calls inside both branches. Specifically, it tests that SMTChecker
successfully detects a violation of a verification target in the second
branch when the same target is present also in the first branch, but
there it cannot be triggered because of the operator's condition.
2023-04-21 18:56:34 +02:00
Kamil Śliwak
34da6c8811 Remove the inaccurate Type::categoryName() and change the error message for invalid calls to one independent of the category 2023-04-20 13:50:22 +02:00
Rodrigo Q. Saramago
524db30f12
Update ubuntu ossfuzz references 2023-04-19 00:18:11 +02:00
Daniel
a77d4e281f
Merge pull request #14139 from ethereum/make-plus-binary-only
Make plus binary only (second attempt)
2023-04-18 21:20:31 +02:00
Matheus Aguiar
64f57ac3c7 Fix null dereference in using for directive when operator name is empty 2023-04-18 14:23:58 -03:00
Kamil Śliwak
8a14680851 Disallow unary plus at the parsing stage 2023-04-18 16:47:00 +02:00
Nikola Matić
8194acb3b7
Merge pull request #14119 from veniger/natspec-struct
Adds NatSpec to AST for struct definitions.
2023-04-18 16:05:20 +02:00
Marko Veniger
07def48f45 Adds NatSpec to AST for struct definitions. 2023-04-18 13:10:21 +02:00
Daniel Kirchner
421738b50d Fix calldata handling during creation in EVMHost. 2023-04-18 12:53:50 +02:00
Daniel
c6aab84a0c
Merge pull request #14127 from ethereum/eip-3860
Add warning for EIP-3860 enforced initcode limits
2023-04-17 17:42:55 +02:00
Daniel
6d847e4e57
Merge pull request #14126 from ethereum/warm-coinbase
EVMHost: Support warm coinbase
2023-04-17 14:55:59 +02:00
Alex Beregszaszi
71bea997aa Add and update tests 2023-04-15 13:47:11 +02:00
Alex Beregszaszi
4264b5ae07 EVMHost: Support warm coinbase 2023-04-15 13:19:08 +02:00
Alex Beregszaszi
d478c7d81a EVMHost: Add "support" for Blake2f 2023-04-15 13:17:02 +02:00
Kamil Śliwak
593e207094
Merge pull request #14104 from ethereum/extract-parse-literal
Refactor literal parsing before adding suffixes
2023-04-12 14:52:04 +02:00
Daniel
6bc6ae94a6
Merge pull request #14050 from ethereum/contract-ast-internal-function-ids
Annotate internal function IDs
2023-04-12 14:11:39 +02:00
Kamil Śliwak
c1fffa892d Parser: Extract literal parsing into a separate function 2023-04-12 12:30:05 +02:00
Kamil Śliwak
46457cfc25
Merge pull request #14103 from ethereum/extra-tests
A few extra tests for operators, denominations and virtual functions
2023-04-12 11:32:26 +02:00
hrkrshnn
41ce3feb0a test: some tests for push0
1. `push0_disallowed.yul`: checks if `push0()` is a valid builtin in strict Yul
2. `push0_disallowed.sol`: checks if `push0()` is a valid builtin in inline assembly
3. `push0.sol`: simple semantic test that returns 0
4. `evmone_support.sol`: tests if push0 works properly in evmone
5. Updated some bytecode too large tests to use `shanghai` as version
6. Updated various tests where `push1 0` was hardcoded in different forms / expectations on bytecode
size (`Assembler.cpp`, `GasCosts.cpp`, `SolidityCompiler.cpp`, `SolidityExpressionCompiler.cpp`)
2023-04-12 00:10:24 +02:00
Kamil Śliwak
66fcd542bc Tests for denominations in array sizes 2023-04-07 14:54:09 +02:00
Kamil Śliwak
fc7cd54849 Tests for changing virtual function mutability when overriding 2023-04-07 14:49:55 +02:00
Kamil Śliwak
5687f6e934 Tests for literal denominations with non-integer literals 2023-04-07 14:48:13 +02:00
Kamil Śliwak
8dd6f77692 Extra test for operator cleanup 2023-04-07 14:47:34 +02:00
Kamil Śliwak
e29a68d374
Merge pull request #14098 from ethereum/workaround-oz-ext-test-2
Skip `TransparentUpgradeableProxy` openzeppelin external tests due to partial viaIR support in Hardhat
2023-04-06 15:53:33 +02:00
Kamil Śliwak
a902c09cb7
Merge pull request #14086 from ethereum/gnosis-ext-workaround
Skip via-ir with yul optimizer for Gnosis external tests
2023-04-06 15:52:15 +02:00
Rodrigo Q. Saramago
f404eb0349
More openzeppelin workarounds 2023-04-06 13:23:36 +02:00
Rodrigo Q. Saramago
33b07c5dc6
Skip via-ir with yul optimizer for Gnosis external tests 2023-04-05 21:27:31 +02:00
Kamil Śliwak
9020efec58
Merge pull request #14087 from ethereum/better-error-for-invalid-call
Better error message when trying to call things that are not functions
2023-04-05 17:38:10 +02:00
Christian Parpart
be8752b5d3 Adds natspec to AST for enum definition. 2023-04-05 14:58:32 +02:00
Kamil Śliwak
a019f400d0 Better error message when trying to call things that are not functions 2023-04-04 17:30:37 +02:00
Kamil Śliwak
79d975a77d
Merge pull request #14078 from ethereum/fix_missing_keyword_unicode
Fix missing keyword `unicode` in grammar
2023-04-03 12:53:20 +02:00
Matheus Aguiar
4aa310034c Added missing keyword unicode to Lexer 2023-03-28 13:51:43 -03:00