Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
bba041d5
Unverified
Commit
bba041d5
authored
Oct 21, 2021
by
Maurelian
Committed by
Kelvin Fichter
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(contracts): Move to a single address setter step at end
parent
bc8943d0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
139 deletions
+33
-139
070-Proxy__OVM_L1CrossDomainMessenger.deploy.ts
...ts/deploy/070-Proxy__OVM_L1CrossDomainMessenger.deploy.ts
+13
-11
080-Proxy__OVM_L1StandardBridge.deploy.ts
...ontracts/deploy/080-Proxy__OVM_L1StandardBridge.deploy.ts
+0
-0
090-OVM_L1StandardBridge.deploy.ts
packages/contracts/deploy/090-OVM_L1StandardBridge.deploy.ts
+1
-1
110-AddressSetter.deploy.ts
packages/contracts/deploy/110-AddressSetter.deploy.ts
+5
-2
110-AddressSetter2.deploy.ts
packages/contracts/deploy/110-AddressSetter2.deploy.ts
+0
-40
111-set-addresses.ts
packages/contracts/deploy/111-set-addresses.ts
+14
-20
111-set-addresses2.ts
packages/contracts/deploy/111-set-addresses2.ts
+0
-65
No files found.
packages/contracts/deploy/0
8
0-Proxy__OVM_L1CrossDomainMessenger.deploy.ts
→
packages/contracts/deploy/0
7
0-Proxy__OVM_L1CrossDomainMessenger.deploy.ts
View file @
bba041d5
...
...
@@ -24,18 +24,20 @@ const deployFn: DeployFunction = async (hre) => {
contract
:
'
Lib_ResolvedDelegateProxy
'
,
iface
:
'
L1CrossDomainMessenger
'
,
args
:
[
Lib_AddressManager
.
address
,
'
OVM_L1CrossDomainMessenger
'
],
postDeployAction
:
async
(
contract
)
=>
{
console
.
log
(
`Initializing Proxy__OVM_L1CrossDomainMessenger...`
)
await
contract
.
initialize
(
Lib_AddressManager
.
address
)
// This reverts on a fresh deploy, because the implementation is not yet added to the AddressManager.
// I think the best option is to do the initialization atomically from within the AddressSetter.
// postDeployAction: async (contract) => {
// console.log(`Initializing Proxy__OVM_L1CrossDomainMessenger...`)
// await contract.initialize(Lib_AddressManager.address)
console
.
log
(
`Checking that contract was correctly initialized...`
)
await
waitUntilTrue
(
async
()
=>
{
return
hexStringEquals
(
await
contract
.
libAddressManager
(),
Lib_AddressManager
.
address
)
})
},
//
console.log(`Checking that contract was correctly initialized...`)
//
await waitUntilTrue(async () => {
//
return hexStringEquals(
//
await contract.libAddressManager(),
//
Lib_AddressManager.address
//
)
//
})
//
},
})
}
...
...
packages/contracts/deploy/0
9
0-Proxy__OVM_L1StandardBridge.deploy.ts
→
packages/contracts/deploy/0
8
0-Proxy__OVM_L1StandardBridge.deploy.ts
View file @
bba041d5
File moved
packages/contracts/deploy/
10
0-OVM_L1StandardBridge.deploy.ts
→
packages/contracts/deploy/
09
0-OVM_L1StandardBridge.deploy.ts
View file @
bba041d5
/* Imports: External */
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
ethers
}
from
'
ethers
'
import
{
hexStringEquals
}
from
'
@eth-optimism/core-utils
'
import
{
hexStringEquals
,
sleep
}
from
'
@eth-optimism/core-utils
'
/* Imports: Internal */
import
{
predeploys
}
from
'
../src/predeploys
'
...
...
packages/contracts/deploy/
070-AddressSetter1
.deploy.ts
→
packages/contracts/deploy/
110-AddressSetter
.deploy.ts
View file @
bba041d5
...
...
@@ -17,6 +17,7 @@ const deployFn: DeployFunction = async (hre) => {
// ToDo: Clean up the method of mapping names to addresses esp.
// There's probably a more functional way to generate an object or something.
// ToDo: in the case of an upgrade, only add names of contracts that are new deployed.
const
names
=
[
'
ChainStorageContainer-CTC-batches
'
,
'
ChainStorageContainer-SCC-batches
'
,
...
...
@@ -24,6 +25,8 @@ const deployFn: DeployFunction = async (hre) => {
'
StateCommitmentChain
'
,
'
BondManager
'
,
'
OVM_L1CrossDomainMessenger
'
,
'
Proxy__L1CrossDomainMessenger
'
,
'
Proxy__L1StandardBridge
'
,
]
const
addresses
=
await
Promise
.
all
(
...
...
@@ -51,7 +54,7 @@ const deployFn: DeployFunction = async (hre) => {
await
deployAndPostDeploy
({
hre
,
name
:
'
AddressSetter
1
'
,
name
:
'
AddressSetter
'
,
contract
:
'
AddressSetter
'
,
args
:
[
Lib_AddressManager
.
address
,
...
...
@@ -62,6 +65,6 @@ const deployFn: DeployFunction = async (hre) => {
})
}
deployFn
.
tags
=
[
'
fresh
'
,
'
upgrade
'
,
'
AddressSetter
1
'
]
deployFn
.
tags
=
[
'
fresh
'
,
'
upgrade
'
,
'
AddressSetter
'
]
export
default
deployFn
packages/contracts/deploy/110-AddressSetter2.deploy.ts
deleted
100644 → 0
View file @
bc8943d0
/* Imports: External */
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
/* Imports: Internal */
import
{
deployAndPostDeploy
,
getDeployedContract
,
getReusableContract
,
}
from
'
../src/hardhat-deploy-ethers
'
import
{
predeploys
}
from
'
../src/predeploys
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
Lib_AddressManager
=
await
getReusableContract
(
hre
,
'
Lib_AddressManager
'
)
const
names
=
[
'
Proxy__L1CrossDomainMessenger
'
,
'
Proxy__L1StandardBridge
'
]
const
addresses
=
await
Promise
.
all
(
names
.
map
(
async
(
n
)
=>
{
return
(
await
getDeployedContract
(
hre
,
n
)).
address
})
)
await
deployAndPostDeploy
({
hre
,
name
:
'
AddressSetter2
'
,
args
:
[
Lib_AddressManager
.
address
,
(
hre
as
any
).
deployConfig
.
ovmAddressManagerOwner
,
names
,
addresses
,
],
})
}
deployFn
.
tags
=
[
'
fresh
'
,
'
upgrade
'
,
'
AddressSetter2
'
]
export
default
deployFn
packages/contracts/deploy/
071-set-addresses1
.ts
→
packages/contracts/deploy/
111-set-addresses
.ts
View file @
bba041d5
...
...
@@ -3,18 +3,15 @@ import { hexStringEquals } from '@eth-optimism/core-utils'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
/* Imports: Internal */
import
{
getDeployedContract
,
getReusableContract
,
waitUntilTrue
,
}
from
'
../src/hardhat-deploy-ethers
'
import
{
getLiveContract
,
waitUntilTrue
}
from
'
../src/hardhat-deploy-ethers
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
addressSetter1
=
await
getDeployedContract
(
hre
,
'
AddressSetter1
'
)
const
libAddressManager
=
await
getReusableContract
(
hre
,
'
Lib_AddressManager
'
)
const
names
=
await
addressSetter1
.
getNames
()
const
addresses
=
await
addressSetter1
.
getAddresses
()
const
finalOwner
=
await
addressSetter1
.
finalOwner
()
const
addressSetter
=
await
getLiveContract
(
hre
,
'
AddressSetter
'
)
const
libAddressManager
=
await
getLiveContract
(
hre
,
'
Lib_AddressManager
'
)
const
names
=
await
addressSetter
.
getNames
()
const
addresses
=
await
addressSetter
.
getAddresses
()
const
finalOwner
=
await
addressSetter
.
finalOwner
()
let
currentOwner
console
.
log
(
'
\n
'
,
...
...
@@ -30,15 +27,13 @@ const deployFn: DeployFunction = async (hre) => {
console
.
log
(
` then transfer ownership of the Address Manager at (
${
libAddressManager
.
address
}
)`
)
console
.
log
(
` to the Address Setter contract at
${
addressSetter
1
.
address
}
.`
)
console
.
log
(
` to the Address Setter contract at
${
addressSetter
.
address
}
.`
)
await
waitUntilTrue
(
async
()
=>
{
console
.
log
(
'
Checking ownership of Lib_AddressManager
'
)
return
hexStringEquals
(
await
libAddressManager
.
owner
(),
addressSetter1
.
address
)
currentOwner
=
await
libAddressManager
.
owner
()
console
.
log
(
'
Checking ownership of Lib_AddressManager...
'
)
return
hexStringEquals
(
currentOwner
,
addressSetter
.
address
)
},
{
// Try every 30 seconds for 500 minutes.
...
...
@@ -48,18 +43,17 @@ const deployFn: DeployFunction = async (hre) => {
)
// Set the addresses!
await
addressSetter
1
.
setAddresses
()
await
addressSetter
.
setAddresses
()
c
onst
c
urrentOwner
=
await
libAddressManager
.
owner
()
currentOwner
=
await
libAddressManager
.
owner
()
console
.
log
(
'
Verifying final ownership of Lib_AddressManager
'
)
if
(
!
hexStringEquals
(
finalOwner
,
currentOwner
))
{
// todo: pause here get user input deciding whether to continue or exit?
console
.
log
(
`The current address manager owner
${
currentOwner
}
, \nis not equal to the expected owner:
${
finalOwner
}
`
)
}
}
deployFn
.
tags
=
[
'
fresh
'
,
'
upgrade
'
,
'
set-addresses
1
'
]
deployFn
.
tags
=
[
'
fresh
'
,
'
upgrade
'
,
'
set-addresses
'
]
export
default
deployFn
packages/contracts/deploy/111-set-addresses2.ts
deleted
100644 → 0
View file @
bc8943d0
/* Imports: External */
import
{
hexStringEquals
}
from
'
@eth-optimism/core-utils
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
/* Imports: Internal */
import
{
getDeployedContract
,
getReusableContract
,
waitUntilTrue
,
}
from
'
../src/hardhat-deploy-ethers
'
// todo: reduce redundancy between this and 071
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
addressSetter2
=
await
getDeployedContract
(
hre
,
'
AddressSetter2
'
)
const
libAddressManager
=
await
getReusableContract
(
hre
,
'
Lib_AddressManager
'
)
const
names
=
await
addressSetter2
.
getNames
()
const
addresses
=
await
addressSetter2
.
getAddresses
()
const
finalOwner
=
await
addressSetter2
.
finalOwner
()
console
.
log
(
'
An Address Setter contract has been deployed, with the following address <=> name pairs:
'
)
for
(
let
i
=
0
;
i
<
names
.
length
;
i
++
)
{
console
.
log
(
`
${
addresses
[
i
]}
<=>
${
names
[
i
]}
`
)
}
console
.
log
(
'
\n
'
,
'
Please verify the values above, and the deployment steps up to this point,
'
)
console
.
log
(
` then transfer ownership of the Address Manager at (
${
libAddressManager
.
address
}
)`
)
console
.
log
(
` to the Address Setter contract at
${
addressSetter2
.
address
}
.`
)
await
waitUntilTrue
(
async
()
=>
{
console
.
log
(
'
Checking ownership of Lib_AddressManager
'
)
return
hexStringEquals
(
await
libAddressManager
.
owner
(),
addressSetter2
.
address
)
},
{
// Try every 30 seconds for 500 minutes.
delay
:
30
_000
,
retries
:
1000
,
}
)
// Set the addresses!
await
addressSetter2
.
setAddresses
()
const
currentOwner
=
await
libAddressManager
.
owner
()
console
.
log
(
'
Verifying final ownership of Lib_AddressManager
'
)
if
(
!
hexStringEquals
(
finalOwner
,
currentOwner
))
{
// todo: pause here get user input deciding whether to continue or exit?
console
.
log
(
`The current address manager owner
${
currentOwner
}
, \nis not equal to the expected owner:
${
finalOwner
}
`
)
}
}
deployFn
.
tags
=
[
'
fresh
'
,
'
upgrade
'
,
'
set-addresses2
'
]
export
default
deployFn
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment