Commit Graph
100 Commits
Author SHA1 Message Date
hrkrshnn 0100f48e05 FunctionSpecializer: skip specializing recursive functions
This avoids potential pathological behaviour, like in Ackermann function.
2021-03-29 11:02:31 +02:00
hrkrshnn bd5e47dc55 Changelog and adding the name to the doc 2021-03-29 11:02:31 +02:00
hrkrshnn 2c75d1dfe4 Isoltest gas update for FunctionSpecializer 2021-03-29 11:02:31 +02:00
hrkrshnn 09998ceb0c Tests for FunctionSpecializer 2021-03-29 11:02:18 +02:00
hrkrshnn 45a3747701 Added FunctionSpecializer to the optimization suite 2021-03-29 11:02:18 +02:00
hrkrshnn 22ebdc7438 Implemented FunctionSpecializer
Optimiser step that specializes the function with its literal arguments.
2021-03-29 11:02:18 +02:00
hrkrshnn 8564d08228 Added a helper class FunctionCopier in ASTCopier
Helper class that creates a copy of the function definition, replacing the names of the variable
declaration with a new name.
2021-03-29 11:02:18 +02:00
hrkrshnn b42fc2015c NameCollecter can now only collect VariableDeclarations
This is done to help with the optimizer step FunctionSpecializer
2021-03-25 11:49:16 +01:00
hrkrshnn 4fbf5a3f12 Added few more tests for low level inliner. 2021-03-24 13:50:24 +01:00
hrkrshnn 30e08ee3a5 Changelog and test for the KeccakCaching bug 2021-03-23 11:09:00 +01:00
hrkrshnn 2ecb20589b Fix bug about incorrect caching on Keccak256 hashes 2021-03-23 10:49:24 +01:00
hrkrshnn 6d9e9e1b1e Fix small bug in GasMeter calculation in creation context
Old calculation did not ignore `optimize-runs` parameter, when creation code gas computations were
done. This would lead to expanding values such as `shl(180, 1)` inside constructor code, even for
the default value for `--optimize-runs`, i.e., 200.
2021-03-17 12:33:10 +01:00
Harikrishnan Mulackal 35da404ca9 Merge pull request #11091 from ethereum/modifierInvocationAST
Add "kind" field to ModifierInvocation AST json element.
2021-03-16 19:44:40 +01:00
Harikrishnan Mulackal 0e22d0bd40 Merge pull request #11079 from ethereum/fix-visibility-warning
AST import: constructors have default visibility
2021-03-11 12:23:46 +01:00
hrkrshnn ef0c4cc39f AST Import: For constructors, a public visibility is ignored. 2021-03-11 10:44:19 +01:00
hrkrshnn 2c2c7a4473 Fix IR bug on deleting storage variables of function type.
Calling the zeroing function assumed that the stack slots needed for the type was always 1. This is
false for function types.
2021-02-24 12:43:33 +01:00
Harikrishnan Mulackal 58e0977647 Merge pull request #10994 from ethereum/remove-remains-of-ast-json-option
Remove the last remains of --ast-json option
2021-02-24 10:21:30 +01:00
hrkrshnn 66d6d20f65 Converted hash collision error into a fatal type error.
The check is performed during ContractLevelChecker. However, the TypeChecker throws in certain cases
when it encounters functions, whose hashes collide.
2021-02-23 17:09:40 +01:00
Harikrishnan Mulackal 148e1150f2 Merge pull request #10992 from ethereum/detectAssignToFunction
Detect assignment to function in inline assembly.
2021-02-23 13:26:45 +01:00
Harikrishnan Mulackal 6fd5ea01d1 Merge pull request #10971 from ethereum/onlyWarnAboutVariables
Only warn about variables being shadowed in inline assembly.
2021-02-19 16:17:02 +01:00
hrkrshnn f336a68009 Added syntax tests for constructors with function parameter 2021-02-17 17:12:02 +01:00
hrkrshnn 2608c56d32 Make an assert less strict
Even though one can convert from, say, a pure function to a function without a state mutability
specified, in ABIFunctions.cpp, there was an assert that checked if the types were exactly equal.
This assert had to be loosened up.
2021-02-17 17:12:02 +01:00
hrkrshnn e24a23edcd Semantic test where constructor has a function as parameter 2021-02-15 14:16:28 +01:00
hrkrshnn 0135cae222 Fix IR bug: constructor parameter that needs multiple stack slots
When an argument had multiple stack slots, like `function() external`, there wasn't enough variables
assigned for the constructor. This lead to some mismatch between return values and arguments between
some functions.
2021-02-12 17:42:02 +01:00
hrkrshnn a76ff8af1d Added tests for modifiers whose input is a function return value 2021-02-11 16:48:00 +01:00
hrkrshnn 7786e6d561 Fix IR bug when modifier parameter was function return variable
The bug was that function return variables were not part of the m_context.localVariable during
the modifier generation and a looking up them was throwing.
2021-02-11 14:44:55 +01:00
Harikrishnan Mulackal 215233d5c8 Merge pull request #10945 from ethereum/constructor-modifier-bugfix
Fix IR bug about calling the wrong modifier during construction
2021-02-10 21:42:45 +01:00
hrkrshnn 2f30fdaa21 Fix IR bug about calling the wrong modifier during construction 2021-02-10 20:53:11 +01:00
Harikrishnan Mulackal 43319574e7 Merge pull request #10925 from ethereum/fixedPointAssertionSol2Yul
[Sol->Yul] Adding unimplemented assert for fixed point types on righ shift
2021-02-09 17:27:19 +01:00
hrkrshnn 8167029dc1 Updating tests after improving Yul error reporting 2021-02-09 16:55:33 +01:00
hrkrshnn 5a21e33743 Improve error reporting for Yul parser errors
This makes debugging Sol2Yul codegen bugs slightly easier.
2021-02-09 15:40:25 +01:00
Harikrishnan Mulackal 9e58a568a9 Fixed links in Docs 2021-02-08 14:30:09 +01:00
Harikrishnan Mulackal 47d5939dbd Improved wording in documentation 2021-02-08 14:21:37 +01:00
Harikrishnan MulackalandAlex Beregszaszi 9a5a4dfc6c Added a note about 63/64 rule
Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>
2021-02-08 14:19:13 +01:00
hrkrshnn 133bc72970 Tests and changelog for <address>.code.length shortcut 2021-01-26 11:08:39 +01:00
hrkrshnn 526ceec152 Implement IR shortcut for <address>.code.length 2021-01-26 11:07:04 +01:00
hrkrshnn d6d880dc53 Old codegen: implemented shortcut for <address>.code.length 2021-01-26 11:07:04 +01:00
hrkrshnn ec57c791ef Fix infinite loop when accessing circular constants from inline assembly. 2021-01-26 09:22:05 +01:00
Harikrishnan Mulackal bad8d23802 Merge pull request #10830 from az1az1/develop
Update value-types.rst
2021-01-21 12:41:46 +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
Harikrishnan Mulackal 5241b7b761 Merge pull request #10684 from ethereum/fixIRWrappingExp
Use wrapping arithmetic for exp in unchecked blocks.
2021-01-06 18:53:54 +01:00
Harikrishnan Mulackal 591f04e41c Merge pull request #10718 from ethereum/gitignoreClion
Extend .gitignore to all CLion build directories and allow "build" to be a symlink.
2021-01-06 12:45:30 +01:00
Harikrishnan Mulackal 3cb48b8c60 Merge pull request #10683 from ethereum/optSubEq
Optimize iszero(sub(x, y)) to eq(x, y).
2021-01-06 12:22:54 +01:00
Harikrishnan Mulackal e06af46f3d Merge pull request #10697 from GKStretton/patch-1
Fix typo
2020-12-28 13:10:24 +01:00
Harikrishnan Mulackal 8194cbb497 Merge pull request #10640 from ethereum/error-cleanup
Improve the Error class with a constructor for secondaryLocation
2020-12-17 17:58:28 +01:00
hrkrshnn 571f9dafca Documentation for the PR about making address conversions nonpayable 2020-12-15 15:04:45 +01:00
hrkrshnn fdaede9b3e Tests after disallowing some explicit payable conversions 2020-12-15 15:01:40 +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
Harikrishnan Mulackal 90a0bbefa3 Merge pull request #10593 from ethereum/someMoreTests
Some more tests for overflow.
2020-12-14 19:41:10 +01:00
hrkrshnn 7438c4dc16 Tests after making all explicit address conversions as non-payable 2020-12-14 18:46:01 +01:00
hrkrshnn f30c7cbac8 All explicit address conversions return a non-payable address 2020-12-14 18:41:27 +01:00
hrkrshnn 88c99a7538 Tests/Docs: changing type of msg.sender and tx.origin into address
And also making the type of address(literal) as non-payable address.
2020-12-14 16:55:48 +01:00
hrkrshnn e1a95cfd42 Disallow conversions from literals to payable address
To get a payable address, one has to go through address. For example, `payable(address(0))`.
2020-12-14 16:55:48 +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
Harikrishnan Mulackal 2139f93410 Merge pull request #10556 from ethereum/external-test-readme
README describing the workflow around external tests and their repositories
2020-12-11 17:37:38 +01:00
Harikrishnan Mulackal cca484eaa5 Merge pull request #10551 from ethereum/restore-original-external-test-branches-on-breaking
[BREAKING] Restore original external test branches on breaking
2020-12-09 18:25:17 +01:00
hrkrshnn 06d719e4f1 Move filter to CommonData.h 2020-12-09 11:13:27 +01:00
hrkrshnn 7ea96c5583 Move the implementation of createLinkingFunction into a cpp file 2020-12-09 11:13:27 +01:00
hrkrshnn 9e5d7b9910 Test updates after disallowing Integer -> Contract conversion 2020-12-03 17:53:00 +01:00
hrkrshnn 40244c5469 Tests/Docs after stricter explicit conversion. 2020-12-03 16:51:05 +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
Harikrishnan Mulackal 61363d8e21 Merge pull request #10471 from ethereum/yul-interpreter-finetune-execution-steps
Yul interpreter: Smaller execution timeout for tests and additional testcases
2020-12-03 11:38:33 +01:00
hrkrshnn 3efac3eef0 NameSimplifier is removed from steps available to users. 2020-12-02 13:48:01 +01:00
hrkrshnn 5a15a4a6bd Fix a bug in NameSimplifier.
A new name created by NameSimplifier could also be created by NameDispenser, since the knowledge of
the new name was not stored in NameSimplifier.
2020-12-02 13:48:01 +01:00
Harikrishnan Mulackal 6513b1f2ae Merge pull request #10468 from ethereum/force-latest-truffle-for-ens
Force ENS external test to use latest Truffle
2020-12-02 11:24:51 +01:00
Harikrishnan Mulackal 91e67472bf Merge pull request #10383 from ethereum/add-ens-external-tests
External tests: Add ENS contracts
2020-11-30 18:15:15 +01:00
hrkrshnn cf6fe5a777 NameDispenser: Added three public functions.
The private function `illegalName` was converted into a public function.

