Commit Graph

5213 Commits

Author SHA1 Message Date
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
Nikola Matic
47969adf91 Experimental standard library
Change import syntax and cover with tests
2023-06-06 17:16:23 +02:00
Pawel Gebal
f15b826431 Add optional bounds to unroll loops in BMC model checker 2023-06-02 18:32:38 +02: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
Nikola Matic
7a34d34045 Restrict experimental solidity to constantinople and above 2023-05-17 17:03:43 +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
Daniel
44a30e47ca
Merge pull request #14171 from ethereum/ast-import-via-standard-json
Add support to import AST via Standard JSON.
2023-05-09 22:22:31 +02:00
Alexander Arlt
4837d42361 Add experimental support to import AST via Standard JSON. 2023-05-09 14:07:38 -05:00
Nikola Matic
3bab14747e Fix hidden-overload in Types and remove CMake hack 2023-05-09 19:33:23 +02:00
Nikola Matic
9a87b587d5 Disallow immutable initialization in try catch statements
Trigger github
2023-05-09 14:48:14 +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
chriseth
1e63615206 Export all events.
Update tests.

Additional tests

Revert changes to the Natspec
2023-05-03 14:08:27 -03: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
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
f5b2044ed1 Remove unused CompilerStack::m_sourceJsons 2023-04-20 20:01:45 +02:00
Alexander Arlt
611e02c038 Rename assemble() to assembleYul() in CompilerStack and CommandLineInterface 2023-04-20 20:01:45 +02:00
Kamil Śliwak
ded9ef17e8 Misc small refactors: Use ranges::views::keys and fmt::format() 2023-04-20 20:01:45 +02:00
Alexander Arlt
2f78e9549a Misc small refactors: Superfluous std::, trailing commas in lists, whitespace, missing breaks, import order 2023-04-20 19:53:48 +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
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
b85a95f52d Refactor TokenTraits::isUnaryOp() not to treat + as a unary operator 2023-04-18 16:49:31 +02: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
Alex Beregszaszi
3edcfce478 Add warning for EIP-3860 enforced initcode limits 2023-04-15 13:43:05 +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
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
293690e5a4 Add util::capitalized() and Type::categoryName() 2023-04-04 17:30:37 +02:00
Rodrigo Q. Saramago
a0e62bbd3d
Annotate function ID of functions that may be called via the internal dispatch.
Co-authored-by: Daniel <daniel@ekpyron.org>
2023-03-20 20:14:41 +01:00
Leo Alt
aacbe72079 group unsupported warnings 2023-03-15 17:06:06 +01:00
Leo Alt
21c0f78650 Report safe properties in BMC and CHC 2023-03-09 14:59:32 +01:00
Kamil Śliwak
d30ec3548f
Merge pull request #14032 from ethereum/fix-member-call-on-null-for-unary-operators
Fix `member call on null pointer` when type-checking built-in unary operators
2023-03-07 23:42:47 +01:00
Kamil Śliwak
c95108169d Fix member call on null pointer when type-checking built-in unary operators 2023-03-06 19:20:18 +01:00
Kamil Śliwak
817a57b365 Use std:: prefix with std::forward() as well to satisfy Clang 2023-03-06 18:20:49 +01:00
Kamil Śliwak
5b5e853ea0 Warn about missing user-defined operator support in SMTChecker 2023-02-22 00:39:25 +01:00