Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 761eae2

Browse files
authored
Update from official repo
2 parents 7c69d88 + e5def2d commit 761eae2

File tree

115 files changed

+5062
-825
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+5062
-825
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,8 @@ before_script:
184184

185185
script:
186186
- test $SOLC_EMSCRIPTEN != On || (scripts/test_emscripten.sh)
187-
- test $? == 0 || SOLC_STOREBYTECODE=Off
188187
- test $SOLC_DOCS != On || (scripts/docs.sh)
189188
- test $SOLC_TESTS != On || (cd $TRAVIS_BUILD_DIR && scripts/tests.sh)
190-
- test $? == 0 || SOLC_STOREBYTECODE=Off
191189
- test $SOLC_STOREBYTECODE != On || (cd $TRAVIS_BUILD_DIR && scripts/bytecodecompare/storebytecode.sh)
192190

193191
deploy:

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include(EthPolicy)
88
eth_policy()
99

1010
# project name and version should be set after cmake_policy CMP0048
11-
set(PROJECT_VERSION "0.4.19")
11+
set(PROJECT_VERSION "0.4.20")
1212
project(solidity VERSION ${PROJECT_VERSION})
1313

1414
option(SOLC_LINK_STATIC "Link solc executable statically on supported platforms" OFF)
@@ -43,9 +43,10 @@ configure_project(TESTS)
4343
add_subdirectory(libdevcore)
4444
add_subdirectory(libevmasm)
4545
add_subdirectory(libsolidity)
46-
add_subdirectory(solc)
46+
add_subdirectory(libsolc)
4747

4848
if (NOT EMSCRIPTEN)
49+
add_subdirectory(solc)
4950
add_subdirectory(liblll)
5051
add_subdirectory(lllc)
5152
endif()

Changelog.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
1-
### 0.4.19 (unreleased)
1+
### 0.4.20 (unreleased)
22

33
Features:
4-
* Allow constant variables to be used as array length
4+
* Commandline interface: Support strict mode of assembly with the ``--strict--assembly`` switch.
5+
* Limit the number of warnings raised for creating abstract contracts.
6+
* Inline Assembly: Issue warning for using jump labels (already existed for jump instructions).
7+
* Inline Assembly: Support some restricted tokens (return, byte, address) as identifiers in Julia mode.
8+
* SMT Checker: If-else branch conditions are taken into account in the SMT encoding of the program
9+
variables.
10+
11+
Bugfixes:
12+
* Parser: Disallow event declarations with no parameter list.
13+
* Standard JSON: Populate the ``sourceLocation`` field in the error list.
14+
* Standard JSON: Properly support contract and library file names containing a colon (such as URLs).
15+
* Type Checker: Suggest the experimental ABI encoder if using ``struct``s as function parameters
16+
(instead of an internal compiler error).
17+
* Type Checker: Improve error message for wrong struct initialization.
18+
19+
### 0.4.19 (2017-11-30)
20+
21+
Features:
22+
* Code Generator: New ABI decoder which supports structs and arbitrarily nested
23+
arrays and checks input size (activate using ``pragma experimental ABIEncoderV2;``).
24+
* General: Allow constant variables to be used as array length.
25+
* Inline Assembly: ``if`` statement.
26+
* Standard JSON: Support the ``outputSelection`` field for selective compilation of target artifacts.
527
* Syntax Checker: Turn the usage of ``callcode`` into an error as experimental 0.5.0 feature.
628
* Type Checker: Improve address checksum warning.
729
* Type Checker: More detailed errors for invalid array lengths (such as division by zero).
8-
* Inline Assembly: ``if`` statement.
930

1031
Bugfixes:
1132

docs/abi-spec.rst

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ Given the contract:
190190
pragma solidity ^0.4.0;
191191

192192
contract Foo {
193-
function bar(bytes3[2] xy) {}
194-
function baz(uint32 x, bool y) returns (bool r) { r = x > 32 || y; }
195-
function sam(bytes name, bool z, uint[] data) {}
193+
function bar(bytes3[2] xy) public {}
194+
function baz(uint32 x, bool y) public returns (bool r) { r = x > 32 || y; }
195+
function sam(bytes name, bool z, uint[] data) public {}
196196
}
197197

198198

@@ -288,6 +288,8 @@ In effect, a log entry using this ABI is described as:
288288
- ``topics[n]``: ``EVENT_INDEXED_ARGS[n - 1]`` (``EVENT_INDEXED_ARGS`` is the series of ``EVENT_ARGS`` that are indexed);
289289
- ``data``: ``abi_serialise(EVENT_NON_INDEXED_ARGS)`` (``EVENT_NON_INDEXED_ARGS`` is the series of ``EVENT_ARGS`` that are not indexed, ``abi_serialise`` is the ABI serialisation function used for returning a series of typed values from a function, as described above).
290290

