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

Contracts top level #422

Merged
merged 29 commits into from
Jul 31, 2024
Merged

Contracts top level #422

merged 29 commits into from
Jul 31, 2024

Conversation

cam-schultz
Copy link
Contributor

Why this should be merged

Converts the repo to be a top-level forge project. The new repo structure is as follows:

teleporter/
    lib/
    contracts/
        Teleporter/
        Utilities/
        Mocks/
    foundry.toml
    remappings.txt

contracts-monorepo is the staging branch for all changes related to #419

How this works

Reogranizes the repo into the above structure

How this was tested

CI

How is this documented

Updated paths in READMEs

Copy link
Contributor

@geoff-vball geoff-vball left a comment

Choose a reason for hiding this comment

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

Bindings checker has something failing. Otherwise LGTM

iansuvak
iansuvak previously approved these changes Jul 12, 2024
@cam-schultz cam-schultz requested a review from geoff-vball July 12, 2024 14:41
foundry.toml Outdated Show resolved Hide resolved
.gitmodules Outdated
Comment on lines 2 to 10
branch = v1
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
ignore = dirty
[submodule "lib/openzeppelin-contracts"]
branch = v4.8.1
[submodule "contracts/lib/subnet-evm"]
path = contracts/lib/subnet-evm
path = lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
ignore = dirty
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you mean to change the lib/forge-std branch and/or add the ignore = dirty flags here? Seems like just changing the paths would be sufficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When putting together this change, I noticed a few things:

  1. our forge-std submodule was using a different branch than openzeppelin-contract's submodule
  2. We weren't specifying a path to our forge-std submodule in remappings.txt

From what I could tell, this means that the exact forge-std version that's used is whatever one is found first when resolving include paths. To get around this, I added forge-std to remappings.txt explicitly, and updated our submodule to use the same version as openzeppelin-contracts

As for ignore = dirty, that is added as a developer convenience. I noticed that when playing with submodules it was quite easy to get to a state in which no submodule changes were made, but it was still showing as modified in git status. ignore = dirty shouldn't impact CI or fresh clones.

@cam-schultz cam-schultz changed the base branch from contracts-monorepo to main July 17, 2024 17:15
@cam-schultz cam-schultz dismissed iansuvak’s stale review July 17, 2024 17:15

The base branch was changed.

@cam-schultz cam-schultz added the DO NOT MERGE This PR is not meant to be merged in its current state label Jul 17, 2024
@cam-schultz cam-schultz requested a review from iansuvak July 26, 2024 17:19
.gitmodules Outdated Show resolved Hide resolved
@cam-schultz cam-schultz removed the DO NOT MERGE This PR is not meant to be merged in its current state label Jul 31, 2024
@@ -5,7 +5,7 @@

pragma solidity 0.8.25;

import {Test} from "forge-std/Test.sol";
import {Test} from "@forge-std/Test.sol";

Choose a reason for hiding this comment

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

did we need this change? I think this was working previously from the auto remappings, but we could consider turning auto remappings off to be more explicit

Choose a reason for hiding this comment

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

nvm I see that it's updated in remappings. If we're going to explicitly set it for forge-std that differs from the default, might want to consider turning off auto remapping detection

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was encountering a scenario where the auto remapping used open-zeppelin-contracts' forge-std instead of ours. IMO we should be explicit wherever possible to prevent this sort of ambiguity.

Choose a reason for hiding this comment

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

i'm in favor of copying the remappings we need, then disabling auto remapping detection

Copy link

@minghinmatthewlam minghinmatthewlam left a comment

Choose a reason for hiding this comment

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

mostly LGTM, left some comments

@@ -10,14 +10,6 @@ import {ITeleporterMessenger} from "@teleporter/ITeleporterMessenger.sol";
import {TeleporterMessenger} from "@teleporter/TeleporterMessenger.sol";

abstract contract GetTeleporterMessengerTest is BaseTeleporterRegistryAppTest {
function testGetTeleporterMessengerBasic() public {

Choose a reason for hiding this comment

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

was there a reason to move this

Choose a reason for hiding this comment

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

seems like a lint with the new version, did it hit a lint rule?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, the linter complained about public view functions being before public ones. solc was throwing warnings saying that this function could be marked view. I'm not sure what change prompted solc to start warning though.

@@ -5,7 +5,7 @@

pragma solidity 0.8.25;

import {Test} from "forge-std/Test.sol";
import {Test} from "@forge-std/Test.sol";

Choose a reason for hiding this comment

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

nvm I see that it's updated in remappings. If we're going to explicitly set it for forge-std that differs from the default, might want to consider turning off auto remapping detection

@minghinmatthewlam
Copy link

do we need to update .gitignore? For example I see contracts/doc but dk if we still use that at all.

@cam-schultz
Copy link
Contributor Author

do we need to update .gitignore? For example I see contracts/doc but dk if we still use that at all.

Let's continue ignoring generated docs from forge docs. I've updated the path to reflect the updated repo structure.

geoff-vball
geoff-vball previously approved these changes Jul 31, 2024
Copy link
Contributor

@geoff-vball geoff-vball left a comment

Choose a reason for hiding this comment

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

👍

Copy link

@minghinmatthewlam minghinmatthewlam left a comment

Choose a reason for hiding this comment

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

lgtm 🙌

Copy link
Collaborator

@michaelkaplan13 michaelkaplan13 left a comment

Choose a reason for hiding this comment

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

🚢

@cam-schultz cam-schultz merged commit e9b5f51 into main Jul 31, 2024
14 checks passed
@cam-schultz cam-schultz deleted the contracts-top-level branch July 31, 2024 20:09
@meaghanfitzgerald
Copy link
Contributor

Next time the file structures of any of the .mds change, pls ping @laviniat1996. These files are referenced by a plugin in the docs and when the path changes it causes the build of https://github.com/ava-labs/avalanche-docs to break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants