Commit Graph

202 Commits

Author SHA1 Message Date
chriseth
a55e8c93ce Save double encode call for sha3. 2018-06-25 17:17:18 +02:00
chriseth
23c4142005 Bare functions take single bytes argument. 2018-06-25 17:01:45 +02:00
chriseth
0e66a1ddde Single bytes argument.
In 0.5.0 mode, only accept a single bytes argument for ``.call``,
``keccak256`` and others and do not pad when encoding.
2018-06-25 17:01:45 +02:00
Daniel Kirchner
e84b55bd6f Extend explanatory remark and argue using bitwise operations instead of rounding. 2018-06-12 09:32:19 +01:00
Daniel Kirchner
f33dc92cbd Use proper SAR for signed right shifts and emulate on pre-constantinople. 2018-06-12 09:32:19 +01:00
Erik Kundt
34b5eca1f8 Improves assembly and adds more tests. 2018-05-30 17:40:33 +02:00
bitshift
e9dcfb0b62 Implements pop() for value type arrays. 2018-05-29 12:53:02 +02:00
Alex Beregszaszi
c03a29dea8 Fix revert with reason coming from a string variable 2018-05-09 17:53:17 +02:00
chriseth
2968639406 Removed signed shift right from the utilities. 2018-04-30 20:34:43 +01:00
Alex Beregszaszi
52c9441879 Do not use SAR instead of SDIV in shifts because it rounds differently 2018-04-30 20:34:43 +01:00
Alex Beregszaszi
22bfd3da41 Use native shift instructions on Constantinople 2018-04-30 20:34:43 +01:00
Alex Beregszaszi
0201492bbf Remove redundant cleanup for abi.encode. 2018-04-16 12:47:38 +02:00
chriseth
7054defdd6
Merge pull request #3364 from ethereum/revertWithReason
Revert with reason
2018-04-12 21:01:08 +02:00
chriseth
4faa839813 Use error signature for revert data. 2018-04-12 13:09:38 +02:00
chriseth
7a9ee69e98 Bubble up error messages. 2018-04-12 13:09:38 +02:00
chriseth
ae1d040285 Allow error string for `require`. 2018-04-12 13:09:37 +02:00
chriseth
012ab37fe3 Code generator for revert with reason string. 2018-04-12 13:09:37 +02:00
Alex Beregszaszi
d56acb68ab Add abi.encode, abi.encodePacked, abi.encodeWithSelector and abi.encodeWithSignature. 2018-04-11 22:32:10 +02:00
chriseth
65f18a18de More specific push implementation. 2018-04-04 16:50:45 +02:00
chriseth
6777f7a57f Optimize across MLOAD if MSIZE is not used. 2018-04-03 14:34:32 +02:00
Alex Beregszaszi
fab527c414 Add runtimeOnly option to pushCombinedFunctionEntryLabel 2018-03-27 04:00:12 +01:00
chriseth
0a67d616db Use shortcut for internal function calls to avoid runtime reference. 2018-03-27 04:00:12 +01:00
chriseth
c2709a2d8e Decode dynamic data. 2018-03-21 14:53:29 +00:00
chriseth
cc2f71e4ac Move dynamic type removal out of the type system. 2018-03-21 14:53:29 +00:00
chriseth
834d63de2c Allow `block.blockhash` without being called. 2018-03-13 17:34:21 +01:00
chriseth
b467116ea8 Use STATICCALL for pure function calls if EVM version supports it and 0.5.0 is activated. 2018-03-06 15:30:18 +01:00
chriseth
f6c0daec14
Merge pull request #3652 from ethereum/gasleft_v2
Use StaticAnalyzer to deprecate msg.gas instead of conditionally remo…
2018-03-06 09:26:14 +01:00
Daniel Kirchner
91b13b734d Use StaticAnalyzer to deprecate msg.gas instead of conditionally removing it in MagicType. 2018-03-05 23:16:26 +01:00
chriseth
be797cb796
Merge pull request #3599 from ethereum/sendAllGasOnByzantium
Send all gas on byzantium
2018-03-05 20:13:52 +01:00
chriseth
3793aa405b
Merge pull request #3643 from ethereum/gasleft
Move msg.gas to global function gasleft(). Closes #2971.
2018-03-05 20:11:37 +01:00
chriseth
83fcf007bf Do not retain any gas in external calls (except if EVM version is set to homestead). 2018-03-05 19:32:12 +01:00
Daniel Kirchner
3340053fd9 Style improvements. 2018-03-05 17:00:37 +01:00
chriseth
6ec4517929 Use EVM version in gas meter and optimizer. 2018-03-05 11:36:33 +01:00
Daniel Kirchner
c633c0eacb Move msg.gas to global function gasleft(). Closes #2971. 2018-03-05 11:18:04 +01:00
chriseth
2b5a5a8669 Make addmod and mulmod revert if the last argument is zero. 2018-02-15 13:52:17 +01:00
chriseth
5916cf1e0a Allow this.f.selector to be pure. 2018-02-13 11:00:59 +01:00
chriseth
6001bd1406 Allocate one byte per memory byte array element instead of 32. 2017-10-16 22:29:31 +02:00
chriseth
69ea5c43f3 Send all gas for 0.5.0. 2017-10-05 11:56:36 +02:00
Alex Beregszaszi
204214f070 Split encodeToMemory to packedEncode and abiEncode 2017-09-27 11:32:19 +01:00
Alex Beregszaszi
a657d3b1a1 Make most of the parameters mandatory in encodeToMemory 2017-09-27 11:15:27 +01:00
Alex Beregszaszi
ee65ecfb3b Ensure that address types are always declared as 160bit 2017-09-26 22:46:33 +01:00
Alex Beregszaszi
cb6cdfe780 Simplify switch statements by refactoring internal break statements 2017-09-25 10:57:21 +01:00
Alex Beregszaszi
74972f5fa6 Avoid switch fallthrough in ExpressionCompiler 2017-09-25 10:51:58 +01:00
Alex Beregszaszi
efa4598c23 Mark functions static 2017-09-20 01:23:21 +01:00
Alex Beregszaszi
fd1f8ab38b Rename .sig to .selector on function types 2017-09-13 11:40:57 +01:00
Alex Beregszaszi
58f7a27ee0 Add sig member on function type 2017-09-13 11:40:57 +01:00
Alex Beregszaszi
79e84a8fa4 Swap declaration/statemutability in FunctionType constructor 2017-08-28 19:43:35 +01:00
Alex Beregszaszi
51d6141f7e Mark to places fall-through 2017-08-25 16:00:36 +01:00
Alex Beregszaszi
e2cfc9ee92 Mark a lot of functions const (where possible) 2017-08-22 10:51:46 +01:00
Alex Beregszaszi
a26a5f20ce Remove constant/payable in all function types 2017-08-14 14:21:47 +01:00
Alex Beregszaszi
b3061225bc .delegatecall() should always return a boolean of execution status 2017-08-01 20:50:03 +01:00
Alex Beregszaszi
39dba0efe8 Provide new account gas for low-level callcode/delegatecall 2017-08-01 14:00:17 +01:00
Alex Beregszaszi
6d37f30d76 Rename Bare to Barecall 2017-08-01 10:47:10 +01:00
chriseth
b74118ec57 Fix for invalid clearing of memory in ecrecover. 2017-07-28 15:32:42 +02:00
Alex Beregszaszi
89fadd6935 Merge pull request #2645 from ethereum/asserts
Use solAssert where possible
2017-07-27 11:12:30 +01:00
Alex Beregszaszi
af57879187 Report location on stack too deep if possible 2017-07-26 22:56:55 +01:00
Alex Beregszaszi
8098030986 Use solAssert instead of boost throw where possible 2017-07-26 22:23:21 +01:00
Alex Beregszaszi
8fd1d4167d Change shiftNumberOnStack to bits 2017-07-02 23:40:47 +01:00
Alex Beregszaszi
c7ae042114 Use shift helper 2017-07-02 23:37:47 +01:00
chriseth
168f64f4cb Fix negative stack size checks. 2017-06-28 16:55:49 +01:00
chriseth
f47e6e90fb Disallow comparisons between some types. 2017-06-26 16:30:36 +02:00
chriseth
64067975e4 Review suggestions. 2017-06-23 19:29:11 +02:00
chriseth
831ed08387 Change invalid opcode to revert for input validation. 2017-06-23 19:29:11 +02:00
Alex Beregszaszi
d5f8ce90c7 Merge interface/Exceptions and interface/Utils 2017-06-22 11:25:07 +01:00
Alex Beregszaszi
0c8beac357 Rename the SHA3 assembly instruction to KECCAK256 2017-05-30 10:54:29 +01:00
djudjuu
1d22233a43 refactoring functionCallAnnotation 2017-05-19 15:48:07 +02:00
Alex Beregszaszi
3ae88377d6 Change references to FunctionType::Location 2017-03-16 12:49:52 +00:00
chriseth
47cd8964b8 Require and Assert. 2017-03-14 14:21:33 +01:00
Yoichi Hirai
cfbbd89daf Merge pull request #1702 from ethereum/assertError
Change effect of assert to invalid opcode.
2017-03-03 18:25:50 +01:00
chriseth
d2c79bf8e9 Merge pull request #1700 from ethereum/fixNoMobile
Some checks for the existence of mobile type.
2017-02-24 15:50:45 +01:00
Alex Beregszaszi
4d290e551c Disallow setting .gas() on .transfer() 2017-02-24 00:27:36 +00:00
Alex Beregszaszi
c674155e58 Do not keep the gas stipend if sending non-zero value 2017-02-24 00:18:18 +00:00
Alex Beregszaszi
81006dae98 Support gas modifier on addr.transfer() 2017-02-24 00:18:18 +00:00
Alex Beregszaszi
4264625c69 Implement address.transfer() 2017-02-24 00:17:45 +00:00
chriseth
811bb770c5 Change effect of assert to invalid opcode. 2017-02-16 15:54:17 +01:00
chriseth
dcc16c81e2 Some checks for the existence of mobile type. 2017-02-16 11:46:27 +01:00
Alex Beregszaszi
c8ec79548b Use the revert opcode in assert() 2017-02-10 22:53:32 +00:00
Alex Beregszaszi
f3158f92d6 Support revert() 2017-02-10 22:40:42 +00:00
Alex Beregszaszi
8a3d4a0500 Cleanup is not needed for assert() 2017-02-10 13:32:36 +00:00
Alex Beregszaszi
f8461e9e31 Implement assert as a global function 2017-02-10 13:29:17 +00:00
Alex Beregszaszi
693226b1ab Rename SUICIDE opcode to SELFDESTRUCT in libevmasm 2017-02-06 20:17:52 +00:00
Valentin Wüstholz
9bcbd93ac5 Change translation of implicit throws (issue #1589).
This adds a new invalid instruction that is used for encoding
implicit throws that are emitted by the compiler. This makes it
possible to distinguish such runtime errors from user-provided,
explicit throws.
2017-01-26 16:39:07 +01:00
chriseth
1316bb7565 Warn about invalid checksums of addresses. 2017-01-24 23:37:48 +01:00
chriseth
ead1a3b33f Include creation code only once. 2017-01-24 17:41:31 +01:00
chriseth
2536bdd6d0 Report source location on "stack too deep" errors. 2017-01-20 19:01:19 +01:00
Rhett Aultman
1f30982ab5 Use fully-qualified names for linking, too
Using libraries leaves behind a library link reference in the binary
which the linker must later resolve.  These link references were still
being generated by name and not by fully-qualified name.  This would
lead to a link-time collision between two libraries having the same
name but in different source units.

This change changes linker symbols over to fully-qualified names,
which resolves that issue.  This does potentially introduce a new
problem, which is that linker symbols appear to be limited to 36
characters and are truncated.  Storing paths extends the average
symbol size, and it would be great if truncation was from the tail
rather than the head.
2017-01-16 12:32:57 -05:00
Yoichi Hirai
6a312233fc
ast, codegen: enable accessing events through contract names.
Fixes #1286
2017-01-02 17:59:20 +01:00
chriseth
e9d3327ad6 Use correct type for storing. 2016-12-13 16:50:50 +01:00
chriseth
2738045030 Cleaner shift handling and type conversion for binary operations. 2016-12-12 11:12:12 +01:00
Alex Beregszaszi
b8b4f5e9f9 Support bitshifting in variables 2016-12-12 11:12:10 +01:00
Alex Beregszaszi
f1bc979c0f Use solUnimplemented wherever possible 2016-11-28 09:51:02 +00:00
VoR0220
3f9f725737 Fix licensing headers
Signed-off-by: VoR0220 <rj@erisindustries.com>
2016-11-23 12:22:33 +01:00
chriseth
e51f852504 Converted sub assembly to smart pointer. 2016-11-16 14:37:18 +01:00
chriseth
e543bd34c0 Stored combined creation and runtime tags.
Includes a change to Assembly to allow tags from sub-assemblies to be
used.

Sorry, this get a bit bigger than I thought.
2016-11-16 14:37:18 +01:00
Rhett Aultman
58e75c7a48 Unimplemented features moved to their own exception (#1361)
Unimplemented features moved to their own exception

InternalCompilerError is an exception that really should be reserved for
actual internal errors of the compiler.  Unimplemented features can now
use either solUnimplemented( ) or, if it should be conditional, then
solUnimplementedAssert( ).

* Revert some unimplemented exceptions, add handlers

The jsonCompiler and CommandLineInterface needed handlers for the
new UnimplementedFeatureException, and some cases I had moved on to
the new exception were better treated as real internal compiler
errors.

* Standardize on "Unimplemented feature" message
2016-11-14 20:41:58 +00:00
chriseth
e00a4b47c0 Merge pull request #1264 from ethereum/988
State variable under contract's name
2016-10-25 12:50:24 +02:00
chriseth
f25aa0c68b More checks for missing mobile type. 2016-10-24 16:45:25 +02:00
Yoichi Hirai
5245a3cf74
codegen: refactor common code 2016-10-24 16:34:23 +02:00
Yoichi Hirai
acba7b92e5
codegen: if a member access has been resolved as a variable, follow that
This fixes at least the first example in #988
2016-10-24 16:34:23 +02:00
Yoichi Hirai
7cee39fc17
codegen: skip contract L for L.Foo where Foo is a type
Fixes #1116
2016-10-24 15:30:26 +02:00