Commit Graph

1027 Commits

Author SHA1 Message Date
chriseth
659da4bdc7
Merge pull request #11047 from ethereum/bytesToBytesNNConversion
Bytes to bytesNN conversion
2021-04-26 11:51:41 +02:00
Alex Beregszaszi
e39433198d Remove the usage of boost::noncopyable
Prior to this half of the codebase used explicit deleted copy constructors, the others used boost::noncopyable.
2021-04-23 14:57:01 +01:00
Djordje Mijovic
b40c3bcc32 Allowing conversion from bytes to bytesNN in type checker. 2021-04-23 13:19:19 +02:00
chriseth
8eb0d5edf6 Export used errors in the AST. 2021-04-19 14:15:50 +02:00
anurag4u80
b2ca7916aa Replaced boost::adaptors::transformed 2021-04-08 17:38:14 +05:30
anurag4u80
bbcdddeed9 Replaced keys, values and reverse with ranges 2021-03-31 23:33:04 +05:30
Mathias Baumann
e590a99f39 Detect circular references for library and free functions 2021-03-30 23:06:30 +02:00
chriseth
e877e2bba7 Use all referenced errors. 2021-03-30 21:15:46 +02:00
chriseth
d5669696d5 Code generation for errors. 2021-03-30 21:15:46 +02:00
chriseth
b552e5aeeb AST import and export for revert statement. 2021-03-30 21:15:46 +02:00
chriseth
fb67051467 Revert statement. 2021-03-30 21:15:46 +02:00
chriseth
b04b189959 Syntax for custom errors. 2021-03-30 21:15:18 +02:00
chriseth
99fcf62736 Extract referencedDeclaration as helper. 2021-03-24 17:01:50 +01:00
Djordje Mijovic
1493326e48 Adding bytes.concat function type. 2021-03-24 11:49:21 +01:00
chriseth
d15ba987d1 Fix AST output if modifier invocation is base constructor call. 2021-03-24 11:24:26 +01:00
chriseth
e3ea5c631e
Merge pull request #11136 from ethereum/refactor-typepointer
Replace `TypePointer` with `Type const*`
2021-03-23 18:32:38 +01:00
Mathias Baumann
e197ebbdd1 Replace TypePointer with Type const* 2021-03-23 11:47:19 +01:00
Mathias Baumann
bccedf791b Add creationCode/runtimeCode contract creation detection to call graph 2021-03-22 15:44:23 +01:00
chriseth
0519473059 Add "kind" field to ModifierInvocation AST json element. 2021-03-16 18:50:37 +01:00
hrkrshnn
ef0c4cc39f AST Import: For constructors, a public visibility is ignored. 2021-03-11 10:44:19 +01:00
Kamil Śliwak
e87cd0afdf Check that there is an interface type before querying validity of location. 2021-02-24 11:22:40 +01:00
Alexander Arlt
ae6996efc1 Fix issue with pop on storage array. 2021-02-23 14:26:55 +01:00
chriseth
3dcba53595
Merge pull request #10993 from ethereum/fixModuleMemberNames
Fix module member names for importing with renaming.
2021-02-23 14:20:28 +01:00
Kamil Śliwak
7a85516b82 Remove contract reference from the call graph 2021-02-23 14:01:20 +01:00
chriseth
c91cffa4ec Fix module member names for importing with renaming. 2021-02-23 13:15:32 +01:00
Kamil Śliwak
54eb34d6fd Move call graphs from CompilerStack to ContractDefinitionAnnotation 2021-02-23 10:47:02 +01:00
Kamil Śliwak
6c28120f19 Move CallGraph structure to a separate module 2021-02-23 10:47:02 +01:00
Kamil Śliwak
13a9d21d88 FunctionType: Add assertions against missing type annotations
- This should make it easier to realize that one of the analysis phases has not been executed.
2021-02-23 10:29:12 +01:00
Christian Parpart
9ca389d6cd MemberList.Member's last argument (declaration) made mandatory to avoid accidental missing out during construction. 2021-02-11 10:46:14 +01:00
Christian Parpart
b0d3412fa9 Fixes missing EnumValue declaration in nativeMembers. 2021-02-11 10:46:14 +01:00
Christian Parpart
32ba5f5ae7 libsolidity: Extend the AST for named AST nodes in order to get precise locations for names.
The actual SourceLocation on an ASTNode is representing the whole
ASTNode whereas in an LSP (for example) you are also interested in the
SourceLocation of a name of a construct (e.g. variable decarlation, function definition, ...).

