Skip to content

Commit c933b91

Browse files
committed
upgrades: cli should not check bytescode in creation for proxy
1 parent c99e432 commit c933b91

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

contracts/upgrades/GraphProxy.sol

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ contract GraphProxy is GraphProxyStorage {
4949
return _implementation();
5050
}
5151

52+
/**
53+
* @return The address of the pending implementation.
54+
*/
55+
function pendingImplementation() external view returns (address) {
56+
return _pendingimplementation();
57+
}
58+
5259
/**
5360
* @dev Upgrades to a new implementation contract.
5461
* @param _newImplementation Address of implementation contract

scripts/cli/commands/upgrade.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const upgrade = async (cli: CLIEnvironment, cliArgs: CLIArgs): Promise<vo
3434
savedAddress,
3535
cli.addressBook,
3636
cli.wallet.provider,
37+
false,
3738
)
3839
if (!isDeployed) {
3940
logger.error(
@@ -55,10 +56,10 @@ export const upgrade = async (cli: CLIEnvironment, cliArgs: CLIArgs): Promise<vo
5556
}
5657

5758
// Upgrade to new implementation
58-
const pendingImplementation = (await proxy.functions['pendingImplementation']())[0]
59-
if (pendingImplementation != implAddress) {
60-
await sendTransaction(cli.wallet, proxy, 'upgradeTo', ...[implAddress])
61-
}
59+
// const pendingImplementation = (await proxy.functions['pendingImplementation']())[0]
60+
// if (pendingImplementation != implAddress) {
61+
await sendTransaction(cli.wallet, proxy, 'upgradeTo', ...[implAddress])
62+
// }
6263

6364
// Accept upgrade from the implementation
6465
const contractArgs = initArgs ? initArgs.split(',') : []

scripts/cli/network.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const isContractDeployed = async (
1717
address: string | undefined,
1818
addressBook: AddressBook,
1919
provider: providers.Provider,
20+
checkCreationCode = true,
2021
): Promise<boolean> => {
2122
logger.log(`Checking for valid ${name} contract...`)
2223
if (!address || address === '') {
@@ -29,12 +30,15 @@ export const isContractDeployed = async (
2930
// If the contract is behind a proxy we check the Proxy artifact instead
3031
const artifact = addressEntry.proxy === true ? loadArtifact('GraphProxy') : loadArtifact(name)
3132

32-
const savedCreationCodeHash = addressEntry.creationCodeHash
33-
const creationCodeHash = hash(artifact.bytecode)
34-
if (!savedCreationCodeHash || savedCreationCodeHash !== creationCodeHash) {
35-
logger.warn(`creationCodeHash in our address book doesn't match ${name} artifacts`)
36-
logger.log(`${savedCreationCodeHash} !== ${creationCodeHash}`)
37-
return false
33+
if (checkCreationCode) {
34+
const savedCreationCodeHash = addressEntry.creationCodeHash
35+
console.log(artifact.bytecode)
36+
const creationCodeHash = hash(artifact.bytecode)
37+
if (!savedCreationCodeHash || savedCreationCodeHash !== creationCodeHash) {
38+
logger.warn(`creationCodeHash in our address book doesn't match ${name} artifacts`)
39+
logger.log(`${savedCreationCodeHash} !== ${creationCodeHash}`)
40+
return false
41+
}
3842
}
3943

4044
const savedRuntimeCodeHash = addressEntry.runtimeCodeHash

0 commit comments

Comments
 (0)