Daniel Kirchner
87804b6419
Split IntegerType into IntegerType and AddressType.
2018-09-05 12:19:14 +02:00
chriseth
e6aa15bae1
Merge pull request #4895 from ethereum/abidecodesingle
...
Fix abi.decode returning single value.
2018-09-04 23:47:56 +02:00
chriseth
624dbbe142
Fix abi.decode returning single value.
2018-09-04 18:19:00 +02:00
Daniel Kirchner
1ae6ec9038
Remove trailing whitespace.
2018-09-04 17:43:04 +02:00
Daniel Kirchner
82f512a7d4
Add return data to bare calls.
2018-09-04 13:31:10 +02:00
Daniel Kirchner
a102f3b783
Remove trailing whitespace for all files in the repository.
2018-09-04 11:30:30 +02:00
Anurag Dashputre
94c327c1ae
Removed unused "FunctionType::Kind::CallCode" from Types.h and all its usage
2018-08-23 13:09:00 +05:30
chriseth
c274af0770
Merge pull request #4825 from ethereum/expressionCompBareCall
...
More safeguards for (library) function types.
2018-08-16 14:38:44 +02:00
chriseth
455345871d
More safeguards for (library) function types.
2018-08-15 17:11:43 +02:00
Daniel Kirchner
7ca0aaaf6f
Add `staticcall
to
address
`.
2018-08-15 16:06:48 +02:00
chriseth
9328ea4c3c
Add abi.decode(bytes data, (...))
2018-08-15 10:45:16 +02:00
Alex Beregszaszi
ed52f422b7
Rename FunctionKind SHA3 to KECCAK256 (as the instruction was renamed in libevmasm)
2018-08-08 22:37:40 +01:00
Leonardo Alt
faa9c221d4
Changes in ExpressionCompiler
2018-07-18 19:51:24 +02:00
Alex Beregszaszi
0dd79bc172
Merge pull request #4479 from ethereum/fixFixedPointCrash
...
Fix handling of fixed point types in arithmetics.
2018-07-12 15:04:16 +01:00
chriseth
7355298c2f
Fix handling of fixed point types in arithmetics.
2018-07-11 14:56:53 +02:00
Leonardo Alt
38026d3114
Use STATICCALL for view and pure
2018-07-11 14:45:22 +02:00
Cryptomental
140dbfdbd8
Code, Changelog, ReleaseChecklist: Fix typos.
...
Refs: #4442
2018-07-11 00:26:23 +02:00
chriseth
85b9d3927a
Merge pull request #4224 from ethereum/revert_wrong_calldata
...
[BREAKING] Revert if calldata has wrong size
2018-07-02 12:55:22 +02:00
Leonardo Alt
7763d21cc6
Revert if calldata is too short or points out of bounds
2018-06-26 10:27:48 +02:00
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
Alex Beregszaszi
aefb6e5fcf
Rename dev::sha3 to dev::keccak256
2016-10-06 14:53:40 +01:00
chriseth
5a45990458
Access output memory area so that we do not pay for resize during call.
2016-09-17 11:29:54 +02:00
chriseth
9ca7472089
Provide gas stipend manually for send(0).
2016-09-06 12:37:01 +02:00
chriseth
f687635e47
Merge pull request #665 from axic/feature/accept-ether
...
BREAKING: Add payable modifier
2016-09-06 12:25:19 +02:00
chriseth
9c64edf110
Change function type to include and propagate payable and constant modifier.
2016-09-05 21:28:28 +02:00
chriseth
69c175fe22
Do not pay new account gas.
...
If we checked that the target contract exists, we do not have
to pay the "new account gas".
2016-09-05 15:52:44 +02:00
chriseth
b2507e9f10
Merge pull request #839 from chriseth/checkcode
...
BREAKING: Make function calls throw if target does not have code.
2016-08-17 16:44:15 +02:00
chriseth
774bb8ab3b
Make function calls throw if target does not have code.
...
Low-level calls still just execute and will actually report "success".
This allows `x.call.value(y)()` for x being a non-contract account.
2016-08-17 11:30:40 +02:00
chriseth
e7084d9e16
Throw on division by zero.
2016-08-17 11:27:15 +02:00
chriseth
d5505e21eb
Merge pull request #838 from chriseth/ecrecover
...
Make ecrecover return zero for malformed input.
2016-08-17 11:05:20 +02:00
chriseth
77f4424589
Provide inline assembly to the code generator. ( #840 )
...
* Directly usable inline assembly.
* Add missing header.
2016-08-16 16:27:20 +02:00
chriseth
d731225d02
Actually better to return zero on error.
2016-08-16 14:53:01 +02:00
chriseth
034d436933
Make ecrecover throw for malformed input.
2016-08-16 14:53:01 +02:00
chriseth
2a560b798b
Throw if contract creation fails.
2016-08-16 14:49:44 +02:00
Denton Liu
5ee846e39f
Remove After from ExpressionCompiler
2016-08-11 10:15:59 -04:00
chriseth
58cc6cbb37
Bugfix: Allocate empty array.
2016-07-28 17:24:18 +02:00
Alex Beregszaszi
0cb820cf98
Include SHR case in ExpressionCompiler::appendShiftOperatorCode
2016-06-07 19:39:14 +01:00
chriseth
708129abd5
Fixes for invalid cleanups for small types.
2016-05-20 16:52:40 +02:00
chriseth
d4206b7cd0
Remove unused tests and add asserts for not implemented parts in code generation.
...
quick fix on christian's rational
change so that ubuntu will stop yelling
be more specific with rational declaration for Windows sake
rational in namespace correction for windows
2016-05-10 16:03:33 -05:00
VoR0220
4b749fc333
changed names for Rational Constants and categories
2016-05-09 11:41:02 -05:00
RJ Catalano
9a075458ad
initial work for fixed types...potentially needing a constant literal type for this
...
notation
Rational implemented...trying to figure out exponential
fix for token bug, also quick fix for the wei and seconds
fixed problem with var...probably a conversion problem for fixed in size capabilities
adding fixed type tests
Removing bitshift and regrouping fixed type tests together
size capabilities functioning properly for fixed types
got exponents up and working with their inverse, changed a few of the tests....something is working that likely shouldn't be
slight changes to how to flip the rational negative around...still trying to figure it out
tests added
updated tests
odd differences in trying soltest from solc binary, let me know if you can replicate
test not working for odd reason
fixed test problem with fixed literals...still need a way to log this error
broken up the tests, added some, changed some things in types and began compiler work
moar tests and prepping for rebuilding much of the types.cpp file
further fixing
initial work for fixed types...potentially needing a constant literal type for this
2016-05-09 11:41:02 -05:00
chriseth
7ea3d950d7
Allow calling internal functions of libraries.
...
Internal functions of libraries can be called as if the library were a
base contract of the calling contract. As the calling convention for
internal functions is to not create a new call context, the code of
these functions will be pulled into the context of the caller,
duplicating their code. This might pull in code of further internal or
even private functions.
The use case for such functions is to allow libraries which can operate
on memory types such that these types can also be modified in place.
2016-05-03 22:41:18 +02:00
chriseth
f227050c20
Make solidity independent from ethcore.
2016-04-06 20:56:00 +02:00
Dimitry
d2cee6f9c6
reduce unnecessary solidity:: namespace
2016-04-04 15:41:35 +04:00
Dimitry
858c41260d
rename namespace for instruction.h/cpp in libevmasm
2016-04-02 15:56:43 +03:00
chriseth
2c29492227
Correctly clean higher order bits for index access.
2016-03-31 10:33:45 +02:00
Bob Summerwill
a1ce66b304
Fixed Windows warnings
2016-03-18 01:22:15 -07:00
chriseth
e5514becb8
BREAKING: Implement delegatecall and make default for library calls.
2016-03-11 17:49:32 +01:00
chriseth
29faf1b298
Index access for bytesXX.
2016-02-09 17:07:04 +01:00
Lu Guanqun
b003290638
[cond-expr] fixup according to code review
2016-01-22 17:14:00 +00:00
Lu Guanqun
c781b130ef
[cond-expr] make the codegen one instruction less
2016-01-22 17:14:00 +00:00