Commit Graph

3196 Commits

Author SHA1 Message Date
Aiman Baharna
392b1872b3 docs: Disallow decimal literals with trailing dots
Currently the documentation suggests that a decimal literal can omit the
fractional part [1]:

> Decimal fractional literals are formed by a `.` with at least one
> number on one side. Examples include `1.`, `.1` and `1.3`.

However, commit ac68710 (May 30, 2018) disallowed trailing dots that are
not followed by a number [2].

Using decimal literals of the form `1.` will actually result in a
`ParserError` and so the docs should no longer recommend this form.

[1] https://docs.soliditylang.org/en/v0.8.15/types.html#rational-and-integer-literals
[2] ac68710789
2022-06-22 17:19:12 +01:00
Rohit Kumar Suman
9bc015071c
fix: Typo
Line 84!
By => With
to the them => to them
2022-06-19 11:56:03 +05:30
Femi Bolaji
d417fe135f
updated int assembly.rst (Sample program bug fix)
fixed for loop bug in VectorSum.sumPureAsm function at line 42
# updated { data := add(dataElementLocation, 0x20) } to ----->  { dataElementLocation := add(dataElementLocation, 0x20) }
 in order to update dataElementLocation after every iteration. (Hence ending the loop)
2022-06-17 10:48:48 +01:00
Daniel Kirchner
14d0776c94 Set release date for 0.8.15. 2022-06-15 15:08:24 +02:00
Daniel Kirchner
3f112280f8 Add warning comment to dangling references docs. 2022-06-15 14:52:37 +02:00
Daniel Kirchner
1cb8e17d94 Add documentation section about dangling references.
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
2022-06-15 12:51:24 +02:00
Daniel Kirchner
27822dbca7 Remove entry in IR breaking changes. 2022-06-14 18:27:52 +02:00
Daniel Kirchner
187f0f070d Some review suggestions. 2022-06-14 18:27:52 +02:00
Daniel Kirchner
91ff02b988 Changelog and buglist entries. 2022-06-14 18:26:16 +02:00
Kamil Śliwak
dccc06cc29
Merge pull request #13135 from ethereum/foreign-event-access-revert-and-selector-cleanup
Revert access to foreign events and clean up event/error selector tests/docs
2022-06-14 18:14:30 +02:00
Kamil Śliwak
1ab84bb361 Put the table with operator precedence in a separate file, included in both Operators and Cheatsheet 2022-06-14 14:41:41 +02:00
Kamil Śliwak
f323cb2ef5 Improve index entries for selectors, events and selfdestruct 2022-06-14 12:05:49 +02:00
Kamil Śliwak
7785f46efd Document the .selector member for errors 2022-06-14 12:05:49 +02:00
Daniel Kirchner
3015afc504 Change severity of inline assembly bug to medium. 2022-06-13 17:18:13 +02:00
Daniel Kirchner
94dd6d0671 Bug list entry draft.
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
2022-06-10 20:05:14 +02:00
Daniel Kirchner
01a794dd31
Merge pull request #13117 from ethereum/fixEmptyLinesInDocs
Remove all-whitespace lines from docs.
2022-06-09 15:41:47 +02:00
Mathias L. Baumann
cf1b9a5241
Merge pull request #13109 from sourabhxyz/develop
Fix commandline tests not detecting a snippet with a broken free function definition
2022-06-09 15:31:54 +02:00
Daniel Kirchner
4576333245 Remove all-whitespace lines from docs. 2022-06-09 15:00:03 +02:00
Denis T
811fa193af
Fix comment position in the voting example 2022-06-09 15:09:02 +03:00
sourabh.xyz
8405d167c1 using-for.rst: Fix free function visibility.
Example is incorrect in the sense that "Free functions" cannot have visibility specified.
2022-06-08 21:32:30 +02:00
Daniel Kirchner
f2c930588c
Merge pull request #13079 from uji/sort-grammer-rules
Sort grammar rules of SolidityLexer.g4
2022-06-08 12:55:59 +02:00
Prajwal Borkar
6061219641 Fix link to the optimizer step sequence in optimizer.rst 2022-05-31 15:41:22 +02:00
uji
5f6f353953 Sort grammer rules of SolidityLexer.g4 2022-05-30 00:15:48 +09:00
shady41
ecb7c0b008 Moved operator precedence from the cheatsheet to the operator docs 2022-05-25 23:07:51 +02:00
Dustin Alandzes
10c991c3ff
expect -> except in docs/contributing.rst 2022-05-24 23:14:21 -05:00
chriseth
f0e43921f7
Merge pull request #12921 from ethereum/add_event_and_error_selector_fields_on_the_line_of_function_selector_field
Adding event and error selector fields
2022-05-23 11:34:13 +02:00
nishant-sachdeva
d4c06d2b4e Adding event and error selector fields on the lines of the function selector fields 2022-05-23 10:49:16 +02:00
Josep M Sobrepere
5575bb9d99
nit: ABI docs use canonical representation 2022-05-21 23:29:25 +02:00
Samuel Osewa
2dee5dcfae Removed notes section 2022-05-20 15:41:35 +02:00
chriseth
0bd0bf4c7d Set release date. 2022-05-17 13:50:26 +02:00
chriseth
f427247993 Bug list entry. 2022-05-17 13:04:06 +02:00
alpharush
93755fcb70
document that pop does not return last element
It's already documented for push and this would clarify my incorrect assumption (that pop returns a value as in other languages) that caused confusion with https://github.com/ethereum/solidity/issues/13017
2022-05-13 09:45:55 -05:00
Daniel Kirchner
aafda389ea
Merge pull request #12907 from ethereum/calldataReencodeValidationBug
Calldatasize-check during ABI encoding from calldata values with nested dynamic arrays.
2022-05-12 17:56:44 +02:00
Leo Alt
2fe143f7d0 add changelog entry and docs note 2022-05-12 13:43:28 +02:00
Daniel Kirchner
352a3c5f4b Bug list entry, changelog entry and tests. 2022-05-12 13:08:30 +02:00
Florian Sey
c7d57031b5 Improve wording on voting example
From a beginner perspective, it is the first time in the documentation
that the term wallets is used. Other terms such as accounts or addresses
are explained in the Introduction to smart contracts.
2022-05-06 01:01:37 +02:00
Nobuhiko Otoba
f6c0edc902 Add a require statement to the Ballot contract 2022-04-30 12:51:59 +02:00
aathan
43ff61f185
Update functions.rst 2022-04-15 12:24:48 -07:00
Kamil Śliwak
e684b36b25
Merge pull request #12908 from tharun634/move-docs
Moved `docs.sh` script to `docs/`
2022-04-11 13:51:05 +02:00
sourabh.xyz
9867fbcfb0
Update inheritance.rst
Fixed typo 'owned' → 'Owned'.
2022-04-09 13:17:07 +05:30
Kamil Śliwak
23e77e9a84 docs.sh: Fail on all errors, includding undefined variables and failures in piped commands 2022-04-08 20:41:31 +02:00
Kamil Śliwak
efd0024853 docs.sh: Make the script independent of the working directory 2022-04-08 20:41:31 +02:00
Tharun K
a608bc12f7 Moved docs.sh script to docs/ 2022-04-08 20:41:22 +02:00
chriseth
22d8c0aecd Some updates to gas and delegatecall. 2022-04-07 21:34:36 +02:00
Kamil Śliwak
e340cf6ca2
Merge pull request #12876 from aathan/why-is-this-inline-assembly-not-memory-safe
[Docs] clarify the reason for the memory-unsafe assembly example being unsafe
2022-04-07 18:41:41 +02:00
aathan
9e2b26e046 Clarify the reason for the memory-unsafe assembly example being unsafe 2022-04-07 18:03:02 +02:00
Kamil Śliwak
0dd7f9c871
Merge pull request #12901 from aathan/clarify-base-contract-constructors
Clarify base contract constructors (re request of PR #12872)
2022-04-07 13:33:05 +02:00
andreb0x
60416120af Update introduction-to-smart-contracts.rst
modifying "write" to "transactions"
2022-04-07 10:05:46 +05:30
andreb0x
39f3175a37 updates to gas section
small modifications for clarity

updates to delegatecall

Update introduction-to-smart-contracts.rst

modifying "write" to "transactions"

updates to gas section

small modifications for clarity

Update introduction-to-smart-contracts.rst

modifying "write" to "transactions"

updates to gas section

small modifications for clarity

updates to delegatecall
2022-04-07 10:05:46 +05:30
aathan
fd0df0b05d
Update inheritance.rst 2022-04-05 12:19:59 -07:00
aathan
6f4844648f abstract-contracts.rst: Clarify when a contract may or must be marked abstract 2022-04-04 14:21:49 +02:00
aathan
54fa215885
Update mapping-types.rst
typo
2022-03-23 17:15:17 -07:00
aathan
07c9384b44
Update value-types.rst 2022-03-22 23:06:23 -07:00
Hector Roussille
040c444a2a Fixed ambiguity in the create2 address computation doc
specify that arguments are encoded using abi.encode in the example code
2022-03-16 19:56:11 +01:00
chriseth
1be21e2670 Move state variable initialization to top. 2022-03-16 12:23:23 +01:00
chriseth
acd488532d Set release date. 2022-03-16 10:28:40 +01:00
chriseth
0bc29f2cb5 Using for at file level. 2022-03-15 12:07:28 +01:00
chriseth
c6ac1625bd
Merge pull request #12773 from ethereum/encodeCallBug
Fix encodeCall bug.
2022-03-15 10:52:13 +01:00
Daniel Kirchner
8cb01a9953 Fix and updated test. 2022-03-15 10:23:09 +01:00
Daniel Kirchner
353759c1d4
Merge pull request #12680 from devtooligan/fix/underscore-prefix
fix: corrects _ prefixes
2022-03-14 22:58:42 +01:00
chriseth
9188519f11 Using for with global binding. 2022-03-14 17:39:14 +01:00
Richie
beb51068bb
fix: corrects _ prefixes 2022-03-14 08:03:10 -07:00
Daniel Kirchner
e58c0b561d Mark viaIR code generation as non-experimental. 2022-03-14 14:48:00 +01:00
hrkrshnn
672951ccc7 Extend using-for. 2022-03-14 12:33:44 +01:00
nishant-sachdeva
b7a9daa2f8 Generate warning when rational numbers are converted to their mobile type without explicit requests 2022-03-14 14:04:46 +05:30
chriseth
356c83ad8e
Merge pull request #12763 from kanedaaaa/develop
doc: improve explanation of interfaces
2022-03-10 08:45:21 +01:00
kanedaaaa
1b93db7863 doc: improve explanation of interfaces 2022-03-09 18:35:14 +01:00
Daniel Kirchner
b57e856426 Adjust documentation. 2022-03-09 17:53:28 +01:00
chriseth
145186f68c
Merge pull request #12723 from ethereum/docs-translation-updates
[DOCS] Updated translation links / rewording of language influences
2022-03-07 18:09:29 +01:00
franzihei
4d9a078798 updates index with language links 2022-03-07 13:05:00 +01:00
chriseth
57e012da98
Merge pull request #12663 from ethereum/assemblyAnnotationDialectString
Assembly annotation as memory-safe using assembly flags.
2022-03-07 13:03:08 +01:00
chriseth
4f19d68ee9
Merge pull request #12620 from ethereum/assemblyAnnotation
Memory-safety annotation for inline assembly.
2022-03-07 12:48:41 +01:00
Leo
7c91dd05a7
Merge pull request #12741 from david-k/develop
[Doc] Fix leftover use of divModWithSlacks
2022-03-07 10:12:47 +01:00
Daniel Kirchner
198b705361
Merge pull request #12721 from ethereum/fixIterableMapping
Fix iterable mapping example.
2022-03-04 15:27:56 +01:00
david-k
cb4ffbfbb7
Fix leftover use of divModWithSlacks in doc
The option `divModWithSlacks` was previously changed to `divModNoSlacks`.
However, this was not reflected in the documentation.
2022-03-04 11:02:54 +01:00
Daniel Kirchner
46d8611e90 Adjust grammar. 2022-03-02 17:07:11 +01:00
Daniel Kirchner
0381de54c2 Update docs. 2022-03-02 17:07:11 +01:00
Daniel Kirchner
62a997ac97 Documentation. 2022-03-02 16:42:28 +01:00
chriseth
466251b5a0
Merge pull request #12689 from callezenwaka/develop
Fix typos on doc
2022-02-28 19:04:03 +01:00
Callis Ezenwaka
5134dafb8e Update typo in using-for.rst
Update typo in using-for.rst
2022-02-28 19:03:13 +01:00
chriseth
fb7cdda891 Fix iterable mapping example. 2022-02-28 17:57:19 +01:00
chriseth
5a94a7c9be
Merge pull request #12698 from Abdulkarim4u/develop
fixed grammar on doc.
2022-02-28 12:40:01 +01:00
Richie
49f06dacdf fix: remove lower_case_with_underscores and Capitalized_Words_With_Underscores from code examples 2022-02-21 10:53:35 -08:00
Abdul Karim Moro
2834003848
fixed grammar on doc.
If readers can gain additional pieces of  information on smart contracts, then  "more details" should be correct.
2022-02-19 08:31:26 +09:00
Wes Bouaziz
e9cc45b258
Fixing a typo in doc's EVM dialect in Yul's doc.
It's the tiniest typo but it's visible on the website.
2022-02-17 10:57:28 +01:00
Richie
635ca409f8 fix: shorten line length per code review 2022-02-16 12:06:33 -08:00
Sleepy
59f28d385a Added solidity visual auditor for VSCode 2022-02-16 11:05:41 +01:00
chriseth
49bc8206f1 Set release date. 2022-02-16 09:49:14 +01:00
Richie
e2d87c1bcc tweak: expand definition of suggested collision naming convention 2022-02-15 19:35:11 -08:00
William Entriken
9d94870770 Fix typos 2022-02-15 19:17:05 -05:00
chriseth
7a5be4a063
Merge pull request #12462 from semaraugusto/develop
[docs] fix issue with delegating votes to wallets who cannot vote.
2022-02-15 09:27:33 +01:00
Aleksey Bykhun
408b8e2f76 docs: note on invalid SPDX UNLICENSED
https://github.com/ethereum/solidity/issues/12251
2022-02-14 20:07:36 +01:00
Daniel Kirchner
88f624c352
Merge pull request #12660 from amsavarthan/patch-1
Highlighted "revert" command
2022-02-14 11:40:47 +01:00
Laurent
1188795449
Solve issue 12658 ; Solving wrong syntax.
Solve this issue : https://github.com/ethereum/solidity/issues/12658
2022-02-13 17:32:09 +01:00
Amsavarthan Lv
e3ebcd63cf
Highlighted "revert" command
When reading through the documentation, I found that highlighting was missed for the revert command and added that.
2022-02-13 15:17:37 +05:30
nishant-sachdeva
276851ff91 Added support for FunctionType::Kind::StringConcat and functions string.concat 2022-02-10 22:08:47 +05:30
William Entriken
c6c7f3525d Note about storage compatability mode 2022-02-09 21:30:11 -05:00
Kamil Śliwak
122ad0770a
Merge pull request #12632 from a3d4/symlinks-on-windows
Clarify symlink handling on Windows
2022-02-08 13:16:24 +01:00
chriseth
d744c0d617
Merge pull request #12637 from Hakeemmidan/patch-1
Update docs/cheatsheet.rst
2022-02-07 13:04:43 +01:00
chriseth
a9b9170a1b
Merge pull request #12636 from fulldecent/patch-25
Fix signature of pop member
2022-02-07 13:03:51 +01:00
Naveen Sahu
2e2094ad82 plain address can be sent Ether too
The docs state that a plain `address` cannot be sent Ether. But even though `send` and `transfer` members are not available for plain `address`, the `call` is. And `call` can be invoked upon a plain `address` type to send Ether to the address.

For instance, the `someone` (`address` type) can be sent Ether by invoking `sendSomeone()` method in the following `Dummy` contract:

```
contract Dummy {
    address someone = 0xAb8...cb2;

    function balanceOf(address addr) public view returns (uint) {
        return addr.balance;
    }

    function sendToSomeone() public payable returns (bool) {
        (bool sent, ) = someone.call{value: msg.value}("");
        return sent;
    }
}
```
2022-02-07 12:44:21 +01:00
Hakeem Almidan
c3145979fc
Update cheatsheet.rst
Add more description to the bullet point of 'block.timestamp' (under 'Global Variables')
2022-02-06 20:16:04 +03:00
William Entriken
6bd38aa4ef
Fix signature of pop member 2022-02-05 23:59:09 -05:00
a3d4
7634fc4ea9 Clarify symlink handling on Windows 2022-02-05 03:44:54 +01:00
Ayush Shukla
653c1e6842
Fix slot calculation for bytes/string mapping 2022-02-05 01:00:27 +05:30
Kamil Śliwak
93d5b79e5c
Merge pull request #12599 from ethereum/docs-resources
[DOCS] Adding a few resources to resources section
2022-02-04 15:06:34 +01:00
William Entriken
dcaa094f1f Add NatSpec note for libraries 2022-02-02 18:11:14 -05:00
franzihei
8bcc4ee7d1 Adding a few resources 2022-01-31 20:21:42 +01:00
chriseth
8728971354
Correct type of address.code 2022-01-31 19:07:01 +01:00
Nikita Stupin
0f7b69432e Separate visibility for state variables and functions 2022-01-29 00:36:06 +01:00
Kamil Śliwak
f386ed28a0
Merge pull request #12592 from Younghoon-Lee/Fix/style-guide
Add blank line to make it consistency
2022-01-29 00:07:19 +01:00
Younghoon-Lee
95f9289f2c Add blank line to make it consistency 2022-01-28 01:11:35 +09:00
William Entriken
8c6f80aa03 Document our version policy w/r/t SemVer 2022-01-27 09:45:31 -05:00
Markus Waas
8bfc9ad829 Add msg.sig to cheatsheet 2022-01-24 10:21:01 +01:00
Bruno Barbieri
9a13917049
Add modifiers to the order of layout 2022-01-20 20:20:30 -05:00
Daniel Kirchner
79e9d619a3
Merge pull request #12545 from ethereum/yulGrammarFluke
Allow builtins in yul identifier paths in antlr grammar.
2022-01-17 20:42:14 +01:00
Daniel Kirchner
2d0f6278bb Allow builtins as yul identifier paths in antlr grammar. 2022-01-17 18:42:54 +01:00
Daniel Kirchner
776c984cb0 Adjust documentation for linux packages not maintained by us. 2022-01-17 16:10:39 +01:00
William Entriken
78f0be56c3 Document address members code and codehash 2022-01-13 01:20:45 -05:00
Harikrishnan Mulackal
eee30b6ead
Merge pull request #12504 from brien-tech/patch-1
Fixing typo in "smart contracts"
2022-01-10 13:43:23 +05:30
Brien
790e7f42a1
Fixing typo in "smart contracts" 2022-01-10 02:29:51 -05:00
Mohamed Safouen Bouabid
4c20821e6d Explaining payable(msg.sender)
At this point of the documentation a new Solidity learner will not understand this line without further explanation:
if (!payable(msg.sender).send(amount)) {
It should explain how msg.sender is of type "address" and not "address payable" so it cannot send or receive Ether. Therefore it must be explicitly converted to payable.
2022-01-10 12:49:30 +05:30
Esquith Allen
b1ef5de496 fix typo 2022-01-05 21:58:41 -05:00
chriseth
c16867cb83
Merge pull request #12272 from ethereum/equalStoreEliminator
Equal store eliminator.
2022-01-05 11:24:59 +01:00
William Entriken
c798ac472e Typo: SemVer 2022-01-04 18:59:40 -05:00
Daniel Kirchner
cac0f203a2
Merge pull request #12467 from ethereum/fixMappingExample
Fix mapping example.
2022-01-04 18:23:57 +01:00
Braden Watling
bb16c1943c Fix gas retaining statement.
According to https://docs.soliditylang.org/en/v0.8.11/introduction-to-smart-contracts.html?highlight=63%2F64#message-calls, the caller forwards 63/64th of its gas, but here we seem to contradict that by saying the caller retains 63/64th of its gas.
2022-01-04 11:10:31 +01:00
Braden Watling
6fe1ee6a8a
Fix typo in control-structures.rst
I'm learning Solidity by reading these docs and found this statement confusing. I'm fairly certain that the correct description here is that the *callee* changes get reverted, but the caller is able to react to the failures.

I tested this with the following snippet in Remix, which resulted in a successful transaction when deployed:

```
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.7;

contract A {
    uint public value;

    function a(uint newValue, bool shouldRevert) external {
        value = newValue;
        if (shouldRevert) {
            revert();
        }
    }
}

contract B {
    function b() external {
        A a = new A();
        try a.a(50, false) {
            assert(a.value() == 50);
        } catch {
            assert(false);
        }
        a = new A();
        try a.a(50, true) {
            assert(false);
        } catch {
            assert(a.value() == 0);
        }
    }
}
```
2022-01-03 17:22:23 -05:00
chriseth
b354c81a63 Documentation 2022-01-03 15:52:05 +01:00
chriseth
57474917a0 Clarify which functions are added. 2022-01-03 15:38:39 +01:00
Pranay Reddy
f30130888e Added specificity to data location.
Added the specificity that bytes1[] and bytes differ because of padding only in memory data location. Added extra sentence that they are similar when used in storage data location.
2022-01-03 12:47:51 +05:30
chriseth
0010027e17 Fix mapping example. 2021-12-30 15:28:09 +01:00
Franziska Heintel
4456eeb6bb
[DOCS] update contributing section meeting link 2021-12-29 16:06:05 +01:00
Semar Augusto
6fbfa33486
Update docs/examples/voting.rst
Co-authored-by: Bhargava Shastry <bshastry@ethereum.org>
2021-12-29 07:04:13 -03:00
semaraugusto
942a3301dc fix issue with delegating votes to people who cannot vote. That made it so that if wallet A delegated to wallet B and B had no rights to vote, than B would lose out on its own vote 2021-12-29 00:17:15 -03:00
Kamil Śliwak
dece5f4de2 pylint: Enable and fix redefined-builtin warnings 2021-12-21 15:30:11 +01:00
Kamil Śliwak
5b10ff1216 pylint: Enable and fix singleton-comparison warnings 2021-12-21 15:30:11 +01:00
chriseth
25a3bf2df0 Set release date. 2021-12-20 13:15:58 +01:00
GitHubPang
1b0cef4624
Fix a few typos 2021-12-20 10:56:39 +08:00
Marenz
7a96953e78 Implement typechecked abi.encodeCall() 2021-12-16 17:35:58 +01:00
chriseth
c15ef45d29 Explanation about operators. 2021-12-15 18:37:18 +01:00
Alessandro Coglio
d17f7206ad Improve description of break/continue restrictions.
This is as discussed on Element, with enhancements discussed with @cameel.
2021-12-13 21:59:25 -08:00
dinah
f0aadcf577 Remove stale link. 2021-12-13 12:04:23 +01:00
Omkar Nikhal
01d45a1952 Remove redundant typo 2021-12-13 11:36:07 +01:00
chriseth
d414153258 Some clarifications on literals. 2021-12-06 17:36:34 +01:00
minami
6bafeca8a2 Fix yul 2021-12-05 16:58:03 +09:00
minami
907405e2e0 Fix units-and-global-variables 2021-12-05 16:57:59 +09:00
minami
25a26d2f8b Fix cheatsheet 2021-12-05 16:57:48 +09:00
Saska Karsi
105de2561a
rm trailing comma in style-guide.rst example 2021-12-03 01:11:04 +02:00
chriseth
829fe6615b Fix Yul example. 2021-12-01 16:23:26 +01:00