291+
For all fixed-length Solidity types, the ``EVENT_INDEXED_ARGS`` array contains the 32-byte encoded value directly. However, for *types of dynamic length*, which include ``string``, ``bytes``, and arrays, ``EVENT_INDEXED_ARGS`` will contain the *Keccak hash* of the encoded value, rather than the encoded value directly. This allows applications to efficiently query for values of dynamic-length types (by setting the hash of the encoded value as the topic), but leaves applications unable to decode indexed values they have not queried for. For dynamic-length types, application developers face a trade-off between fast search for predetermined values (if the argument is indexed) and legibility of arbitrary values (which requires that the arguments not be indexed). Developers may overcome this tradeoff and achieve both efficient search and arbitrary legibility by defining events with two arguments — one indexed, one not — intended to hold the same value.
292+
291293
JSON
292294
====
293295

@@ -333,10 +335,10 @@ For example,
333335
pragma solidity ^0.4.0;
334336

335337
contract Test {
336-
function Test(){ b = 0x12345678901234567890123456789012; }
338+
function Test() public { b = 0x12345678901234567890123456789012; }
337339
event Event(uint indexed a, bytes32 b);
338340
event Event2(uint indexed a, bytes32 b);
339-
function foo(uint a) { Event(a, b); }
341+
function foo(uint a) public { Event(a, b); }
340342
bytes32 b;
341343
}
342344

@@ -377,10 +379,14 @@ As an example, the code
377379

378380
::
379381

382+
pragma solidity ^0.4.19;
383+
pragma experimental ABIEncoderV2;
384+
380385
contract Test {
381386
struct S { uint a; uint[] b; T[] c; }
382387
struct T { uint x; uint y; }
383-
function f(S s, T t, uint a) { }
388+
function f(S s, T t, uint a) public { }
389+
function g() public returns (S s, T t, uint a) {}
384390
}
385391

386392
would result in the JSON:

docs/assembly.rst

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ arising when writing manual assembly by the following features:
2323