A new public getter function `usedNames()` returns a reference to `m_usedNames`.

A public function reset that would change all `m_usedNames` to *only* the names that are used in the
AST. Also resets the counter. This will be used before the final NameSimplifier step in the
optimization phase.

The first two functions were added so that `NameSimplifier` could use it instead of traversing the AST
using `NameCollector` to find used names.
2020-11-30 14:02:57 +01:00
hrkrshnn a834476de6 Tests/Docs after disallowing super, this and _ as declaration names 2020-11-25 11:14:13 +01:00
hrkrshnn 1a6f0fe52f Disallow declarations to have names "this", "super" and "_".
There will be a declaration error 3726 if these names are used in the contract. Note that there is
an existing warning about shadowing a built-in for "this" and "super".
2020-11-25 11:14:13 +01:00
Harikrishnan Mulackal fb2d071b70 Merge pull request #10387 from ethereum/fixBreakingMerge
Fix merge conflicts
2020-11-25 09:20:23 +01:00
hrkrshnn 52c8fcc67b Removed "compileToEwasm: also" option from 4 tests cases 2020-11-25 08:13:46 +01:00
Harikrishnan Mulackal 1dd0cd1245 Merge pull request #10366 from ethereum/wasm-string-literal
[wasm] Document what StringLiteral is
2020-11-23 10:20:46 +01:00
hrkrshnn 2348b721bb Tests after changing type of super to TypeType 2020-11-10 15:38:21 +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
Harikrishnan Mulackal 170cfeb1f0 Merge pull request #10205 from ethereum/smt_remove_cli_timeout_tests
Adjust SMTChecker timeout tests
2020-11-06 15:29:57 +01:00
Harikrishnan Mulackal be74479517 Merge pull request #10197 from cakesoft-khushi/new_branch
Update yul.rst
2020-11-04 12:37:39 +01:00
Harikrishnan Mulackal 24cce56215 Merge pull request #10189 from ethereum/underscore-tests
Add syntax and semantic tests for underscore
2020-11-03 17:06:31 +01:00
hrkrshnn 29e23efc93 Tests/Docs after "stricter explicit conversion from Literals to Integers" 2020-11-03 14:31:44 +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
hrkrshnn adcf9eba8d Fix incorrectly set annotation.requiredLookup 2020-10-30 15:40:06 +01:00
Harikrishnan Mulackal 71d815f565 Merge pull request #10114 from ethereum/restructureBreaking
Re-structure list of breaking changes.
2020-10-26 18:49:38 +01:00
hrkrshnn 0e30fbbae1 Fix failing SMTChecker test on breaking 2020-10-26 14:01:40 +01:00
Harikrishnan Mulackal 07e3f60ffc Merge pull request #10095 from ethereum/smt_fix_conditional
[SMTChecker] Fix ICE on conditional with tuples of rationals
2020-10-26 10:15:26 +01:00
hrkrshnn 13e7012e1e Parser: Exponentiation is right associative 2020-10-13 16:38:37 +02:00
Harikrishnan Mulackal dbd5326d0c Commandline test for exp with literal base 2020-10-12 18:54:58 +02:00
Harikrishnan Mulackal 418aa01c5b Optimization for exponentiation when the base is a literal 2020-10-12 18:54:58 +02:00
Harikrishnan Mulackal b0acf5dc86 Merge pull request #10005 from ethereum/bugs-fix-tabs
Docs: convert tabs to spaces
2020-10-12 10:03:13 +02:00
Harikrishnan Mulackal 8f2cd82fd9 Merge pull request #9968 from ethereum/docs_fixes
[Docs] Updates Index/Home Page of Sol Docs / Adds "Getting Started"
2020-10-12 08:54:31 +02:00
hrkrshnn 30652394e5 Docs: convert tabs to spaces 2020-10-12 08:01:20 +02:00
Harikrishnan Mulackal a309669f75 Disallow explicit conversions from negative literals to `address` 2020-10-07 16:06:02 +02:00
Harikrishnan Mulackal 24ba5aa3aa Updating docs on DynamicArrayCleanup bug 2020-10-06 16:06:02 +02:00
Harikrishnan Mulackal 1bdbc10110 Properly cleanup after copying dynamic-array to storage for packed types 2020-10-06 16:06:02 +02:00
Harikrishnan Mulackal 756e21a888 Merge pull request #9946 from ethereum/viewpure-tests
Add more tests to ViewPureChecker
2020-10-02 14:36:28 +02:00
Harikrishnan Mulackal 7773bb3bd0 Fix typo: storage 2020-10-02 11:44:10 +02:00
Harikrishnan Mulackal fd02ccc68c Implemented events with indexed function as parameter in Yul 2020-09-30 12:11:39 +02:00
Harikrishnan Mulackal 3970412422 Implemented events with function type as one of its indexed parameters 2020-09-30 12:11:38 +02:00
Harikrishnan Mulackal 2b9f040c48 Optimize exp when base is -1 2020-09-29 17:44:09 +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
Harikrishnan Mulackal f1deb41033 Merge pull request #9911 from ethereum/docs-change-pragma
[DOCS] Change >=0.7.0 to ^0.7.0
2020-09-28 13:50:46 +02:00