Commit Graph

1335 Commits

Author SHA1 Message Date
Nikola Matic
3bab14747e Fix hidden-overload in Types and remove CMake hack 2023-05-09 19:33: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
Kamil Śliwak
8a14680851 Disallow unary plus at the parsing stage 2023-04-18 16:47:00 +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
wechman
1a83fa7ebc User-defined operators: Code generation 2023-02-22 00:39:25 +01:00
chriseth
07750ea23a More aggressive runtime code exclusion. 2023-02-15 21:33:06 +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
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
wechman
64a4f32bc2 Consistent terminology for attached/bound functions 2022-12-07 19:31:41 +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
Alexander Arlt
b7abcb25ae [libevmasm] Add Assembly::OptimiserSettings::translateSettings. 2022-10-26 14:11:59 +02:00
Alex Beregszaszi
725253551e Improve FunctionSelector helpers 2022-09-27 17:58:32 +02:00
Nikola Matic
f6f0d6a360 Make hardcoded parts of the optimizer sequence configurable 2022-09-12 10:57:36 +02:00
Damian Wechman
6b99162457
Merge pull request #13406 from ethereum/slot_on_reference_fix
Fix `.slot` accessing via mapping reference in assembly
2022-09-05 14:00:18 +02:00
Marenz
f7cc29bec1 Add std:: qualifier to move() calls 2022-08-30 11:12:15 +02:00
wechman
cf3bae0839 Fix "slot" access via mapping reference in assembly 2022-08-17 07:53:52 +02:00
Matheus Aguiar
2282ea5e56 Added overflow checks after multiplication operation is executed. 2022-08-12 10:18:05 -03:00
Marenz
22c7cd22b9 Fix wrong cleanup when copying from calldata to memory
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
2022-08-08 13:07:16 +02:00
Ishtiaque Zahid
3e70a406af fixed wrong tab alignment in YulUtilFunctions.h 2022-08-03 12:33:11 +06:00
Matheus Aguiar
4fd5c11af7 Checks for overflow/underflow after add/sub operations. 2022-06-23 14:41:12 -03:00
Daniel Kirchner
4c84b77a4b Review suggested renaming. 2022-06-16 15:05:21 +02:00
Daniel Kirchner
cdf243a9af Improved array copy routine for value type arrays from memory or calldata to storage. 2022-06-16 15:05:21 +02:00
Daniel Kirchner
7a84e9c875 Bugfix. 2022-06-14 18:26:16 +02:00
Saw-mon-and-Natalie
a265d9968a
removed a duplicate word from a comment. 2022-06-13 17:38:43 -07:00
chriseth
51ef6a62da Fix removal of memory stores in inline assembly blocks. 2022-06-10 17:32:28 +02:00
chriseth
f0e43921f7
Merge pull request #12921 from ethereum/add_event_and_error_selector_fields_on_the_line_of_function_selector_field
Adding event and error selector fields
2022-05-23 11:34:13 +02:00
chriseth
30335c13ff
Merge pull request #13001 from matheusaaguiar/develop
Don't add an empty data slot to ABI-encoded empty strings from storage
2022-05-23 10:56:30 +02:00
nishant-sachdeva
d4c06d2b4e Adding event and error selector fields on the lines of the function selector fields 2022-05-23 10:49:16 +02:00
Daniel Kirchner
953bc9fed2
Merge pull request #12983 from ethereum/hint-via-ir
Recommend `via-ir` whenever a stack too deep error is encountered.
2022-05-20 12:26:25 +02:00
Matheus Aguiar
33ea6a679d Fixed bug that added a superfluous empty slot for data when encoding an empty string coming from storage.
Added tests covering empty string, uninitialized string, emptry string literal, byte arrays and explicit call to `abi.encode`.
2022-05-18 14:50:26 -03:00
Daniel Kirchner
d3a837b340 Bugfix. 2022-05-11 18:17:47 +02:00
hrkrshnn
5ae17c8e65 Recommend via-ir whenever a stack too deep error is encountered. 2022-05-05 19:22:03 +02:00
Joshua Quinones
e1a59397c6 Renamed AssemblyStack to YulStack
All files, references, variables, comments, etc. were renamed to YulStack.
2022-04-08 20:28:55 +02:00
Daniel Kirchner
8cb01a9953 Fix and updated test. 2022-03-15 10:23:09 +01:00
Daniel Kirchner
e58c0b561d Mark viaIR code generation as non-experimental. 2022-03-14 14:48:00 +01:00
Tyler
047034544e Merge branch 'develop' of github.com:tfire/solidity into fix/remove-namespace-ast-annotations 2022-03-09 18:55:22 -05:00
Daniel Kirchner
e0c837b33b Remove isCreation flag from OptimiserSettings. 2022-03-09 17:53:28 +01:00
Daniel Kirchner
ce0a3e93f2 Store whether an evmasm Assembly is creation code. 2022-03-09 17:42:29 +01:00
Tyler
519e1c9402 Specify namespaces
Fix references into solidity::util
2022-03-08 00:09:17 -05:00
chriseth
77c40cd2af
Merge pull request #12740 from ethereum/remove-locale-dependent-operations
Replace all locale-dependent operations with locale-agnostic counterparts
2022-03-07 17:56:58 +01:00
wechman
52dfccca98 Replace all locale-dependent operations with locale-agnostic counterparts 2022-03-07 17:23:08 +01:00
chriseth
4f19d68ee9
Merge pull request #12620 from ethereum/assemblyAnnotation
Memory-safety annotation for inline assembly.
2022-03-07 12:48:41 +01:00
nishant-sachdeva
beabc51c20 returnSize assigned according to truth value of returnInfo.dynamicReturnSize 2022-03-03 18:55:10 +05:30
Daniel Kirchner
9bcfcc61a7 Inline assembly without memory effects is implicitly memory safe. 2022-03-02 16:42:28 +01:00
Daniel Kirchner
e6848caac1 Allow annotating inline assembly as memory-safe. 2022-03-02 16:42:28 +01:00
chriseth
106921c278 Extract external function part into its own function. 2022-02-21 14:32:52 +01:00
nishant-sachdeva
276851ff91 Added support for FunctionType::Kind::StringConcat and functions string.concat 2022-02-10 22:08:47 +05:30
nishant-sachdeva
cc6344c03c Changed instaces of isByteArrayOrString() to isByteArray() where it's only supposed to return a True for Bytes Type 2022-02-02 17:05:26 +05:30
nishant-sachdeva
9043621747 Changed occurences of isByteArray() to isByteArrayOrString(). The idea
is to, in a future commit, replace such occurences of
isByteArrayOrString() which are required to return True only for Bytes
type with a new isByteArray() function.
2022-02-02 14:19:58 +05:30
nishant-sachdeva
e2711b7fab Corresponding code in the .cpp file has been commented instead of begin removed pending preliminary reviews
Code generators needed fixing of the cleanup process during typecasting of bytes and integers
2022-02-01 16:07:55 +05:30