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
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ab29ee4
libs to top level
cam-schultz Jul 11, 2024
ba00a78
remove old libs
cam-schultz Jul 11, 2024
8612bb8
subnet-evm v0.6.2
cam-schultz Jul 11, 2024
5591ed8
update remappings
cam-schultz Jul 11, 2024
27feb51
top level foundry project
cam-schultz Jul 11, 2024
a1c1330
update forget-std ver
cam-schultz Jul 11, 2024
821c980
remove contracts/src
cam-schultz Jul 11, 2024
6a22956
update bindings
cam-schultz Jul 11, 2024
ca9155a
update paths in jobs
cam-schultz Jul 11, 2024
a6a4da9
format
cam-schultz Jul 11, 2024
ddcf620
update path
cam-schultz Jul 11, 2024
deb2569
subnet-evm v0.6.1
cam-schultz Jul 11, 2024
bdd9297
forge-std v1
cam-schultz Jul 11, 2024
4bc2441
bump foundry version
cam-schultz Jul 11, 2024
78212b2
bump foundry ver
cam-schultz Jul 12, 2024
2273773
format
cam-schultz Jul 12, 2024
6000426
update bindings
cam-schultz Jul 12, 2024
d6fd2cc
ignore test compiler warnings
cam-schultz Jul 12, 2024
16fb775
fix compiler warnings
cam-schultz Jul 17, 2024
5c88d99
lowercase dirs
cam-schultz Jul 17, 2024
1488a35
governance and utilities dirs
cam-schultz Jul 17, 2024
7b48f10
Merge branch 'main' into contracts-top-level
cam-schultz Jul 17, 2024
81ebe2c
complete merge
cam-schultz Jul 17, 2024
fc4120c
Partial Merge branch 'main' into contracts-top-level
cam-schultz Jul 26, 2024
93fe8b5
finish merge
cam-schultz Jul 26, 2024
56c416e
Merge branch 'main' into contracts-top-level
cam-schultz Jul 31, 2024
fd5b9f6
remove ignore=dirty
cam-schultz Jul 31, 2024
fb216a7
update docs path
cam-schultz Jul 31, 2024
fae3473
disable auto remapping
cam-schultz Jul 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
- name: Build Contracts
run: |
export PATH=$PATH:$HOME/.foundry/bin
cd contracts/
forge build --force --extra-output-files bin

- name: Build changelog
Expand All @@ -49,12 +48,12 @@ jobs:
- name: Create Artifacts
id: artifacts
run: |
go run utils/contract-deployment/contractDeploymentTools.go constructKeylessTx contracts/out/TeleporterMessenger.sol/TeleporterMessenger.json
go run utils/contract-deployment/contractDeploymentTools.go constructKeylessTx out/TeleporterMessenger.sol/TeleporterMessenger.json
mv UniversalTeleporterDeployerTransaction.txt ${{ env.deployment_tx_fn }}
mv UniversalTeleporterDeployerAddress.txt ${{ env.deployer_addr_fn }}
mv UniversalTeleporterMessengerContractAddress.txt ${{ env.contract_addr_fn }}
mv contracts/out/TeleporterMessenger.sol/TeleporterMessenger.bin ${{ env.teleporter_messenger_bytecode_fn }}
mv contracts/out/TeleporterRegistry.sol/TeleporterRegistry.bin ${{ env.teleporter_registry_bytecode_fn }}
mv out/TeleporterMessenger.sol/TeleporterMessenger.bin ${{ env.teleporter_messenger_bytecode_fn }}
mv out/TeleporterRegistry.sol/TeleporterRegistry.bin ${{ env.teleporter_registry_bytecode_fn }}

- name: Create release
uses: softprops/action-gh-release@v2
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/slither.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ jobs:
- name: Run Slither
run: |
export PATH=$PATH:$HOME/.foundry/bin
cd contracts
slither ./ --fail-none --sarif ./results.sarif

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: contracts/results.sarif
sarif_file: results.sarif
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
- name: Run unit tests
run: |
export PATH=$PATH:$HOME/.foundry/bin
cd contracts/
forge test -vvv

go-unit-tests:
Expand Down
19 changes: 10 additions & 9 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
[submodule "contracts/lib/forge-std"]
path = contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/forge-std"]
branch = v1.3.0
[submodule "contracts/lib/openzeppelin-contracts"]
path = contracts/lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
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
[submodule "lib/subnet-evm"]
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.

branch = v0.6.1
path = lib/subnet-evm
url = https://github.com/ava-labs/subnet-evm
File renamed without changes.
1 change: 1 addition & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib/
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ The user wallet set in `.env` must have native tokens for each of the Subnets us

## Upgradeability

The Teleporter contract is non-upgradeable and can not be changed once it is deployed. This provides immutability to the contracts, and ensures that the contract's behavior at each address is unchanging. However, to allow for new features and potential bug fixes, new versions of the Teleporter contract can be deployed to different addresses. The [TeleporterRegistry](./contracts/src/Teleporter/TeleporterRegistry.sol) is used to keep track of the deployed versions of Teleporter, and to provide a standard interface for dApps to interact with the different Teleporter versions.
The Teleporter contract is non-upgradeable and can not be changed once it is deployed. This provides immutability to the contracts, and ensures that the contract's behavior at each address is unchanging. However, to allow for new features and potential bug fixes, new versions of the Teleporter contract can be deployed to different addresses. The [TeleporterRegistry](./contracts/Teleporter/TeleporterRegistry.sol) is used to keep track of the deployed versions of Teleporter, and to provide a standard interface for dApps to interact with the different Teleporter versions.

`TeleporterRegistry` **is not mandatory** for dApps built on top of Teleporter, but dApp's are recommended to leverage the registry to ensure they use the latest Teleporter version available. Another recommendation standard is to have a single canonical `TeleporterRegistry` for each Subnet chain, and unlike the Teleporter contract, the registry does not need to be deployed to the same address on every chain. This means the registry does not need a Nick's method deployment, and can be at different contract addresses on different chains.

For more information on the registry and how to integrate with Teleporter dApps, see the [Upgradeability doc](./contracts/src/Teleporter/upgrades/README.md).
For more information on the registry and how to integrate with Teleporter dApps, see the [Upgradeability doc](./contracts/Teleporter/upgrades/README.md).

## Deploy Teleporter to a Subnet

Expand Down Expand Up @@ -181,10 +181,8 @@ The auto-generated bindings should be written under the `abi-bindings/` director

## Docs

- [Teleporter Protocol Overview](./contracts/src/Teleporter/README.md)
- [Cross Chain Applications](./contracts/src/CrossChainApplications/README.md)
- [Getting Started](./contracts/src/CrossChainApplications/GETTING_STARTED.md)
- [Teleporter Upgradeability](./contracts/src/Teleporter/upgrades/README.md)
- [Teleporter Protocol Overview](./contracts/Teleporter/README.md)
- [Teleporter Upgradeability](./contracts/Teleporter/upgrades/README.md)
- [Contract Deployment](./utils/contract-deployment/README.md)
- [Teleporter CLI](./cmd/teleporter-cli/README.md)

Expand Down
2 changes: 1 addition & 1 deletion abi-bindings/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## ABI Bindings

This directory contains ABI bindings for the Solidity contracts in the `contracts/src/CrossChainApplications` and `contracts/src/Teleporter` directories. The files with the same name as the Solidity source files are automatically generated by the `scripts/abi_bindings.sh` script. Other files in this directory (such as the packing utilities) are manually created and maintained.
This directory contains Solidity contract ABI bindings. The files with the same name as the Solidity source files are automatically generated by the `scripts/abi_bindings.sh` script. Other files in this directory (such as the packing utilities) are manually created and maintained.
4 changes: 2 additions & 2 deletions abi-bindings/go/Mocks/ExampleERC20/ExampleERC20.go

Large diffs are not rendered by default.

Loading
Loading