Skip to content

chore: use toplevel out/ for importing Morpho bytecode#388

Merged
adhusson merged 11 commits intomainfrom
chore/toplevel-bytecode-import
Jan 12, 2024
Merged

chore: use toplevel out/ for importing Morpho bytecode#388
adhusson merged 11 commits intomainfrom
chore/toplevel-bytecode-import

Conversation

@adhusson
Copy link
Copy Markdown
Collaborator

@adhusson adhusson commented Jan 8, 2024

Fixes the following issue : after a fresh checkout, forge test fails. The relevant trace portion is:

├─ [0] VM::getCode("lib/morpho-blue/out/Morpho.sol/Morpho.json") [staticcall]
    │   └─ ← failed to read from "~/metamorpho/lib/morpho-blue/out/Morpho.sol/Morpho.json": No such file or directory (os error 2)

The current fix is to cd lib/morpho-blue; forge build; cd ../.., and to do it again after any change to the local Morpho.sol.

This PR uses foundry's multiple compiler version support to compile Morpho separately. No more need to build inside the lib/morpho-blue dir to get the Morpho bytecode.

Important: Morpho's solidity version will be used, but metamorpho's optimization settings will be used.

@adhusson adhusson requested review from QGarchery and Rubilmax January 8, 2024 17:29
Copy link
Copy Markdown
Contributor

@QGarchery QGarchery left a comment

Choose a reason for hiding this comment

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

Nice !

Comment thread src/mocks/MorphoImport.sol
Comment thread src/mocks/MorphoImport.sol Outdated
Comment thread src/mocks/MorphoImport.sol Outdated
Comment thread test/forge/helpers/BaseTest.sol Outdated
Comment thread src/mocks/MorphoImport.sol
adhusson and others added 2 commits January 8, 2024 20:24
Co-authored-by: Quentin Garchery <QGarchery@users.noreply.github.com>
Signed-off-by: Adrien Husson <adhusson@gmail.com>
adhusson and others added 2 commits January 9, 2024 10:30
Co-authored-by: Quentin Garchery <QGarchery@users.noreply.github.com>
Signed-off-by: Adrien Husson <adhusson@gmail.com>
@adhusson
Copy link
Copy Markdown
Collaborator Author

adhusson commented Jan 9, 2024

Updated hardhat config by adding a compiler. Hardhat will select the highest compiler version compatible with the pragma in each instance.

FYI you could also be more specific and do the following:

overrides: {
      "src/mocks/MorphoImport.sol": {
          version: "0.8.19",
          settings: ...
      }
}

Comment thread hardhat.config.ts Outdated
Comment thread hardhat.config.ts Outdated
Comment thread hardhat.config.ts Outdated
Comment thread hardhat.config.ts Outdated
@adhusson adhusson merged commit b321671 into main Jan 12, 2024
@adhusson adhusson deleted the chore/toplevel-bytecode-import branch January 12, 2024 22:48
Copy link
Copy Markdown
Contributor

@MathisGD MathisGD left a comment

Choose a reason for hiding this comment

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

LGTM

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.

6 participants