Skip to content

Commit 364da42

Browse files
authored
Merge pull request #1622 from ethereum/develop
Solidity version 0.4.9
2 parents 60cc166 + 7b18c9d commit 364da42

Some content is hidden

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

66 files changed

+2362
-899
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
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.8")
11+
set(PROJECT_VERSION "0.4.9")
1212
project(solidity VERSION ${PROJECT_VERSION})
1313

1414
# Let's find our dependencies

Changelog.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
### 0.4.9 (2017-01-31)
2+
3+
Features:
4+
* Compiler interface: Contracts and libraries can be referenced with a ``file:`` prefix to make them unique.
5+
* Compiler interface: Report source location for "stack too deep" errors.
6+
* AST: Use deterministic node identifiers.
7+
* Inline assembly: introduce ``invalid`` (EIP141) as an opcode.
8+
* Type system: Introduce type identifier strings.
9+
* Type checker: Warn about invalid checksum for addresses and deduce type from valid ones.
10+
* Metadata: Do not include platform in the version number.
11+
* Metadata: Add option to store sources as literal content.
12+
* Code generator: Extract array utils into low-level functions.
13+
* Code generator: Internal errors (array out of bounds, etc.) now cause a reversion by using an invalid
14+
instruction (0xfe - EIP141) instead of an invalid jump. Invalid jump is still kept for explicit throws.
15+
16+
Bugfixes:
17+
* Code generator: Allow recursive structs.
18+
* Inline assembly: Disallow variables named like opcodes.
19+
* Type checker: Allow multiple events of the same name (but with different arities or argument types)
20+
* Natspec parser: Fix error with ``@param`` parsing and whitespace.
21+
122
### 0.4.8 (2017-01-13)
223

324
Features:

cmake/scripts/buildinfo.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ if (SOL_COMMIT_HASH AND SOL_LOCAL_CHANGES)
6060
set(SOL_COMMIT_HASH "${SOL_COMMIT_HASH}.mod")
6161
endif()
6262

63+
set(SOL_VERSION_COMMIT "commit.${SOL_COMMIT_HASH}")
64+
set(SOl_VERSION_PLATFORM ETH_BUILD_PLATFORM)
6365
set(SOL_VERSION_BUILDINFO "commit.${SOL_COMMIT_HASH}.${ETH_BUILD_PLATFORM}")
6466

6567
set(TMPFILE "${ETH_DST_DIR}/BuildInfo.h.tmp")

cmake/templates/BuildInfo.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@
88
#define ETH_BUILD_PLATFORM "@ETH_BUILD_PLATFORM@"
99
#define SOL_VERSION_PRERELEASE "@SOL_VERSION_PRERELEASE@"
1010
#define SOL_VERSION_BUILDINFO "@SOL_VERSION_BUILDINFO@"
11+
#define SOL_VERSION_COMMIT "@SOL_VERSION_COMMIT@"
12+
#define SOL_VERSION_PLATFORM "@SOL_VERSION_PLATFORM@"

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ def setup(sphinx):
4949

5050
# General information about the project.
5151
project = 'Solidity'
52-
copyright = '2016, Ethereum'
52+
copyright = '2016-2017, Ethereum'
5353

5454
# The version info for the project you're documenting, acts as replacement for
5555
# |version| and |release|, also used in various other places throughout the
5656
# built documents.
5757
#
5858
# The short X.Y version.
59-
version = '0.4.8'
59+
version = '0.4.9'
6060
# The full version, including alpha/beta/rc tags.
61-
release = '0.4.8-develop'
61+
release = '0.4.9-develop'
6262

6363
# The language for content autogenerated by Sphinx. Refer to documentation
6464
# for a list of supported languages.

docs/control-structures.rst

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ contract can be called internally.
104104
External Function Calls
105105
-----------------------
106106

107-
The expressions ``this.g(8);`` and ``c.g(2);`` (where ``g`` is a contract
107+
The expressions ``this.g(8);`` and ``c.g(2);`` (where ``c`` is a contract
108108
instance) are also valid function calls, but this time, the function
109109
will be called "externally", via a message call and not directly via jumps.
110110
Please note that function calls on ``this`` cannot be used in the constructor, as the
@@ -384,18 +384,23 @@ In the following example, we show how ``throw`` can be used to easily revert an
384384

385385
Currently, Solidity automatically generates a runtime exception in the following situations:
386386

387-
1. If you access an array at a too large or negative index (i.e. ``x[i]`` where ``i >= x.length`` or ``i < 0``).
388-
1. If you access a fixed-length ``bytesN`` at a too large or negative index.
389-
1. If you call a function via a message call but it does not finish properly (i.e. it runs out of gas, has no matching function, or throws an exception itself), except when a low level operation ``call``, ``send``, ``delegatecall`` or ``callcode`` is used. The low level operations never throw exceptions but indicate failures by returning ``false``.
390-
1. If you create a contract using the ``new`` keyword but the contract creation does not finish properly (see above for the definition of "not finish properly").
391-
1. If you divide or modulo by zero (e.g. ``5 / 0`` or ``23 % 0``).
392-
1. If you shift by a negative amount.
393-
1. If you convert a value too big or negative into an enum type.
394-
1. If you perform an external function call targeting a contract that contains no code.
395-
1. If your contract receives Ether via a public function without ``payable`` modifier (including the constructor and the fallback function).
396-
1. If your contract receives Ether via a public accessor function.
397-
398-
Internally, Solidity performs an "invalid jump" when an exception is thrown and thus causes the EVM to revert all changes made to the state. The reason for this is that there is no safe way to continue execution, because an expected effect did not occur. Because we want to retain the atomicity of transactions, the safest thing to do is to revert all changes and make the whole transaction (or at least call) without effect.
387+
#. If you access an array at a too large or negative index (i.e. ``x[i]`` where ``i >= x.length`` or ``i < 0``).
388+
#. If you access a fixed-length ``bytesN`` at a too large or negative index.
389+
#. If you call a function via a message call but it does not finish properly (i.e. it runs out of gas, has no matching function, or throws an exception itself), except when a low level operation ``call``, ``send``, ``delegatecall`` or ``callcode`` is used. The low level operations never throw exceptions but indicate failures by returning ``false``.
390+
#. If you create a contract using the ``new`` keyword but the contract creation does not finish properly (see above for the definition of "not finish properly").
391+
#. If you divide or modulo by zero (e.g. ``5 / 0`` or ``23 % 0``).
392+
#. If you shift by a negative amount.
393+
#. If you convert a value too big or negative into an enum type.
394+
#. If you perform an external function call targeting a contract that contains no code.
395+
#. If your contract receives Ether via a public function without ``payable`` modifier (including the constructor and the fallback function).
396+
#. If your contract receives Ether via a public accessor function.
397+
#. If you call a zero-initialized variable of internal function type.
398+
399+
Internally, Solidity performs an "invalid jump" when a user-provided exception is thrown. In contrast, it performs an invalid operation
400+
(instruction ``0xfe``) if a runtime exception is encountered. In both cases, this causes
401+
the EVM to revert all changes made to the state. The reason for this is that there is no safe way to continue execution, because an expected effect
402+
did not occur. Because we want to retain the atomicity of transactions, the safest thing to do is to revert all changes and make the whole transaction
403+
(or at least call) without effect.
399404

400405
.. index:: ! assembly, ! asm, ! evmasm
401406

@@ -627,6 +632,8 @@ The opcodes ``pushi`` and ``jumpdest`` cannot be used directly.
627632
+-------------------------+------+-----------------------------------------------------------------+
628633
| selfdestruct(a) | `-` | end execution, destroy current contract and send funds to a |
629634
+-------------------------+------+-----------------------------------------------------------------+
635+
| invalid | `-` | end execution with invalid instruction |
636+
+-------------------------+------+-----------------------------------------------------------------+
630637
| log0(p, s) | `-` | log without topics and data mem[p..(p+s)) |
631638
+-------------------------+------+-----------------------------------------------------------------+
632639
| log1(p, s, t1) | `-` | log with topic t1 and data mem[p..(p+s)) |

docs/grammar.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ NumberUnit = 'wei' | 'szabo' | 'finney' | 'ether'
114114
| 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'years'
115115
HexLiteral = 'hex' ('"' ([0-9a-fA-F]{2})* '"' | '\'' ([0-9a-fA-F]{2})* '\'')
116116
StringLiteral = '"' ([^"\r\n\\] | '\\' .)* '"'
117-
Identifier = [a-zA-Z_] [a-zA-Z_0-9]*
117+
Identifier = [a-zA-Z_$] [a-zA-Z_$0-9]*
118118

119119
HexNumber = '0x' [0-9a-fA-F]+
120120
DecimalNumber = [0-9]+

docs/installing-solidity.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ you should fork Solidity and add your personal fork as a second remote:
119119
cd solidity
120120
git remote add personal git@github.com:[username]/solidity.git
121121
122+
Solidity has git submodules. Ensure they are properly loaded:
123+
124+
.. code:: bash
125+
126+
git submodule update --init --recursive
122127
123128
Prerequisites - macOS
124129
---------------------
@@ -211,6 +216,24 @@ Alternatively, you can build for Windows on the command-line, like so:
211216
212217
cmake --build . --config RelWithDebInfo
213218
219+
The version string in detail
220+
============================
221+
222+
The Solidity version string contains four parts:
223+
- the version number
224+
- pre-release tag, usually set to ``develop.YYYY.MM.DD`` or ``nightly.YYYY.MM.DD``
225+
- commit in the format of ``commit.GITHASH``
226+
- platform has arbitrary number of items, containing details about the platform and compiler
227+
228+
If there are local modifications, the commit will be postfixed with ``.mod``.
229+
230+
These parts are combined as required by Semver, where the Solidity pre-release tag equals to the Semver pre-release
231+
and the Solidity commit and platform combined make up the Semver build metadata.
232+
233+
A relase example: ``0.4.8+commit.60cc1668.Emscripten.clang``.
234+
235+
A pre-release example: ``0.4.9-nightly.2017.1.17+commit.6ecb4aa3.Emscripten.clang``
236+
214237
Important information about versioning
215238
======================================
216239

docs/types.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,19 @@ Fixed Point Numbers
171171

172172
**COMING SOON...**
173173

174+
.. index:: address, literal;address
175+
176+
.. _address_literals:
177+
178+
Address Literals
179+
----------------
180+
181+
Hexadecimal literals that pass the address checksum test, for example
182+
``0xdCad3a6d3569DF655070DEd06cb7A1b2Ccd1D3AF`` are of ``address`` type.
183+
Hexadecimal literals that are between 39 and 41 digits
184+
long and do not pass the checksum test produce
185+
a warning and are treated as regular rational number literals.
186+
174187
.. index:: literal, literal;rational
175188

176189
.. _rational_literals:

docs/utils/SolidityLexer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class SolidityLexer(RegexLexer):
5757
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
5858
r'throw|try|catch|finally|new|delete|typeof|instanceof|void|'
5959
r'this|import|mapping|returns|private|public|external|internal|'
60-
r'constant|memory|storage)\b', Keyword, 'slashstartsregex'),
60+
r'constant|memory|storage|payable)\b', Keyword, 'slashstartsregex'),
6161
(r'(var|let|with|function|event|modifier|struct|enum|contract|library)\b', Keyword.Declaration, 'slashstartsregex'),
6262
(r'(bytes|string|address|uint|int|bool|byte|' +
6363
'|'.join(
@@ -67,6 +67,7 @@ class SolidityLexer(RegexLexer):
6767
['ufixed%dx%d' % ((i), (j + 8)) for i in range(0, 256, 8) for j in range(0, 256 - i, 8)] +
6868
['fixed%dx%d' % ((i), (j + 8)) for i in range(0, 256, 8) for j in range(0, 256 - i, 8)]
6969
) + r')\b', Keyword.Type, 'slashstartsregex'),
70+
(r'(wei|szabo|finney|ether|seconds|minutes|hours|days|weeks|years)\b', Keyword.Type, 'slashstartsregex'),
7071
(r'(abstract|boolean|byte|char|class|const|debugger|double|enum|export|'
7172
r'extends|final|float|goto|implements|int|interface|long|native|'
7273
r'package|private|protected|public|short|static|super|synchronized|throws|'

0 commit comments

Comments
 (0)