2424
* functional-style opcodes: ``mul(1, add(2, 3))`` instead of ``push1 3 push1 2 add push1 1 mul``
2525
* assembly-local variables: ``let x := add(2, 3) let y := mload(0x40) x := add(x, y)``
26-
* access to external variables: ``function f(uint x) { assembly { x := sub(x, 1) } }``
26+
* access to external variables: ``function f(uint x) public { assembly { x := sub(x, 1) } }``
2727
* labels: ``let x := 10 repeat: x := sub(x, 1) jumpi(repeat, eq(x, 0))``
2828
* loops: ``for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) }``
2929
* if statements: ``if slt(x, 0) { x := sub(0, x) }``
@@ -54,7 +54,7 @@ idea is that assembly libraries will be used to enhance the language in such way
5454
pragma solidity ^0.4.0;
5555
5656
library GetCode {
57-
function at(address _addr) returns (bytes o_code) {
57+
function at(address _addr) public returns (bytes o_code) {
5858
assembly {
5959
// retrieve the size of the code, this needs assembly
6060
let size := extcodesize(_addr)
@@ -83,15 +83,15 @@ you really know what you are doing.
8383
library VectorSum {
8484
// This function is less efficient because the optimizer currently fails to
8585
// remove the bounds checks in array access.
86-
function sumSolidity(uint[] _data) returns (uint o_sum) {
86+
function sumSolidity(uint[] _data) public returns (uint o_sum) {
8787
for (uint i = 0; i < _data.length; ++i)
8888
o_sum += _data[i];
8989
}
9090
9191
// We know that we only access the array in bounds, so we can avoid the check.
9292
// 0x20 needs to be added to an array because the first slot contains the
9393
// array length.
94-
function sumAsm(uint[] _data) returns (uint o_sum) {
94+
function sumAsm(uint[] _data) public returns (uint o_sum) {
9595
for (uint i = 0; i < _data.length; ++i) {
9696
assembly {
9797
o_sum := add(o_sum, mload(add(add(_data, 0x20), mul(i, 0x20))))
@@ -100,7 +100,7 @@ you really know what you are doing.
100100
}
101101
102102
// Same as above, but accomplish the entire code within inline assembly.
103-
function sumPureAsm(uint[] _data) returns (uint o_sum) {
103+
function sumPureAsm(uint[] _data) public returns (uint o_sum) {
104104
assembly {
105105
// Load the length (first 32 bytes)
106106
let len := mload(_data)
@@ -388,7 +388,7 @@ changes during the call, and thus references to local variables will be wrong.
388388
389389
contract C {
390390
uint b;
391-
function f(uint x) returns (uint r) {
391+
function f(uint x) public returns (uint r) {
392392
assembly {
393393
r := mul(x, sload(b_slot)) // ignore the offset, we know it is zero
394394
}
@@ -447,31 +447,6 @@ will have a wrong impression about the stack height at label ``two``:
447447
three:
448448
}
449449
450-
This problem can be fixed by manually adjusting the stack height for the
451-
assembler - you can provide a stack height delta that is added
452-
to the stack height just prior to the label.
453-
Note that you will not have to care about these things if you just use
454-
loops and assembly-level functions.
455-
456-
As an example how this can be done in extreme cases, please see the following.
457-
458-
.. code::
459-
460-
{
461-
let x := 8
462-
jump(two)
463-
0 // This code is unreachable but will adjust the stack height correctly
464-
one:
465-
x := 9 // Now x can be accessed properly.
466-
jump(three)
467-
pop // Similar negative correction.
468-
two:
469-
7 // push something onto the stack
470-
jump(one)
471-
three:
472-
pop // We have to pop the manually pushed value here again.
473-
}
474-
475450
Declaring Assembly-Local Variables
476451
----------------------------------
477452

@@ -487,7 +462,7 @@ be just ``0``, but it can also be a complex functional-style expression.
487462
pragma solidity ^0.4.0;
488463
489464
contract C {
490-
function f(uint x) returns (uint b) {
465+
function f(uint x) public returns (uint b) {
491466
assembly {
492467
let v := add(x, 1)
493468
mstore(0x80, v)
@@ -599,7 +574,7 @@ Simply leave the initialization and post-iteration parts empty.
599574
x := add(x, mload(i))
600575
i := add(i, 0x20)
601576
}
602-
}
577+
}
603578
604579
Functions
605580
---------
@@ -738,7 +713,7 @@ We consider the runtime bytecode of the following Solidity program::
738713
pragma solidity ^0.4.0;
739714

740715
contract C {
741-
function f(uint x) returns (uint y) {
716+
function f(uint x) public returns (uint y) {
742717
y = 1;
743718
for (uint i = 0; i < x; i++)
744719
y = 2 * y;

docs/bugs_by_version.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,10 @@
397397
"bugs": [],
398398
"released": "2017-10-18"
399399
},
400+
"0.4.19": {
401+
"bugs": [],
402+
"released": "2017-11-30"
403+
},
400404
"0.4.2": {
401405
"bugs": [
402406
"ZeroFunctionSelector",

docs/common-patterns.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ become the new richest.
3636

3737
mapping (address => uint) pendingWithdrawals;
3838

39-
function WithdrawalContract() payable {
39+
function WithdrawalContract() public payable {
4040
richest = msg.sender;
4141
mostSent = msg.value;
4242
}
4343

44-
function becomeRichest() payable returns (bool) {
44+
function becomeRichest() public payable returns (bool) {
4545
if (msg.value > mostSent) {
4646
pendingWithdrawals[richest] += msg.value;
4747
richest = msg.sender;
@@ -52,7 +52,7 @@ become the new richest.
5252
}
5353
}
5454

55-
function withdraw() {
55+
function withdraw() public {
5656
uint amount = pendingWithdrawals[msg.sender];
5757
// Remember to zero the pending refund before
5858
// sending to prevent re-entrancy attacks
@@ -71,12 +71,12 @@ This is as opposed to the more intuitive sending pattern:
7171
address public richest;
7272
uint public mostSent;
7373

74-
function SendContract() payable {
74+
function SendContract() public payable {
7575
richest = msg.sender;
7676
mostSent = msg.value;
7777
}
7878

79-
function becomeRichest() payable returns (bool) {
79+
function becomeRichest() public payable returns (bool) {
8080
if (msg.value > mostSent) {
8181
// This line can cause problems (explained below).
8282
richest.transfer(msg.value);
@@ -157,6 +157,7 @@ restrictions highly readable.
157157
/// Make `_newOwner` the new owner of this
158158
/// contract.
159159
function changeOwner(address _newOwner)
160+
public
160161
onlyBy(owner)
161162
{
162163
owner = _newOwner;
@@ -171,6 +172,7 @@ restrictions highly readable.
171172
/// May only be called 6 weeks after
172173
/// the contract has been created.
173174
function disown()
175+
public
174176
onlyBy(owner)
175177
onlyAfter(creationTime + 6 weeks)
176178
{
@@ -191,6 +193,7 @@ restrictions highly readable.
191193
}
192194

193195
function forceOwnerChange(address _newOwner)
196+
public
194197
costs(200 ether)
195198
{
196199
owner = _newOwner;
@@ -310,6 +313,7 @@ function finishes.
310313

311314
// Order of the modifiers matters here!
312315
function bid()
316+
public
313317
payable
314318
timedTransitions
315319
atStage(Stages.AcceptingBlindedBids)
@@ -318,6 +322,7 @@ function finishes.
318322
}
319323

320324
function reveal()
325+
public
321326
timedTransitions
322327
atStage(Stages.RevealBids)
323328
{
@@ -332,20 +337,23 @@ function finishes.
332337
}
333338

334339
function g()
340+
public
335341
timedTransitions
336342
atStage(Stages.AnotherStage)
337343
transitionNext
338344
{
339345
}
340346

341347
function h()
348+
public
342349
timedTransitions
343350
atStage(Stages.AreWeDoneYet)
344351
transitionNext
345352
{
346353
}
347354

348355
function i()
356+
public
349357
timedTransitions
350358
atStage(Stages.Finished)
351359
{

0 commit comments

Comments
 (0)