JoinColony / colonyNetwork

Colony Network smart contracts
https://colony.io/
GNU General Public License v3.0
438 stars 106 forks source link

Create2/3 Deployments #1237

Closed area closed 3 months ago

area commented 4 months ago

This is based on (currently broken) feat/multichain-reputation-rebased-hardhat-2 but the PR is being made to allow a review to take place.

Intention is for colonynetwork / colonies to be deployed at the same address on multiple chains - colonyNetwork now, colonies in the future via a cross-chain request that causes the network to deploy a new colony with the specified nonce.

arrenv commented 4 months ago

This is exciting!

area commented 4 months ago

In order to make deterministic (colonyNetwork) deployments work with the test suite, I've had to add snapshots/reverts to the truffle-fixture. That most notably means that the parity tests no longer work. I'm also seeing a timeouts sporadically on Circle, which I think are related to https://github.com/NomicFoundation/hardhat/issues/3136. Fixing that (if indeed switching to an ethers provider does so) feels like a huge endeavour though.

area commented 4 months ago

After convincing myself that the deterministic deployment stuff couldn't be done on the version of ganache we were working with, the upgrade test - deploying at the deterministic address - seems to work?!

kronosapiens commented 4 months ago

I was wondering if you would create a deployColony which takes a salt directly, but then I wondered if perhaps that would allow folks to create colonies that aren't actually theirs? How are you planning on ensuring that only legitimate owners colonies can create parallel colonies on foreign chains?

area commented 4 months ago

I was wondering if you would create a deployColony which takes a salt directly, but then I wondered if perhaps that would allow folks to create colonies that aren't actually theirs?

This is correct, and not something we will be allowing.

How are you planning on ensuring that only legitimate owners colonies can create parallel colonies on foreign chains?

A cross-chain call from the colony itself to ColonyNetwork on another chain, calling an as-yet-not-existent function, which will only be callable in such a fashion, and will check that the provided salt ends up deploying at the same address as the call came from on the other chain.

area commented 3 months ago

We used to set disableConfirmationListener to true in our truffle config to stop truffle spamming thousands of requests to the node.

Moving to hardhat in the way that we did meant we were using @nomiclabs/truffle5, with no way - that I can see - to mimic that config setting. I think a patch to hardhat-truffle5 will do the job, but for now, to get our builds reliably green again, I'm monkeypatching @nomiclabs/truffle-contract to solve the problem.

As well as making the tests more reliable, there does seem to be meaningful speedup for some parts of the test suite: before and after