Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Solidity 0.8.4 #33

Merged
merged 5 commits into from
Apr 30, 2021
Merged

Support for Solidity 0.8.4 #33

merged 5 commits into from
Apr 30, 2021

Conversation

blitz-1306
Copy link
Contributor

@blitz-1306 blitz-1306 commented Apr 27, 2021

Status

Ready. There is an issue with compiler release, that is not yet properly handled. However, I do not think that it blocks us from merge as compiler is already released so we would have to deal with it anyway. The onlything we can do is to explicitly throw an error when we meet a particular edge case.

Changes

  • Bumped dependency versions: web3-eth-abi to ^1.3.5, also development dependencies to use latest tools.
  • Added support for Solidity 0.8.4 release on compile level (solc@0.8.4).
  • Added support for Solidity 0.8.4 release on AST level:
    • Introduced new statement node RevertStatement.
    • Introduced new definition node ErrorDefinition.
    • Tweaked ContractDefinition:
      • Introduced usedErrors and vUsedErrors properties to track used errors.
      • Introduced vErrors property.
      • Tweaked constructor to accept additional required array argument for usedErrors (a breaking change).
    • Tweaked SourceUnit:
      • Tweaked ExportedSymbol type to also allow ErrorDefinitions (this also will affect imports, a breaking change).
      • Introduced vErrors property.
  • Updated NODE_LIST to mention new nodes.
  • Tweaked sanity checking logic to respect the changes.
  • Tweaked AST-to-source writing components to respect the changes (see Concerns section).
  • Tweaked ASTNodeFactory to respect the changes.
  • Tweaked related test suites and samples.

Concerns

I believe that YulHexStringLiterals are underworked in compiler:

  • I did not found a convenient way to distiguish common Yul string literal from YulHexStringLiteral. Due to this, it is really hard to make a decision how to write any string literals (common string or hex). The Solidity AST have Literal.kind, that allows to determine how to write node properly, but Yul does not.
  • I did not found a proper solution to analyze YulHexStringLiteral content values to write them as hex"" and get same output, as input was. Maybe there is something happening during JSON serialization/deserialization, that causes content fragmentation. The most stable approach I recall produces something, that is different from expectations (see the original source).

I created a related issue in Solidity repository to figure out how to solve this.

Notes

  • This PR causes backward incompatibility due to changes in node constructor signatures (ContractDefinition) and arguments for ASTNodeFactory methods.
  • The legacy AST reading is adjusted just to not crash. It is only in maintenance mode until further notifications. New functionality is undefined by default of legacy AST nodes and related processing logic.

Related links

Regards.

@blitz-1306 blitz-1306 added the enhancement New feature or request label Apr 27, 2021
…lues to avoid edge-cases with special characters and escap sequences.
@codecov-commenter
Copy link

codecov-commenter commented Apr 30, 2021

Codecov Report

Merging #33 (d5e3595) into master (709043c) will increase coverage by 0.00%.
The diff coverage is 92.40%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #33   +/-   ##
=======================================
  Coverage   92.82%   92.83%           
=======================================
  Files         208      212    +4     
  Lines        4184     4257   +73     
  Branches      596      603    +7     
=======================================
+ Hits         3884     3952   +68     
- Misses        186      188    +2     
- Partials      114      117    +3     
Impacted Files Coverage Δ
src/ast/legacy/contract_definition_processor.ts 94.44% <ø> (ø)
...cessing/structured_documentation_reconstruction.ts 100.00% <ø> (ø)
src/ast/ast_node_factory.ts 71.52% <62.50%> (-0.01%) ⬇️
src/ast/modern/error_definition_processor.ts 80.00% <80.00%> (ø)
src/ast/sanity.ts 73.00% <92.30%> (+0.78%) ⬆️
.../implementation/declaration/contract_definition.ts 95.94% <100.00%> (+0.35%) ⬆️
...ast/implementation/declaration/error_definition.ts 100.00% <100.00%> (ø)
src/ast/implementation/declaration/index.ts 100.00% <100.00%> (ø)
src/ast/implementation/meta/source_unit.ts 100.00% <100.00%> (ø)
src/ast/implementation/statement/index.ts 100.00% <100.00%> (ø)
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 709043c...d5e3595. Read the comment docs.

@blitz-1306 blitz-1306 marked this pull request as ready for review April 30, 2021 04:36
@blitz-1306 blitz-1306 requested a review from cd1m0 April 30, 2021 04:36
Copy link
Contributor

@cd1m0 cd1m0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of nits, otherwise LGTM.

@blitz-1306 blitz-1306 requested a review from cd1m0 April 30, 2021 13:18
@cd1m0 cd1m0 merged commit 09d9365 into master Apr 30, 2021
@blitz-1306 blitz-1306 deleted the support-solidity-084 branch May 3, 2021 03:13
@blitz-1306 blitz-1306 mentioned this pull request May 3, 2021
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants