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

bug: current contract deployments can't be replicated with current code #93

Open
fedgiac opened this issue Oct 25, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@fedgiac
Copy link
Contributor

fedgiac commented Oct 25, 2024

Problem

It doesn't appear to be possible to deterministically redeploy the contracts with the code in this repo anymore, not even by checking out old commits.

Impact

Deterministic contract addresses are either not available or require bespoke procedures when deploying the contract on a new chain. Contract verification becomes in turn more difficult.

To reproduce

Execute the deployment command without broadcasting:

$ ETH_RPC_URL='https://eth.llamarpc.com'
$ forge script script/deploy_ProdStack.s.sol:DeployProdStack --rpc-url $ETH_RPC_URL -vvvv

Extract the expected deployment addresses:

$ cat ./broadcast/deploy_ProdStack.s.sol/1/dry-run/run-latest.json | jq --sort-keys '[ .transactions[] | select(.transactionType=="CREATE2") | { key: .contractName, 
value: .contractAddress} ] | from_entries' 
{
  "ComposableCoW": "0x3b69dfad2957ac71f8e1ee81f6901e6cb6695f1c",
  "CurrentBlockTimestampFactory": "0x302f261eb0b22dfb4a3d29f32503b1b6f7600f5b",
  "ExtensibleFallbackHandler": "0xa610bd67f02e84d5493ed002c3bb45d0415bf0df",
  "GoodAfterTime": "0x3b9122d50c0bbb81672c355187a05b301b00ce75",
  "PerpetualStableSwap": "0x963f411ac754055b611fe464fa4d50772e9b1f9c",
  "StopLoss": "0xab83e5bcce08b7c014c287cd07b6a0d4d9399746",
  "TWAP": "0xbf39aef05ca2f9c92b01088f90ebfc0715f02b75",
  "TradeAboveThreshold": "0x6e54d4d8f52a71cc6c6d95a6f06e696f69f99abf"
}

Compare with current addresses and observe that they all differ:

$ cat ./networks.json | jq --sort-keys '[. | to_entries[] | {key:.key, value: .value."1".address}] | from_entries'
{
  "ComposableCoW": "0xfdaFc9d1902f4e0b84f65F49f244b32b31013b74",
  "CurrentBlockTimestampFactory": "0x52eD56Da04309Aca4c3FECC595298d80C2f16BAc",
  "ExtensibleFallbackHandler": "0x2f55e8b20D0B9FEFA187AA7d00B6Cbe563605bF5",
  "GoodAfterTime": "0xdaf33924925e03c9cc3a10d434016d6cfad0add5",
  "PerpetualStableSwap": "0x519BA24e959E33b3B6220CA98bd353d8c2D89920",
  "StopLoss": "0x412c36e5011cd2517016d243a2dfb37f73a242e7",
  "TWAP": "0x6cF1e9cA41f7611dEf408122793c358a3d11E5a5",
  "TradeAboveThreshold": "0x812308712a6d1367f437e1c1e4af85c854e1e9f6"
}

Expected behaviour

The addresses should be the same.

ComposableCoW version/commit hash

2ba71df3d5fdbfe8b92a540837262e164a0290ab

Additional context

We can also check the difference in the deployment bytecode, for example by comparing this and this. We can see that they only differ in the metadata bytes.

I suspect this issue has been introduced in 24d556b. However, the code needed to replicate the old behavior was in rndlabs/cowswap-contracts, which is a deleted repo.

@fedgiac fedgiac added the bug Something isn't working label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant