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

Deprecate truffle #3395

Open
wants to merge 87 commits into
base: main
Choose a base branch
from
Open

Deprecate truffle #3395

wants to merge 87 commits into from

Conversation

derpy-duck
Copy link
Contributor

@derpy-duck derpy-duck commented Sep 24, 2023

What does this PR do?

**Goal: ** Substitute out Truffle and Ganache for Forge and Anvil

Changes:

  • Eth-devnet.yaml and Eth-devnet2.yaml each start up (in CI and in Tilt) a local ethereum chain using Anvil now, instead of ganache.

  • The Core, Token, and NFT bridge contracts now use openzeppelin v4.8.1 instead of v4.3.1 - this is an upgrade to keep consistency with the Relayer contracts. NOTE: IF making a contract change to the core, token, and NFT bridges is not desired, revert the corresponding commit (most recent as of this comment) doing this!

  • Forge scripts are written for:
    - Deploying the Core Bridge,
    - Deploying the Token Bridge,
    - Deploying the NFT Bridge,
    - Deploying the Core Bridge (Implementation only),
    - Deploying the Token Bridge (Implementation only),
    - Deploying the NFT Bridge (Implementation only),
    - Deploying the Core Bridge Shutdown contract,
    - Deploying the Token Bridge Shutdown contract,
    - Deploying the NFT Bridge Shutdown contract,
    - Registering chains on the Token Bridge (with registration VAAs passed in as input),
    - Registering chains on the NFT Bridge (with registration VAAs passed in as input),

  • Bash scripts are written for:
    - Deploying the Core Bridge,
    - Deploying the Token Bridge,
    - Deploying the NFT Bridge,
    - Registering chains on the token bridge,
    - Registering chains on the NFT bridge,
    These bash scripts are used in automated devnet/CI deployments, but also can be used for manual deployments because they prompt the user for any variables that haven't been automatically passed in.

  • The corresponding scripts for the above that were for Truffle were deleted

  • The simulate_upgrade bash script (works for Core, Token, NFT bridge) was modified to work with the new deployment process

  • The upgrade bash script (works for Core, Token, NFT bridge) was modified to work with the new deployment process

  • The verify bash script (checks that deployed bytecode matches local bytecode) (works for Core, Token, NFT bridge) was modified to work with the new deployment process

  • Some relayer tests were modified - the mining behavior is slightly different now because in ganache, blocks were mined for every transaction as well as once every second, whereas here, we simply mine once every second. Small test modifications were enough to keep tests passing

  • build artifacts now live in build-forge/file.sol/file.json rather than build/contracts/file.json - some places were modified because of this

  • Prune the package.json in the ethereum folder a little bit - including removing the @certusone/wormhole-sdk dependency

  • All truffle tests were removed

  • Removes 'generate-abi.sh' and 'generate-abi-celo.sh' - these are scripts that use truffle and only @bruce-riley uses, and he will re-write them to use forge if he ever needs them. thank you Bruce! :)

  • Adds 61-ish forge tests for the Core Bridge, Token Bridge, NFT bridge that were originally written as truffle tests (and adds four TokenMigrator tests that were originally written as truffle tests)

  • There are a few tests here: https://github.com/wormhole-foundation/wormhole/blob/main/ethereum/test/upgrades/01_tokenbridge_feetoken_support.js that weren't rewritten - input on if these need to be rewritten would help.

ethereum/upgrade Outdated Show resolved Hide resolved
ethereum/package.json Outdated Show resolved Hide resolved
devnet/eth-devnet.yaml Show resolved Hide resolved
ethereum/Makefile Show resolved Hide resolved
@scnale
Copy link
Collaborator

scnale commented Oct 24, 2023

The Relayer contracts now use openzeppelin v4.3.1 instead of v4.8.1 - this is a downgrade to keep consistency with the Core, Token, and NFT bridge. This results in a bytecode change in the relayer contracts, modifying their address, hence the address change in devnet/CI

I think we should actually upgrade to the latest openzeppelin release instead. I'm not sure if any of the vulnerabilities found since that old version affects us but we could definitely benefit from improved docstrings and implementations at the very least.

@scnale
Copy link
Collaborator

scnale commented Oct 24, 2023

The same goes for the compiler version, I'd bump it to the latest one.

@SEJeff
Copy link
Collaborator

SEJeff commented Oct 24, 2023

@scnale Re:

The same goes for the compiler version, I'd bump it to the latest one.

Solidity >= 0.8.20 include the new push0 opcode, which some Layer 2 chains such as Arbitrum do not support. If you build with that compiler and it uses that opcode, it will be impossible to deploy or run those contracts on those L2s.

@scnale
Copy link
Collaborator

scnale commented Oct 26, 2023

Solidity >= 0.8.20 include the new push0 opcode, which some Layer 2 chains such as Arbitrum do not support. If you build with that compiler and it uses that opcode, it will be impossible to deploy or run those contracts on those L2s.

We're already handling this in the foundry config by setting the EVM version explicitly to paris (merge). See here.

Just to clarify: the EVM version is an option for the compiler. You can choose the target version to avoid generating bytecode incompatible with an older version. This is what foundry does for us.

@derpy-duck
Copy link
Contributor Author

derpy-duck commented Oct 30, 2023

The Relayer contracts now use openzeppelin v4.3.1 instead of v4.8.1 - this is a downgrade to keep consistency with the Core, Token, and NFT bridge. This results in a bytecode change in the relayer contracts, modifying their address, hence the address change in devnet/CI

I think we should actually upgrade to the latest openzeppelin release instead. I'm not sure if any of the vulnerabilities found since that old version affects us but we could definitely benefit from improved docstrings and implementations at the very least.

The Relayer contracts now use openzeppelin v4.3.1 instead of v4.8.1 - this is a downgrade to keep consistency with the Core, Token, and NFT bridge. This results in a bytecode change in the relayer contracts, modifying their address, hence the address change in devnet/CI

I think we should actually upgrade to the latest openzeppelin release instead. I'm not sure if any of the vulnerabilities found since that old version affects us but we could definitely benefit from improved docstrings and implementations at the very least.

@scnale I think my main worry with that is it is a contract change to the Core, Token, and NFT bridge - which is maybe okay? (and same with bumping the solc version I suppose?) - in any case perhaps it should be done in a seperate PR given this one is already substantial and 'contract changes to Core contracts' probably increases the significance of this PR to more than it's current significance?

@derpy-duck derpy-duck force-pushed the deprecate-truffle branch 5 times, most recently from 348a88d to 174c784 Compare November 1, 2023 21:02
@scnale
Copy link
Collaborator

scnale commented Nov 3, 2023

What does change is the output of the compiler, but no changes to the contracts themselves should be required since there aren't any breaking changes within the 0.8 series as far as I recall. I'd say that we're more at risk of introducing bugs by downgrading than upgrading.

@evan-gray
Copy link
Collaborator

After #3877, everything in Tilt will have been ported to use Forge / Anvil instead of Truffle / Ganache.

This leaves the only remaining ganache / truffle use as make test-ganache and make test-upgrades

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

Successfully merging this pull request may close these issues.

None yet

4 participants