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

Compile multiple contracts in single module. #197

Merged
merged 1 commit into from
Jan 25, 2021

Conversation

g-r-a-n-t
Copy link
Member

@g-r-a-n-t g-r-a-n-t commented Jan 20, 2021

What was wrong?

We were only able to compile the first contract in a module.

How was it fixed?

  • Updated the compiler module internals and API to handle multiple contracts.
  • Updated the contract testing harness and added a test for a module with two separate contracts.
  • Updated the CLI. We now write the following to the output directory:
output
|-- Bar
|   |-- Bar.bin
|   |-- Bar_abi.json
|   `-- Bar_ir.yul
|-- Foo
|   |-- Foo.bin
|   |-- Foo_abi.json
|   `-- Foo_ir.yul
|-- module.ast
`-- module.tokens

To-Do

  • OPTIONAL: Update Spec if applicable

  • Add entry to the release notes (may forgo for trivial changes)

  • Clean up commit history

@g-r-a-n-t g-r-a-n-t marked this pull request as draft January 20, 2021 02:02
@codecov-io
Copy link

codecov-io commented Jan 22, 2021

Codecov Report

Merging #197 (96c5a10) into master (98f20e2) will decrease coverage by 0.46%.
The diff coverage is 27.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #197      +/-   ##
==========================================
- Coverage   77.96%   77.50%   -0.47%     
==========================================
  Files          45       47       +2     
  Lines        3300     3308       +8     
==========================================
- Hits         2573     2564       -9     
- Misses        727      744      +17     
Impacted Files Coverage Δ
compiler/src/abi/elements.rs 67.34% <ø> (-7.31%) ⬇️
compiler/src/abi/mod.rs 0.00% <0.00%> (ø)
compiler/src/lib.rs 0.00% <0.00%> (ø)
compiler/src/yul/mod.rs 0.00% <0.00%> (ø)
semantics/src/errors.rs 4.54% <0.00%> (-0.22%) ⬇️
compiler/src/abi/builder.rs 90.74% <78.57%> (+0.08%) ⬆️
compiler/src/abi/utils.rs 71.42% <0.00%> (-10.39%) ⬇️
semantics/src/traversal/expressions.rs 69.95% <0.00%> (-3.61%) ⬇️
semantics/src/traversal/functions.rs 35.59% <0.00%> (-2.51%) ⬇️
semantics/src/namespace/events.rs 92.30% <0.00%> (-2.14%) ⬇️
... and 11 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 98f20e2...96c5a10. Read the comment docs.

compiler/src/lib.rs Outdated Show resolved Hide resolved
compiler/src/lib.rs Outdated Show resolved Hide resolved
compiler/src/abi/mod.rs Show resolved Hide resolved
compiler/src/abi/elements.rs Show resolved Hide resolved
compiler/src/types.rs Show resolved Hide resolved
@g-r-a-n-t g-r-a-n-t force-pushed the multiple-contracts branch 2 times, most recently from 28f86a9 to 77b96c9 Compare January 23, 2021 00:38
@g-r-a-n-t g-r-a-n-t marked this pull request as ready for review January 23, 2021 00:40
Copy link
Collaborator

@cburgdorf cburgdorf left a comment

Choose a reason for hiding this comment

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

Looks good. One question I have is whether this removes support for generating YUL code when the YUL code is faulty which would be a bit sad since I find it quite helpful during development.

E.g. with the current compiler one can compile fe foo.fe --emit yul even if fe foo.fe wouldn't work because the yul -> binary compilation errors. This is helpful to generate and inspect the faulty YUL code that leads to the compilation failure.

newsfragments/197.feature.md Show resolved Hide resolved
src/main_full.rs Show resolved Hide resolved
@g-r-a-n-t g-r-a-n-t merged commit e108a74 into ethereum:master Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants