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
wechman
2e8d50eca2
User-defined operators: Documentation
2023-02-22 00:39:25 +01:00
wechman
1a83fa7ebc
User-defined operators: Code generation
2023-02-22 00:39:25 +01:00
wechman
5b03c13f90
User-defined operators: Analysis
2023-02-22 00:39:25 +01:00
wechman
9445483d60
User-defined operators: Parsing and grammar
2023-02-22 00:06:17 +01:00
wechman
9a36438441
User-defined operators: AST
2023-02-22 00:06:17 +01:00
chriseth
07750ea23a
More aggressive runtime code exclusion.
2023-02-15 21:33:06 +01:00
Kamil Śliwak
1a981af548
Only suggest removing parentheses from a construction call if they're empty
2023-02-15 14:27:03 +01:00
Kamil Śliwak
73183d3df9
Fix missing base constructor arguments being treated as an unimplemented function
2023-02-15 14:27:03 +01:00
Daniel
d33f2734b6
Merge pull request #13952 from ethereum/fix-abstract-nondet
...
fix abstract nondet exception
2023-02-08 19:39:19 +01:00
Peter Lemenkov
603f9f7208
Type recognition workaround for some GCC compilers
...
Looks like somewhat old GCC compilers, namely 12.2.1, cannot recognize a
string literal sometimes. Let's help it to avoid error logs like this
one:
```
[ 75%] Building CXX object libsolidity/CMakeFiles/solidity.dir/codegen/ir/IRGeneratorForStatements.cpp.o
cd /builddir/build/BUILD/solidity-0.8.18/redhat-linux-build/libsolidity && /usr/bin/g++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DFMT_HEADER_ONLY=1 -DHAVE_CVC4 -DHAVE_Z3 -I/builddir/build/BUILD/solidity-0.8.18/redhat-linux-build/include -I/builddir/build/BUILD/solidity-0.8.18 -isystem /usr/include/z3 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fuse-ld=gold -O3 -DNDEBUG -fstack-protector-strong -Wimplicit-fallthrough -fmacro-prefix-map=/builddir/build/BUILD/solidity-0.8.18=/solidity -Wpessimizing-move -Wredundant-move -Wall -Wextra -Werror -pedantic -Wmissing-declarations -Wno-unknown-pragmas -Wsign-conversion -Wconversion -Wextra-semi -Wduplicated-cond -Wlogical-op -fdiagnostics-color -std=c++17 -MD -MT libsolidity/CMakeFiles/solidity.dir/codegen/ir/IRGeneratorForStatements.cpp.o -MF CMakeFiles/solidity.dir/codegen/ir/IRGeneratorForStatements.cpp.o.d -o CMakeFiles/solidity.dir/codegen/ir/IRGeneratorForStatements.cpp.o -c /builddir/build/BUILD/solidity-0.8.18/libsolidity/codegen/ir/IRGeneratorForStatements.cpp
In file included from /usr/include/c++/12/string:40,
from /builddir/build/BUILD/solidity-0.8.18/libsolidity/ast/ASTForward.h:27,
from /builddir/build/BUILD/solidity-0.8.18/libsolidity/ast/AST.h:26,
from /builddir/build/BUILD/solidity-0.8.18/libsolidity/ast/ASTVisitor.h:26,
from /builddir/build/BUILD/solidity-0.8.18/libsolidity/codegen/ir/IRGeneratorForStatements.h:24,
from /builddir/build/BUILD/solidity-0.8.18/libsolidity/codegen/ir/IRGeneratorForStatements.cpp:22:
In function 'std::char_traits<char>::copy(char*, char const*, unsigned long)',
inlined from 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy(char*, char const*, unsigned long)' at /usr/include/c++/12/bits/basic_string.h:423:21,
inlined from 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long)' at /usr/include/c++/12/bits/basic_string.tcc:532:22,
inlined from 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(char const*)' at /usr/include/c++/12/bits/basic_string.h:1647:19,
inlined from 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(char const*)' at /usr/include/c++/12/bits/basic_string.h:815:28,
inlined from '(anonymous namespace)::CopyTranslate::translateReference(solidity::yul::Identifier const&)' at /builddir/build/BUILD/solidity-0.8.18/libsolidity/codegen/ir/IRGeneratorForStatements.cpp:182:13:
/usr/include/c++/12/bits/char_traits.h:431:56: error: 'memcpy' accessing 9223372036854775810 or more bytes at offsets -4611686018427387902 and [-4611686018427387903, 4611686018427387904] may overlap up to 9223372036854775813 bytes at offset -3 [-Werror=restrict]
431 | return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
gmake[2]: *** [libsolidity/CMakeFiles/solidity.dir/build.make:695: libsolidity/CMakeFiles/solidity.dir/codegen/ir/IRGeneratorForStatements.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[2]: Leaving directory '/builddir/build/BUILD/solidity-0.8.18/redhat-linux-build'
gmake[1]: *** [CMakeFiles/Makefile2:414: libsolidity/CMakeFiles/solidity.dir/all] Error 2
gmake[1]: Leaving directory '/builddir/build/BUILD/solidity-0.8.18/redhat-linux-build'
gmake: *** [Makefile:139: all] Error 2
```
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
2023-02-08 17:51:56 +01:00
Leo Alt
db9c11a2a5
fix abstract nondet exception
2023-02-08 16:59:37 +01:00
Daniel
82fdc6fccc
Merge pull request #13932 from lemenkov/redundant_std_move
...
libsolidity: Redundant std::move
2023-02-07 15:29:41 +01:00
Leo Alt
8d91ccf028
[SMTChecker] Add a new trusted mode which assumes that code that is
...
available at compile time is trusted.
2023-02-06 17:02:33 +01:00
Peter Lemenkov
b3f35f703a
libsolidity: Redundant std::move
...
This patch suppresses warnings like this one:
```
/builddir/build/BUILD/solidity-0.8.18/libsolidity/ast/AST.h: In constructor 'solidity::frontend::FunctionDefinition::FunctionDefinition(int64_t, const solidity::frontend::ASTNode::SourceLocation&, solidity::frontend::ASTPointer<std::__cxx11::basic_string<char> >&, const solidity::frontend::ASTNode::SourceLocation&, solidity::frontend::Visibility, solidity::frontend::StateMutability, bool, solidity::langutil::Token, bool, solidity::frontend::ASTPointer<solidity::frontend::OverrideSpecifier>&, solidity::frontend::ASTPointer<solidity::frontend::StructuredDocumentation>&, solidity::frontend::ASTPointer<solidity::frontend::ParameterList>&, std::vector<std::shared_ptr<solidity::frontend::ModifierInvocation> >, solidity::frontend::ASTPointer<solidity::frontend::ParameterList>&, solidity::frontend::ASTPointer<solidity::frontend::Block>&)':
/builddir/build/BUILD/solidity-0.8.18/libsolidity/ast/AST.h:926:69: error: redundant move in initialization [-Werror=redundant-move]
926 | CallableDeclaration(_id, _location, _name, std::move(_nameLocation), _visibility, _parameters, _isVirtual, _overrides, _returnParameters),
| ~~~~~~~~~^~~~~~~~~~~~~~~
/builddir/build/BUILD/solidity-0.8.18/libsolidity/ast/AST.h:926:69: note: remove 'std::move' call
```
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
2023-02-05 12:06:19 +01:00
Jacob Heider
43431eb427
Fixes compilation errors with some clangs
...
resolves https://github.com/ethereum/solidity/issues/13854
2023-02-03 21:37:50 -05:00
Matheus Aguiar
2b70b08d5f
Allow library external functions to be bound with using for
2023-02-02 13:39:19 -03:00
Rodrigo Q. Saramago
feba4de509
Add paris constraints to SMTChecker
...
Co-authored-by: Daniel <daniel@ekpyron.org>
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
Co-authored-by: Leo <leo@ethereum.org>
2023-01-31 11:03:04 +01:00
Nikola Matic
e7543d487d
Issue warning when using deprecated SELFDESTRUCT
2023-01-25 16:55:11 +01:00
Rodrigo Q. Saramago
ef6ff2f055
Adds support for the EVM version "Paris".
...
Deprecates `block.difficulty` and disallow `difficulty()` in inline assembly for EVM versions >= paris.
The change is due to the renaming introduced by EIP-4399 (see: https://eips.ethereum.org/EIPS/eip-4399 ).
Introduces `block.prevrandao` in Solidity and `prevrandao()` in inline assembly for EVM versions >= paris.
Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>
Co-authored-by: Daniel <daniel@ekpyron.org>
Co-authored-by: matheusaaguiar <95899911+matheusaaguiar@users.noreply.github.com>
Co-authored-by: Nikola Matić <nikola.matic@ethereum.org>
2023-01-23 18:50:36 +00:00
vlad
7fbd36855d
Disallow usage of the indexed attribute for modifier parameters Added tests for edge cases of several keywords
2023-01-20 19:53:02 +01:00
vlad
6a0ea174b8
Disallow several indexed attributes for the same event parameter
2023-01-20 19:53:02 +01:00
Nikola Matic
c2e2adb953
Allow support for older boost and adjust docs
2023-01-18 10:51:14 +01:00
Matheus Aguiar
7779b6f352
Forbid private library functions to be attached outside their declaration scope
2023-01-17 16:27:35 -03:00
Nikola Matic
83c1f62026
Source location for named mapping keys
2023-01-17 12:25:23 +01:00
Nikola Matic
1da82045c4
Use directory_options instead of deprecated symlink_option
...
basename to step
2023-01-12 10:37:01 +01:00
Daniel
f441e1323a
Merge pull request #13384 from zemse/develop
...
Allow named parameters in mapping types
2023-01-09 17:59:29 +01:00
Saw-mon-and-Natalie
e295964f50
fixed some comments in Types.h
2022-12-16 14:58:41 +00:00
Soham Zemse
fa78e0f3d4
feat: allow named parameters in mapping types
...
Co-authored-by: Hari <webmail.hari@gmail.com>
test: add parser and abi test cases
docs: add example on using named parameters for mappings
- Add changelog
feat: update antlr grammar to allow named parameters in mappings
fix: prevent conflicting mapping parameter names
ref: change order of mapping initializers
test: update expectations and fix build
test: add more tests
fix: use common error & code for conflicting params
fix: issue with accessing nested mapping
test: add conflicting params tests for more nested levels
Update libsolidity/analysis/DeclarationTypeChecker.cpp
Co-authored-by: Nikola Matić <nikola.matic@ethereum.org>
fix: error reported with the same code twice
test: add more tests for 3 level nested mapping
Address review comments
2022-12-08 11:56:58 +01:00
wechman
64a4f32bc2
Consistent terminology for attached/bound functions
2022-12-07 19:31:41 +01:00
Leo Alt
77698f8108
Fix internal error when deleting struct member of function type
2022-11-30 12:47:32 +01:00
Leo Alt
608b424afc
Fix internal error when using user defined value types as mapping indices or struct members.
2022-11-29 13:04:01 +01:00
Leo Alt
07870d0318
Fix internal error in assignment chains that also assign to fully qualified state variables (, for example), where the contract expression is a tuble.
2022-11-28 18:45:50 +01:00
Leo Alt
a5dab6181c
Fix internal error when the abstract-nondet SMTChecker natspec annotation is used with a wrong option multiple times for the same function
2022-11-28 16:59:35 +01:00
Leo Alt
9a8dd4242f
Fix SMTChecker bug when a public library function is called internally by an internal library function, which in turn is called internally by a contract.
2022-11-28 13:07:18 +01:00
Vinay
9e7b85ac4b
Improve Error Reporting of SemVer Parser
2022-11-25 13:09:09 -03:00
Daniel
eb2f874eac
Merge pull request #13733 from ethereum/eofSetting
...
Add experimental EOF options for CLI and Standard JSON.
2022-11-23 20:37:24 +01:00
Daniel Kirchner
bf26d3be5a
Add experimental EOF options for CLI and Standard JSON.
...
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
2022-11-23 19:53:44 +01:00
chriseth
261e819df7
Type: Extract usingForDirectivesForType()
helper
2022-11-23 14:22:49 +01:00
wechman
edb4bfa398
ViewPureChecker: Extract reportFunctionCallMutability() helper from endVisit(FunctionCall)
2022-11-23 13:27:26 +01:00
wechman
27df07c4ce
TypeChecker: Minor simplifications for operators and using for
2022-11-23 13:27:26 +01:00
Leo Alt
24df40de9a
Allow running Eldarica from the command line
2022-11-22 21:16:45 +01:00
wechman
fbe1181517
CFGNode: For function calls store a pointer to a resolved function definition rather than the FunctionCall AST node
2022-11-09 17:51:32 +01:00
Duc Thanh Nguyen
4aac4c7bc4
Add Natspec devdoc inheritance support for events
2022-11-08 15:53:10 +01:00
wechman
df1f5eef72
UsingForDirective: Rename m_functions to m_functionsOrLibrary
2022-11-07 23:58:19 +01:00
Kamil Śliwak
a866aaebf3
Refactor several error messages in TypeChecker to use fmtlib
2022-11-07 17:13:41 +01:00
wechman
6da09e8d9a
Error message tweak: built-in unary/binary operator
2022-11-07 17:13:41 +01:00
wechman
4c9a58eb0f
Don't include location in a message about binding function to a type
2022-11-07 17:13:09 +01:00
wechman
d5428af5bb
Make the message about name not referring to a user-defined type more generic
2022-11-04 08:46:53 +01:00
Kamil Śliwak
12f5612c65
Merge pull request #13405 from ethereum/add_assembly_optimisersettings_translatesettings
...
[libevmasm] Add Assembly::OptimiserSettings::translateSettings.
2022-10-26 15:09:32 +02:00
Alexander Arlt
b7abcb25ae
[libevmasm] Add Assembly::OptimiserSettings::translateSettings.
2022-10-26 14:11:59 +02:00
Christian Parpart
9e7fe985bf
[Language Server]: Add basic document hover support.
2022-10-26 13:53:29 +02:00
chriseth
08af255658
Merge pull request #13578 from ethereum/imported-source-type-refactoring
...
[libsolidity] Refactor Compiler Stack imported source type.
2022-10-20 15:27:36 +02:00
Alexander Arlt
0da1ce3a00
[libsolidity] Refactor Compiler Stack imported source type.
2022-10-20 14:30:40 +02:00
hrkrshnn
6854e2b5d6
fix: bytecodeHash
cannot be set to non-none for appendCBOR=false
...
Testing: see `test/cmdlineTests/metadata_append_standard_json_error`
Closes: https://github.com/ethereum/solidity/issues/13628
2022-10-13 02:07:20 +02:00
Kamil Śliwak
53e0a47a1c
Merge pull request #13265 from ethereum/no-append-metadata
...
Add `--no-append-metadata` in CLI and `metadata.append` in JSON
2022-10-04 17:32:22 +02:00
Alex Beregszaszi
725253551e
Improve FunctionSelector helpers
2022-09-27 17:58:32 +02:00
hrkrshnn
d32661c0af
Added tests for --no-append-metadata
...
- Command line tests
- Documented the standard json
- Changelog
- A Change in SolidityExecutionFramework to prevent flaky gas tests
- A boost test for --no-append-metadata
- Removed an outdated comment
2022-09-26 20:40:34 +02:00
hrkrshnn
f96e802e74
Add --no-append-metadata
in CLI and metadata.append
in JSON
...
Skips appending metadata to the binary
2022-09-26 20:40:34 +02:00
Christian Parpart
d07c596f42
Renaming lspAssert to lspRequire plus adding some documentation to make it more clear what this function is supposed to be used for.
2022-09-26 12:14:56 +02:00
nishant-sachdeva
eafd7218b7
refactored struct message to use std::variant for _typeOrSeverity
2022-09-20 19:20:43 +05:30
nishant-sachdeva
c8011d8719
Cleaning up helpers around errors
2022-09-19 10:51:14 +05:30
Nikola Matic
e37dc8e975
Address review comments
2022-09-13 17:23:31 +02:00
Nikola Matic
feba1bfeff
Rework metadata and cover with tests
2022-09-12 11:13:49 +02:00
Nikola Matic
314a1cc92f
Command line tests and minor touch ups
2022-09-12 11:13:49 +02:00