This also properly encodes non-existend sources as `-1` in the JSON output (eliminating the use of `numeric_limits<size_t>::max()`).
2021-02-10 18:13:09 +01:00
chriseth
fcdb5e0b40 Export statement documentation. 2021-02-09 17:33:01 +01:00
hrkrshnn
ec57c791ef Fix infinite loop when accessing circular constants from inline assembly. 2021-01-26 09:22:05 +01:00
chriseth
99add1e4e5
Merge pull request #10710 from ethereum/implicit-conversion-bug
Disallow certain implicit conversions between integer types.
2021-01-12 15:42:12 +01:00
hrkrshnn
e107d51f46 Disallow certain implicit conversions between integer types.
Disallow implicit conversion from ``uintN`` and ``intM`` when ``M > N``, and by extension, explicit
conversion between the same types are also disallowed.
2021-01-12 08:23:47 +01:00
Daniel Kirchner
eac2bcf72f Add range-v3. 2021-01-11 18:44:55 +01:00
chriseth
b965446182 Catch panic. 2020-12-22 11:08:44 +01:00
hrkrshnn
2fb191175b Disallow some explicit conversions to address payable
The following explicit conversions are disallowed:

1. uint160 -> address payable
2. bytes20 -> address payable
3. literals -> address payable (payable(0) is an exception)
2020-12-15 15:01:40 +01:00
chriseth
ffaf40950a
Merge pull request #10605 from ethereum/develop
Merge develop into breaking.
2020-12-15 14:01:01 +01:00
Djordje Mijovic
8aa4568b10 [Sol->Yul] Implementing conversion from calldata slices to memory arrays.
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
2020-12-14 22:21:37 +01:00
Djordje Mijovic
0efd52a38e Allowing implicit conversion from calldata slice to memory and storage array types. 2020-12-14 22:21:37 +01:00
hrkrshnn
9bd778d728 Make msg.sender and tx.origin have type address
Previously both of them had type address payable. The idea is that anything that is not know to be
payable should be non-payable.
2020-12-14 16:55:48 +01:00
chriseth
28374447d2
Merge pull request #10582 from ethereum/addr-literal
Fix crash with oversized address literals
2020-12-14 12:14:28 +01:00
chriseth
561280a5cc Merge remote-tracking branch 'origin/develop' into breaking 2020-12-14 11:33:40 +01:00
Alex Beregszaszi
33ff2b16ff Fix crash with oversized address literals 2020-12-11 23:45:23 +00:00
Alex Beregszaszi
7b347b9ec2 Introduce address(...).code 2020-12-11 03:00:30 +00:00
Alex Beregszaszi
fa37e69c25 Improved error messages when converting to/from builtin functions 2020-12-10 22:38:15 +00:00
Alex Beregszaszi
7cd05bf603 Introduce block.chainid 2020-12-10 17:07:54 +00:00
Alex Beregszaszi
ad6739d0f6 Support address().codehash 2020-12-09 14:58:27 +00:00
chriseth
b18c76e34b Merge remote-tracking branch 'origin/develop' into breaking 2020-12-09 15:24:49 +01:00
Alex Beregszaszi
47b10fd751 Report warning if contract uses abicoder v1, but IR is requested 2020-12-09 01:20:58 +00:00
chriseth
806453aca9 Merge remote-tracking branch 'origin/develop' into breaking 2020-12-08 21:00:09 +01:00
Alex Beregszaszi
7e88ba8da0 Enable the -Wconversion warning 2020-12-08 16:45:24 +00:00
Christian Parpart
c5d172c058 Reimplement constant evaluator. 2020-12-04 15:14:25 +01:00
chriseth
49bde69afa Move computation of constants out of types.cpp 2020-12-04 15:14:25 +01:00
hrkrshnn
92ab32e532 Stricter explicit conversion between types.
A type can be converted to another if the conversion requires at most one of the following: sign,
width, kind (int, address, bytesXX, etc.) For example, the conversion `uint16(int8)` is now disallowed.
2020-12-03 16:49:53 +01:00
chriseth
9a5902f9d7 Merge remote-tracking branch 'origin/develop' into breaking 2020-12-02 12:28:02 +01:00
chriseth
390640f557
Merge pull request #10384 from ethereum/called_directly_feature
Use annotation.calledDirectly to simplify IR codegen
2020-12-01 15:07:02 +01:00
Mathias Baumann
c3da529a18 Mark expressions that are called directly in the annotations 2020-11-30 18:52:50 +01:00
Alex Beregszaszi
a22077f736 Rename AsmData -> AST
Also attempt to only include ASTForward where appropriate.
2020-11-25 17:58:02 +00:00
Alex Beregszaszi
3bce2a2294 Remove the legacy AST JSON output 2020-11-25 11:40:33 +00:00
chriseth
a0a02f2307 Merge remote-tracking branch 'origin/develop' into breaking 2020-11-23 19:28:08 +01:00
chriseth
f87edb6efc Bound functions. 2020-11-23 18:58:23 +01:00
Leonardo
ae8f484ed4
Merge pull request #10234 from ethereum/smt_named_arguments
[SMTChecker] Support named arguments in function calls
2020-11-20 12:24:51 -01:00
Leonardo Alt
e4339b0526 [SMTChecker] Support named arguments in function calls 2020-11-20 11:52:26 -01:00
Alex Beregszaszi
82997fbf5e Change AST::interfaceId() to uint32_t 2020-11-19 23:33:08 +00:00
chriseth
a7db4fa4a5 Merge remote-tracking branch 'origin/develop' into breaking 2020-11-18 20:05:02 +01:00
chriseth
2665eaa4fa Support .offset and .length for calldata bytes and string arrays. 2020-11-18 01:45:56 +01:00
Kamil Śliwak
ade71d58f8 Assume that enums always take 1-byte in the codegen and type system 2020-11-16 18:58:19 +01:00
hrkrshnn
9eafa1fa1a Change type of super to TypeType 2020-11-10 15:38:21 +01:00
hrkrshnn
03f58c6b52 Strict explicit conversion between literals and enums
Explicit conversions between literals and enums are only allowed if the literal can represent a
value in the enum.
2020-11-06 19:15:02 +01:00
hrkrshnn
a555556559 Stricter explicit conversions from Literals to Integers.
Explicit conversions from Literals to Integers will now be as strict as implicit conversions between
the same.
2020-11-03 14:31:44 +01:00
chriseth
5ffee049fa Merge remote-tracking branch 'origin/develop' into breaking 2020-11-03 14:05:14 +01:00
chriseth
834da7be90 Introduce abicoder pragma. 2020-11-03 13:31:50 +01:00
Leonardo Alt
94e2506132 Fix inherited state vars for BMC 2020-11-02 11:42:39 +00:00
chriseth
ce50f05fc1 Merge remote-tracking branch 'origin/develop' into HEAD 2020-10-29 16:44:47 +01:00
Alex Beregszaszi
1ab6340828 Move AsmJsonImporter from libsolidity to libyul
It is next to AsmJsonConverter now and interdependencies are shrunk.
2020-10-29 14:06:34 +00:00
chriseth
bfc8e26007 Remove low-level log functions. 2020-10-22 17:50:14 +02:00
chriseth
527c073bb9 Checked arithmetic by default. 2020-10-19 16:58:37 +02:00
chriseth
00fb152316
Merge pull request #10048 from ethereum/develop
Merge develop into breaking
2020-10-15 17:30:11 +02:00
Daniel Kirchner
20072918d9 Make sure lValueOfOrdinaryAssignment does not have an undefined value. 2020-10-14 21:00:18 +02:00
chriseth
979d3062bc
Merge pull request #10033 from ethereum/develop
Merge develop into breaking
2020-10-14 14:12:20 +02:00
Djordje Mijovic
1272c474ba Fixing ICE when returning Struct from library 2020-10-13 20:00:11 +02:00
Mathias Baumann
006e5f2e1f Allow path syntax for super constructor calls 2020-10-13 14:32:11 +02:00
Mathias Baumann
0b7b174945 Add AST Node IdentifierPath 2020-10-13 14:32:11 +02:00
chriseth
0ea4bdafcd
Merge pull request #10017 from ethereum/develop
Merge develop into breaking.
2020-10-13 12:58:23 +02:00
chriseth
cb0d1134b7 Extract function to compute function selector from signature. 2020-10-12 17:57:34 +02:00
chriseth
14352ed921 Merge remote-tracking branch 'origin/develop' into HEAD 2020-10-08 20:18:04 +02:00
chriseth
346fe1c6c5 Constants at file-level. 2020-10-08 18:56:17 +02:00
chriseth
e16811e79f Merge remote-tracking branch 'origin/develop' into HEAD 2020-10-08 14:56:52 +02:00
Harikrishnan Mulackal
a309669f75 Disallow explicit conversions from negative literals to `address` 2020-10-07 16:06:02 +02:00
Mathias Baumann
6114cd8e8e Add missing annotation assignments 2020-10-07 14:52:35 +02:00
Christian Parpart
99d48348de Eliminate dead ASTReduce. 2020-10-07 13:38:46 +02:00
chriseth
b401093679
Merge pull request #9967 from ethereum/develop
Merge develop into breaking.
2020-10-06 17:45:53 +02:00
chriseth
fda8bde2d7 Stop after parsing. 2020-09-30 16:57:49 +02:00
chriseth
9a28dbfebd
Merge pull request #9925 from ethereum/develop
Merge develop into breaking.
2020-09-29 16:42:56 +02:00
chriseth
2037b7d6b8
Merge pull request #9820 from ethereum/new-annotation-field-virtual
Add annotation field ``requiresVirtualLookup``
2020-09-29 15:33:54 +02:00
chriseth
4bdec8107c Merge remote-tracking branch 'origin/develop' into HEAD 2020-09-29 09:53:50 +02:00
Harikrishnan Mulackal
d23aff4cbb
Merge pull request #9918 from ethereum/isStateScopeCheck
Make isStateVariable regular scope check.
2020-09-29 09:33:03 +02:00
chriseth
cb82d8239c Make isStateVariable regular scope check. 2020-09-28 19:31:54 +02:00
Mathias Baumann
8584c98b6a Add annotation field `requiresVirtualLookup` 2020-09-28 17:36:23 +02:00
a3d4
9b740b03ff Simplify DeclarationRegistrationHelper 2020-09-28 13:21:57 +02:00
chriseth
763282343f
Merge pull request #9883 from ethereum/develop
Merge develop into breaking.
2020-09-24 16:05:51 +02:00
Alex Beregszaszi
e54110ff17 Return UTF-8 error in BoolResult and remove it from string type 2020-09-23 17:35:05 +01:00
Alex Beregszaszi
a154594de6 Display string literal as hex in error messages if it is not printable ASCII 2020-09-23 17:33:39 +01:00
Alex Beregszaszi
ca743191b7 Report why assigning oversized hex strings to bytes fail 2020-09-23 16:46:47 +01:00
chriseth
0c6dc1dce4
Merge pull request #9862 from ethereum/develop
Merge develop into breaking
2020-09-23 12:22:32 +02:00
chriseth
9c5e14e309
Merge pull request #9839 from ethereum/annotations-optional
Make annotations ``SetOnce`` or ``optional`` where feasible
2020-09-23 11:44:21 +02:00
Mathias Baumann
dd81d05559 Make annotations `SetOnce or optional` where feasible 2020-09-22 17:38:21 +02:00
chriseth
700cc4c9d3
Merge pull request #9836 from ethereum/fix-missing-check-for-nested-dynamic-arrays-with-abi-encode-decode-v1
Add missing check for nested dynamic arrays in abi.encode()/decode() functions in ABIEncoderV1
2020-09-22 15:49:17 +02:00
a3d4
6b77a20134 Introduce CompositeType 2020-09-21 16:18:04 +02:00
Kamil Śliwak
1a4cc4e64d Fix type check for nested arrays in abi.encode/decode functions in ABIEncoderV1
- Without this fix, nested arrays are not detected as unsupported and compiler fails on an UnimplementedError.
- Now it's consistent with how structs are handled in ABIEncoderV1.
2020-09-17 17:29:16 +02:00
chriseth
aa7a6922e7 Restrict unary negation to signed integers. 2020-09-17 15:01:53 +02:00
chriseth
5000785ff8
Merge pull request #9822 from ethereum/fix-ice-on-returning-string-literal-in-calldata
Mark string literals as not implicitly convertible to calldata arrays
2020-09-16 14:23:47 +02:00
Kamil Śliwak
3ba3bde65e Mark string literals as not implicitly convertible to calldata arrays 2020-09-16 12:44:57 +02:00
Kamil Śliwak
2916ae5bda Fix static arrays with dynamic elements not being treated as dynamic in FunctionType::returnParameterTypesWithoutDynamicTypes() 2020-09-16 11:15:52 +02:00
Alex Beregszaszi
9aa9962f71 Add ContractDefinition::interfaceId() helper 2020-09-14 20:34:52 +01:00
a3d4
e7a6534d4f Unify collision warnings 2020-09-14 02:17:53 +02:00
Leonardo
72f8a753a9
Merge pull request #9586 from ethereum/scoper
Assign scopes as a separate step.
2020-09-11 10:45:54 +02:00
Kamil Śliwak
5e9dd67a0a FunctionType::canTakeArguments(): Use the correct index when comparing named parameter types 2020-09-09 14:45:58 +02:00
Kamil Śliwak
41bcb97e36 Don't consider contracts implicitly convertible to the type of super
- `super` for all intents and purposes behaves like a type and should be a TypeType rather than ContractType. We have an issue to fix it but it's a breaking change. Until then let's at least not treat other contracts as convertible to the ContractType that `super` represents.
2020-09-08 00:29:44 +02:00
Kamil Śliwak
7681c7dddf Remove dead code from ContractType::isImplicitlyConvertibleTo() 2020-09-08 00:26:29 +02:00
chriseth
2934a1f037 Assign scopes as a separate step. 2020-09-02 20:45:33 +02:00
Harikrishnan Mulackal
7826564226 Fix infinite loop for structs in library function parameter 2020-08-27 14:18:07 +02:00
Harikrishnan Mulackal
1c066b1059 Allow type(Contract).name for abstract contracts and interfaces 2020-08-27 13:37:08 +02:00
Harikrishnan Mulackal
6f22899153 Disallow the exponent to be a signed integer literal 2020-08-27 12:08:45 +02:00
chriseth
7b8cc0c49b Remove null values from AST also in standard-json mode. 2020-08-19 11:06:14 +02:00
chriseth
2ff954ec2d Use kind in json AST for free function. 2020-08-18 11:46:59 +02:00
chriseth
e9f91edc4b Update existing tests. 2020-08-18 11:46:59 +02:00
chriseth
9324fb4f20 Free functions. 2020-08-18 11:46:59 +02:00
Jason Cobb
888d7037cd
Make FunctionCallAnnotation::kind a SetOnce 2020-08-12 11:57:01 -04:00
chriseth
c96e997a3c Fix member lookup for constructor in library. 2020-08-04 10:51:40 +02:00
Alex Beregszaszi
6eb60bc8cd Add check that regular and unicode string literals are well formatted 2020-07-27 18:21:17 +01:00
Alex Beregszaszi
6fe8e63eee Remove inconsistently used isValidUTF8 helper 2020-07-27 18:21:17 +01:00
chriseth
5812cd8213
Merge pull request #9511 from ethereum/ast-hex-string
[BREAKING] Distinguish between stringLiteral and hexStringLiteral in the JSON AST
2020-07-27 12:34:40 +02:00
Alex Beregszaszi
5ecc84e92e Distinguish between stringLiteral and hexStringLiteral in the JSON AST 2020-07-27 10:19:24 +01:00
chriseth
42063f2158
Merge pull request #9490 from ethereum/renameSlotToSelector
Rename external function slot to selector.
2020-07-27 10:42:47 +02:00
Djordje Mijovic
e7d5a7da10 [TypeChecker] Remove function input and return parameter names from mobileType 2020-07-23 14:39:49 +02:00
chriseth
147a80aa24 Rename external function slot to selector. 2020-07-23 14:19:15 +02:00
chriseth
9be5ed1220 Merge remote-tracking branch 'origin/develop' into breaking 2020-07-21 11:35:28 +02:00
Mathias Baumann
ba0a4de50d NatSpec: Implement `@inheritdoc` 2020-07-20 18:32:18 +02:00
chriseth
93c792c696 Remove special treatment of `var`. 2020-07-20 17:22:04 +02:00
Sachin Grover
b7adb2aa42 Add SPDX license identifier if not present already in source file
Fixes: #9220
2020-07-17 20:24:12 +05:30
chriseth
f945163909
Merge pull request #9432 from ethereum/develop
Merge develop into breaking.
2020-07-16 17:14:45 +02:00
chriseth
f28bede34a Refactor storageSizeUpperBound. 2020-07-14 10:45:02 +02:00
Daniel Kirchner
38c6ecbbe2 Remove finney and szabo denominations. 2020-07-13 18:07:10 +02:00
chriseth
8eee3ed3a2
Merge pull request #9388 from ethereum/develop
Merge develop into breaking.
2020-07-13 14:55:21 +02:00
a3d4
efc5ee207d Fix internal compiler error caused by oversized objects 2020-07-10 11:39:07 +02:00
Mathias Baumann
6b37f1c025 Remove visiblity of libraries in inherited contracts. 2020-07-09 16:38:29 +02:00
chriseth
747aeb4999 Assert that visibility of constructor is not queried. 2020-07-07 11:49:44 +02:00